latexdraw-2.0.8+1.orig/0000755000000000000000000000000004547516600011504 5ustar latexdraw-2.0.8+1.orig/.classpath0000644000000000000000000000100711347255510013461 0ustar latexdraw-2.0.8+1.orig/.cache/0000755000000000000000000000000011347255510012621 5ustar latexdraw-2.0.8+1.orig/.cache/embrace.svg.png0000644000000000000000000000014311347255510015521 0ustar PNG  IHDR *IDATxcOeg00Pn )(.G 5pQGTMIENDB`latexdraw-2.0.8+1.orig/.cache/man.svg.png0000644000000000000000000000022311347255510014675 0ustar PNG  IHDR ZIDATx; ҺJ4N 8<֕ޛ- .L$E^: PdPaQt?9CIENDB`latexdraw-2.0.8+1.orig/.cache/Condenser.svg.png0000644000000000000000000000016711347255510016051 0ustar PNG  IHDR >IDATxcOe0j `߾}_N=ׯ_3< aAќ2j2}hIENDB`latexdraw-2.0.8+1.orig/.cache/Classic grid.svg.png0000644000000000000000000000016411347255510016415 0ustar PNG  IHDR ;IDATxc3S MJ)01b00d3!S@ze?n 8 IENDB`latexdraw-2.0.8+1.orig/.cache/question.svg.png0000644000000000000000000000022611347255510015774 0ustar PNG  IHDR ]IDATx P!ӭKĂxlmܑ* ѹze }J }!h`xз,M4ez; C`? Ҫe`IENDB`latexdraw-2.0.8+1.orig/shortcutWindows.vbs0000644000000000000000000000035011347255510015440 0ustar Dim Shell, DesktopPath, URL Set Shell = CreateObject("WScript.Shell") DesktopPath = Shell.SpecialFolders("Desktop") Set URL = Shell.CreateShortcut(DesktopPath & "\latexdraw.LNK") URL.TargetPath = WScript.Arguments(0) URL.Save latexdraw-2.0.8+1.orig/build.xml0000644000000000000000000000631311347255510013324 0ustar latexdraw-2.0.8+1.orig/.fbprefs0000644000000000000000000001762411347255510013142 0ustar #FindBugs User Preferences #Thu Nov 13 11:18:46 CET 2008 detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true detectorBCPMethodReturnCheck=BCPMethodReturnCheck|false detectorBadAppletConstructor=BadAppletConstructor|false detectorBadResultSetAccess=BadResultSetAccess|true detectorBadSyntaxForRegularExpression=BadSyntaxForRegularExpression|true detectorBadUseOfReturnValue=BadUseOfReturnValue|true detectorBadlyOverriddenAdapter=BadlyOverriddenAdapter|true detectorBooleanReturnNull=BooleanReturnNull|true detectorCallToUnsupportedMethod=CallToUnsupportedMethod|true detectorCalledMethods=CalledMethods|true detectorCheckCalls=CheckCalls|false detectorCheckImmutableAnnotation=CheckImmutableAnnotation|true detectorCheckTypeQualifiers=CheckTypeQualifiers|true detectorCloneIdiom=CloneIdiom|false detectorComparatorIdiom=ComparatorIdiom|true detectorConfusedInheritance=ConfusedInheritance|true detectorConfusionBetweenInheritedAndOuterMethod=ConfusionBetweenInheritedAndOuterMethod|true detectorCrossSiteScripting=CrossSiteScripting|true detectorDoInsideDoPrivileged=DoInsideDoPrivileged|true detectorDontCatchIllegalMonitorStateException=DontCatchIllegalMonitorStateException|true detectorDontUseEnum=DontUseEnum|true detectorDroppedException=DroppedException|true detectorDumbMethodInvocations=DumbMethodInvocations|true detectorDumbMethods=DumbMethods|true detectorDuplicateBranches=DuplicateBranches|true detectorEmptyZipFileEntry=EmptyZipFileEntry|true detectorEqStringTest=EqStringTest|false detectorEqualsOperandShouldHaveClassCompatibleWithThis=EqualsOperandShouldHaveClassCompatibleWithThis|true detectorFinalizerNullsFields=FinalizerNullsFields|true detectorFindBadCast=FindBadCast|false detectorFindBadCast2=FindBadCast2|true detectorFindBadEqualsImplementation=FindBadEqualsImplementation|false detectorFindBadForLoop=FindBadForLoop|true detectorFindBugsSummaryStats=FindBugsSummaryStats|true detectorFindCircularDependencies=FindCircularDependencies|false detectorFindDeadLocalStores=FindDeadLocalStores|true detectorFindDoubleCheck=FindDoubleCheck|true detectorFindEmptySynchronizedBlock=FindEmptySynchronizedBlock|true detectorFindFieldSelfAssignment=FindFieldSelfAssignment|true detectorFindFinalizeInvocations=FindFinalizeInvocations|true detectorFindFloatEquality=FindFloatEquality|true detectorFindFloatMath=FindFloatMath|false detectorFindHEmismatch=FindHEmismatch|true detectorFindInconsistentSync2=FindInconsistentSync2|true detectorFindJSR166LockMonitorenter=FindJSR166LockMonitorenter|true detectorFindLocalSelfAssignment2=FindLocalSelfAssignment2|true detectorFindMaskedFields=FindMaskedFields|true detectorFindMismatchedWaitOrNotify=FindMismatchedWaitOrNotify|true detectorFindNakedNotify=FindNakedNotify|true detectorFindNonSerializableStoreIntoSession=FindNonSerializableStoreIntoSession|true detectorFindNonSerializableValuePassedToWriteObject=FindNonSerializableValuePassedToWriteObject|true detectorFindNonShortCircuit=FindNonShortCircuit|true detectorFindNullDeref=FindNullDeref|true detectorFindNullDerefsInvolvingNonShortCircuitEvaluation=FindNullDerefsInvolvingNonShortCircuitEvaluation|true detectorFindOpenStream=FindOpenStream|true detectorFindPuzzlers=FindPuzzlers|true detectorFindRefComparison=FindRefComparison|true detectorFindReturnRef=FindReturnRef|true detectorFindRunInvocations=FindRunInvocations|true detectorFindSelfComparison=FindSelfComparison|true detectorFindSelfComparison2=FindSelfComparison2|true detectorFindSleepWithLockHeld=FindSleepWithLockHeld|true detectorFindSpinLoop=FindSpinLoop|true detectorFindSqlInjection=FindSqlInjection|true detectorFindTwoLockWait=FindTwoLockWait|true detectorFindUncalledPrivateMethods=FindUncalledPrivateMethods|true detectorFindUnconditionalWait=FindUnconditionalWait|true detectorFindUninitializedGet=FindUninitializedGet|true detectorFindUnrelatedTypesInGenericContainer=FindUnrelatedTypesInGenericContainer|true detectorFindUnreleasedLock=FindUnreleasedLock|true detectorFindUnsatisfiedObligation=FindUnsatisfiedObligation|true detectorFindUnsyncGet=FindUnsyncGet|true detectorFindUselessControlFlow=FindUselessControlFlow|true detectorFormatStringChecker=FormatStringChecker|true detectorHugeSharedStringConstants=HugeSharedStringConstants|true detectorIDivResultCastToDouble=IDivResultCastToDouble|true detectorIncompatMask=IncompatMask|true detectorInconsistentAnnotations=InconsistentAnnotations|true detectorInefficientMemberAccess=InefficientMemberAccess|false detectorInefficientToArray=InefficientToArray|true detectorInfiniteLoop=InfiniteLoop|true detectorInfiniteRecursiveLoop=InfiniteRecursiveLoop|true detectorInfiniteRecursiveLoop2=InfiniteRecursiveLoop2|true detectorInheritanceUnsafeGetResource=InheritanceUnsafeGetResource|true detectorInitializationChain=InitializationChain|true detectorInstantiateStaticClass=InstantiateStaticClass|true detectorInvalidJUnitTest=InvalidJUnitTest|true detectorIteratorIdioms=IteratorIdioms|true detectorLazyInit=LazyInit|true detectorLoadOfKnownNullValue=LoadOfKnownNullValue|true detectorLockedFields=LockedFields|false detectorMethodReturnCheck=MethodReturnCheck|true detectorMethods=Methods|true detectorMultithreadedInstanceAccess=MultithreadedInstanceAccess|true detectorMutableLock=MutableLock|true detectorMutableStaticFields=MutableStaticFields|true detectorNaming=Naming|true detectorNoteAnnotationRetention=NoteAnnotationRetention|true detectorNoteCheckReturnValue=NoteCheckReturnValue|true detectorNoteCheckReturnValueAnnotations=NoteCheckReturnValueAnnotations|true detectorNoteJCIPAnnotation=NoteJCIPAnnotation|true detectorNoteNonNullAnnotations=NoteNonNullAnnotations|true detectorNoteNonnullReturnValues=NoteNonnullReturnValues|true detectorNoteSuppressedWarnings=NoteSuppressedWarnings|true detectorNoteUnconditionalParamDerefs=NoteUnconditionalParamDerefs|true detectorNumberConstructor=NumberConstructor|true detectorOverridingEqualsNotSymmetrical=OverridingEqualsNotSymmetrical|true detectorPreferZeroLengthArrays=PreferZeroLengthArrays|true detectorPublicSemaphores=PublicSemaphores|false detectorQuestionableBooleanAssignment=QuestionableBooleanAssignment|true detectorReadReturnShouldBeChecked=ReadReturnShouldBeChecked|true detectorRedundantInterfaces=RedundantInterfaces|true detectorRepeatedConditionals=RepeatedConditionals|true detectorResolveAllReferences=ResolveAllReferences|false detectorRuntimeExceptionCapture=RuntimeExceptionCapture|false detectorSerializableIdiom=SerializableIdiom|true detectorStartInConstructor=StartInConstructor|true detectorStaticCalendarDetector=StaticCalendarDetector|false detectorStringConcatenation=StringConcatenation|true detectorSuperfluousInstanceOf=SuperfluousInstanceOf|true detectorSuspiciousThreadInterrupted=SuspiciousThreadInterrupted|true detectorSwitchFallthrough=SwitchFallthrough|true detectorSynchronizeAndNullCheckField=SynchronizeAndNullCheckField|true detectorSynchronizeOnClassLiteralNotGetClass=SynchronizeOnClassLiteralNotGetClass|true detectorSynchronizingOnContentsOfFieldToProtectField=SynchronizingOnContentsOfFieldToProtectField|true detectorTestASM=TestASM|false detectorTestingGround=TestingGround|false detectorTrainFieldStoreTypes=TrainFieldStoreTypes|true detectorTrainNonNullAnnotations=TrainNonNullAnnotations|true detectorTrainUnconditionalDerefParams=TrainUnconditionalDerefParams|true detectorURLProblems=URLProblems|true detectorUncallableMethodOfAnonymousClass=UncallableMethodOfAnonymousClass|true detectorUnnecessaryMath=UnnecessaryMath|true detectorUnreadFields=UnreadFields|false detectorUseObjectEquals=UseObjectEquals|true detectorUselessSubclassMethod=UselessSubclassMethod|true detectorVarArgsProblems=VarArgsProblems|true detectorVolatileUsage=VolatileUsage|true detectorWaitInLoop=WaitInLoop|true detectorWrongMapIterator=WrongMapIterator|true detectorXMLFactoryBypass=XMLFactoryBypass|true detector_threshold=2 effort=default filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,EXPERIMENTAL,I18N,MALICIOUS_CODE,MT_CORRECTNESS,PERFORMANCE,SECURITY,STYLE|false filter_settings_neg=| run_at_full_build=true latexdraw-2.0.8+1.orig/lang/0000755000000000000000000000000011347255510012421 5ustar latexdraw-2.0.8+1.orig/lang/es/0000755000000000000000000000000011347255510013030 5ustar latexdraw-2.0.8+1.orig/lang/es/1_9.properties0000644000000000000000000001061511347255510015541 0ustar LaTeXDrawFrame.0=Archivos recientes LaTeXDrawFrame.1=Dibujar una Curva B\u00E9zier Cerrada LaTeXDrawFrame.2=Borrar todo LaTeXDrawFrame.3=Atajos LaTeXDrawFrame.4=Revisar actualizaci\u00F3n LaTeXDrawFrame.5=Formas LaTeXDrawFrame.6=Visualizar todas las figuras LaTeXDrawFrame.7=Si una figura tiene sus coordenas debajo de (0,0), Ud. no podr\u00E1 visualizarla.
Este bot\u00F3n permite trasladar todas las figuras para que sean visibles. LaTeXDrawFrame.8=Definir las propiedades de las gu\u00EDas LaTeXDrawFrame.9=Opacidad de las gu\u00EDas LaTeXDrawFrame.10=Definir la transparencia de las gu\u00EDas. LaTeXDrawFrame.11=Dibujar una curva B\u00E9zier cerrada LaTeXDrawFrame.12=Verifique que la versi\u00F3n de Java Runtime Environment que us\u00F3
para crear este archivo es la misma que el JRE que usa actualmente. LaTeXDrawFrame.13=El f\u00F3lder de Ayuda no puede ser cargado. LaTeXDrawFrame.14=No se puede crear la p\u00E1gina de Ayuda. PSTricksParser.0=begin{center} debe estar fuera de begin{pspicture}...end{pspicture} PSTricksParser.1=end{center} debe estar fuera de begin{pspicture}...end{pspicture} PSTricksParser.2=end{figure} debe estar fuera de begin{pspicture}...end{pspicture} PSTricksParser.3=end{pspicture} o pspicture no encontrado. DrawPanel.0=Actualizar figuras en la cuadr\u00EDcula ParametersAkinPointsFrame.0=Intervalo para puntos: ParametersAkinPointsFrame.1=Abrir ParametersAkinPointsFrame.2=tipo: ParametersAkinPointsFrame.3=Par\u00E1metros de trazo libre ParametersBezierCurveFrame.2=Equilibrar ParametersBezierCurveFrame.3=Equilibrar los Puntos de Control con respecto a la posici\u00F3n de los puntos. ParametersBezierCurveFrame.4=Distancia: ParametersBezierCurveFrame.5=Definir el espacio entre el punto de control y el punto de equilibrio de la curva ParametersBezierCurveFrame.6=X 1er Pt Ctrl ParametersBezierCurveFrame.7=Y 1er Pt Ctrl ParametersBezierCurveFrame.8=X 2do Pt Ctrl ParametersBezierCurveFrame.9=Y 2do Pt Ctrl PreferencesFrame.0=N\u00FAmer de archivos recientes: PreferencesFrame.1=Tema (necesita reiniciar): ShortcutsFrame.1=Secuencia ShortcutsFrame.3=Categor\u00EDa ShortcutsFrame.4=Navegaci\u00F3n ShortcutsFrame.5=Transformaci\u00F3n ShortcutsFrame.6=Dibujo ShortcutsFrame.7=\ (gran traslado) ShortcutsFrame.8=clic izq. ShortcutsFrame.9=Mover Barra de Desplaz. horizontal a la der. ShortcutsFrame.10=Mover Barra de Desplaz. horizontal a la izq. ShortcutsFrame.11=Mover Barra de Desplaz. vertical a la cabecera ShortcutsFrame.12=Mover Barra de Desplaz. vertical al pie de p\u00E1g. ShortcutsFrame.14=Ir al final de Barra de Desplaz. horizontal ShortcutsFrame.15=Ir al comienzo de Barra de Desplaz. horizontal ShortcutsFrame.16=Ir a la parte superior de Barra de Desplaz. vertical ShortcutsFrame.17=Ir a la parte inferior de Barra de Desplaz. vertical ShortcutsFrame.18=Mover las figuras seleccionadas a la derecha ShortcutsFrame.19=Mover las figuras seleccionadas a la izquierda ShortcutsFrame.20=Mover las figuras seleccionadas hacia arriba ShortcutsFrame.21=Mover las figuras seleccionadas hacia abajo ShortcutsFrame.23=Actualizar las figuras seleecionadas en cuadr\u00EDcula actual ShortcutsFrame.25=Seleccionar todas las figuras del dibujo ShortcutsFrame.26=A\u00F1adir la figura cliqueada a la selecci\u00F3n ShortcutsFrame.27=Eliminar la figura marcada de la selecci\u00F3n ShortcutsFrame.28=Seleccionar la pr\u00F3x. o la primera figura (disponible en Modo Selecci\u00F3n) ShortcutsFrame.29=Rueda del rat\u00F3n (mouse) ShortcutsFrame.30=Agrandar/Empeque\u00F1ecer MenusListener.0=Presionar el bot\u00F3n izq. y deslizar el rat\u00F3n para colocar el segundo punto. Soltar el bot\u00F3n para finalizar la creaci\u00F3n. MenusListener.1=Un clic izq. para a\u00F1adir un punto, un clic der. o doble clic izq. para colocar el \u00FAltimo punto y finalizar la creaci\u00F3n. MenusListener.4=Presionar el bot\u00F3n izq. y deslizar el rat\u00F3n para colocar el \u00FAltimo punto. Soltar el bot\u00F3n para finalizar la creaci\u00F3n. MenusListener.5=Un clic izquierdo a\u00F1ade texto. MenusListener.6=Un clic izquierdo a\u00F1ade una cuadr\u00EDcula. MenusListener.7=Un clic izquierdo a\u00F1ade ejes. MenusListener.8=Presionar el bot\u00F3n izq. y deslizar el rat\u00F3n para dibujar la figura. Soltar el bot\u00F3n para finalizar la creaci\u00F3n. MenusListener.9=Un clic izquierdo a\u00F1ade un punto. RecentFilesListener.0=Es imposible accesar este archivo. RecentFilesListener.1=Archivo no puede ser abierto latexdraw-2.0.8+1.orig/lang/es/LaTeXDrawFrame.properties0000644000000000000000000002254511347255510017724 0ustar LaTeXDrawFrame.0=\ ayuda LaTeXDrawFrame.1=Acerca de LaTeXDrawFrame.2=Dibujar l\u00EDnea recta LaTeXDrawFrame.3=Dibujar rect\u00E1ngulo LaTeXDrawFrame.4=Dibujar punto LaTeXDrawFrame.5=Dibujar cuadrado LaTeXDrawFrame.6=Dibujar rombo LaTeXDrawFrame.7=Trazo libre LaTeXDrawFrame.8=Dibujar tri\u00E1ngulo LaTeXDrawFrame.9=Dibujar c\u00EDrculo LaTeXDrawFrame.10=Dibujar cuadr\u00EDcula LaTeXDrawFrame.11=Dibujar una elipse LaTeXDrawFrame.12=Dibujar un pol\u00EDgono LaTeXDrawFrame.13=Seleccionar objeto(s) LaTeXDrawFrame.14=Exhibir bordes LaTeXDrawFrame.15=Ajuste autom\u00E1tico de bordes LaTeXDrawFrame.16=Exportar como ... LaTeXDrawFrame.17=Borrar Objeto LaTeXDrawFrame.18=Cerrar LaTeXDrawFrame.19=C\u00F3digo PSTricks LaTeXDrawFrame.20=figura JPEG LaTeXDrawFrame.21=figura EPS LaTeXDrawFrame.22=Rehacer LaTeXDrawFrame.23=Deshacer LaTeXDrawFrame.25=Guardar proyecto LaTeXDrawFrame.26=Guardar como proyecto LaTeXDrawFrame.27=Abrir proyecto LaTeXDrawFrame.28=Nuevo proyecto LaTeXDrawFrame.29=Imprimir c\u00F3digo LaTeXDrawFrame.30=Imprimir dibujo LaTeXDrawFrame.31=Detras de la figura LaTeXDrawFrame.32=Delante de la figura LaTeXDrawFrame.33=Agrupar LaTeXDrawFrame.34=Desagrupar LaTeXDrawFrame.35=Dibujar arco LaTeXDrawFrame.36=Dibujar \u00E1ngulo LaTeXDrawFrame.37=Dibujar cuerda LaTeXDrawFrame.38=Escala-X LaTeXDrawFrame.39=Escala-Y LaTeXDrawFrame.40=Copiar LaTeXDrawFrame.41=Actualizar plantillas LaTeXDrawFrame.42=Exportar como plantilla LaTeXDrawFrame.43=Pegar LaTeXDrawFrame.44=Cortar LaTeXDrawFrame.45=Cuadr\u00EDcula est\u00E1ndar LaTeXDrawFrame.46=Panel de c\u00F3digo LaTeXDrawFrame.47=Bordes LaTeXDrawFrame.48=Interior LaTeXDrawFrame.51=llenado LaTeXDrawFrame.53=Propiedades de la figura LaTeXDrawFrame.55=A\u00F1adir comentarios LaTeXDrawFrame.56=Preferencias LaTeXDrawFrame.57=Acercar LaTeXDrawFrame.58=Alejar LaTeXDrawFrame.60=A\u00F1adir texto LaTeXDrawFrame.61=Primer plano LaTeXDrawFrame.62=Fondo LaTeXDrawFrame.63=Dibujar Curva B\u00E9zier LaTeXDrawFrame.64=Rotar la figura LaTeXDrawFrame.65=Cambiar ancho del objeto LaTeXDrawFrame.66=Cambiar color de los bordes del objeto LaTeXDrawFrame.67=Si el objeto est\u00E1 seleccionado ser\u00E1 rellenado LaTeXDrawFrame.68=Cambiar color interior del objeto LaTeXDrawFrame.69=Cambiar el color del cuadriculado LaTeXDrawFrame.70=Poner objeto en primer plano LaTeXDrawFrame.71=Poner objeto al fondo LaTeXDrawFrame.72=Elegir objeto que estar\u00E1 detr\u00E1s del objeto seleccionado LaTeXDrawFrame.73=Elegir objeto que estar\u00E1 sobre el objeto seleccionado LaTeXDrawFrame.74=Si se activa, podr\u00E1 rotar el objeto con el rat\u00F3n LaTeXDrawFrame.75=Agrupar varios objetos LaTeXDrawFrame.76=Separar varios objetos LaTeXDrawFrame.77=Definir la posici\u00F3n de los bordes del objeto LaTeXDrawFrame.78=Si se selecciona, el objeto tendr\u00E1 borde doble LaTeXDrawFrame.79=Cambiar el color del espacio entre las l\u00EDneas del doble borde LaTeXDrawFrame.80=\ Ancho LaTeXDrawFrame.82=Ha ocurrido un error al iniciar LaTeXDraw:
LaTeXDrawFrame.83=LaTeXDraw no puede comenzar LaTeXDrawFrame.86=Error en LaTeXDraw LaTeXDrawFrame.88=Archivo LaTeXDrawFrame.89=Editar LaTeXDrawFrame.90=Mostrar LaTeXDrawFrame.91=Dibujar LaTeXDrawFrame.92=C\u00F3digo LaTeXDrawFrame.93=Ayuda LaTeXDrawFrame.94=Acercar el dibujo LaTeXDrawFrame.95=Alejar el dibujo LaTeXDrawFrame.96=Escala 100% LaTeXDrawFrame.103=Plantillas LaTeXDrawFrame.105=No es posible crear el men\u00FA de plantillas\! LaTeXDrawFrame.107=Barra de herramientas LaTeXDrawFrame.108=Crear un nuevo proyecto LaTeXDrawFrame.109=Abrir un proyecto LaTeXDrawFrame.110=Guardar el proyecto LaTeXDrawFrame.113=100% LaTeXDrawFrame.114=Deshacer una acci\u00F3n LaTeXDrawFrame.115=Rehacer una acci\u00F3n LaTeXDrawFrame.116=Dibujar una l\u00EDnea recta LaTeXDrawFrame.117=Dibujar un punto LaTeXDrawFrame.118=Dibujar una figura rectangular LaTeXDrawFrame.119=Dibujar un rect\u00E1ngulo LaTeXDrawFrame.120=Dibujar un cuadrado LaTeXDrawFrame.121=Dibujar un pol\u00EDgono LaTeXDrawFrame.123=Dibujar un rombo LaTeXDrawFrame.124=Dibujar un tri\u00E1ngulo LaTeXDrawFrame.125=Dibujar una elipse LaTeXDrawFrame.127=Dibujar un c\u00EDrculo LaTeXDrawFrame.128=Dibujar un arco LaTeXDrawFrame.130=Dibujar un \u00E1ngulo LaTeXDrawFrame.131=Dibujar una cuerda LaTeXDrawFrame.132=Dibujar una curva B\u00E9zier LaTeXDrawFrame.133=Dibujar una cuadr\u00EDcula LaTeXDrawFrame.136=Seleccione una o varias figuras
LaTeXDrawFrame.138=Objetos,
seleccione los objetos deseados LaTeXDrawFrame.139=Eliminar los objetos seleccionados LaTeXDrawFrame.140=Cambiar las propiedades del objeto LaTeXDrawFrame.141=Mostrar bordes del dibujo
LaTeXDrawFrame.142=Consejo : si muestra los bordes del
LaTeXDrawFrame.143=dibujo, desactive ajuste autom\u00E1tico de bordes para ser capaz de
LaTeXDrawFrame.144=cambiar las dimensiones del dibujo LaTeXDrawFrame.146=Copiado ... LaTeXDrawFrame.147=Pegado ... LaTeXDrawFrame.148=Cortado ... LaTeXDrawFrame.149=Borrado ... LaTeXDrawFrame.151=Seleccione el color del borde doble LaTeXDrawFrame.154=Agrupado ... LaTeXDrawFrame.155=Desagrupado ... LaTeXDrawFrame.156=¿ Desea guardar el proyecto ? LaTeXDrawFrame.158=Rehacer ... LaTeXDrawFrame.159=Deshacer ... LaTeXDrawFrame.160=Plantillas actualizadas ... LaTeXDrawFrame.161=Error en archivo LaTeXDrawFrame.162=Imprimiendo el dibujo ... LaTeXDrawFrame.163=¡ Dibujo impreso \! LaTeXDrawFrame.164=¡ No es posible imprimir el dibujo \! LaTeXDrawFrame.165=Imprimiendo c\u00F3digo ... LaTeXDrawFrame.166=¡ C\u00F3digo impreso \! LaTeXDrawFrame.167=¡ No es posible imprimir el c\u00F3digo \! LaTeXDrawFrame.168=Exportando como plantilla ... LaTeXDrawFrame.169=¡ Plantilla exportada \! LaTeXDrawFrame.170=Exportando el c\u00F3digo PSTricks ... LaTeXDrawFrame.171=Seleccionar LaTeXDrawFrame.172=Exportar el c\u00F3digo PSTricks como archivo TeX LaTeXDrawFrame.173=¿ Desea reemplazar el archivo ? LaTeXDrawFrame.174=Exportar como PSTricks LaTeXDrawFrame.175=¡ C\u00F3digo PStricks exportado \! LaTeXDrawFrame.176=¡ No es posible exportar el c\u00F3digo PSTricks \! LaTeXDrawFrame.177=Exportando como figura ... LaTeXDrawFrame.179=Exportar figuras como LaTeXDrawFrame.182=Exportar como LaTeXDrawFrame.183=\ archivo LaTeXDrawFrame.184=¡ Exportado como figura \! LaTeXDrawFrame.185=¡ No es posible exportar como figura \! LaTeXDrawFrame.186=Guardando el proyecto... LaTeXDrawFrame.188=Guardar el dibujo LaTeXDrawFrame.190=Exportar como archivo JPEG LaTeXDrawFrame.191=¡ Proyecto guardado \! LaTeXDrawFrame.192=¡ No es posible guardar el proyecto \! LaTeXDrawFrame.193=Ha ocurrido un error al guardar el archivo:
LaTeXDrawFrame.197=Craci\u00F3n de un nuevo proyecto... LaTeXDrawFrame.198=¡ Nuevo proyecto creado \! LaTeXDrawFrame.200=Abrir un dibujo LaTeXDrawFrame.201=Abriendo un archivo... LaTeXDrawFrame.202=¡ Archivo abierto \! LaTeXDrawFrame.203=¡ No es posible abrir el archivo \! LaTeXDrawFrame.204=Ha ocurrido un arror al abrir el archivo:
LaTeXDrawFrame.208=
Versi\u00F3n LaTeXDrawFrame.209=\ emitida \! LaTeXDrawFrame.210=Nueva Versi\u00F3n LaTeXDrawFrame.211=¡ Nueva versi\u00F3n disponible \! LaTeXDrawFrame.212=No hay nueva versi\u00F3n LaTeXDrawFrame.213=¡ Es imposible comprobar si hay nuevas versiones \! LaTeXDrawFrame.215=Ayuda de LaTeXDraw LaTeXDrawFrame.218=¡ Un generador de c\u00F3digo PSTricks para LaTeX \! LaTeXDrawFrame.219=Versi\u00F3n LaTeXDrawFrame.220=, compilado LaTeXDrawFrame.221=\ est\u00E1 distribuido bajo los t\u00E9rminos de la Licencia P\u00FAblica General GNU LaTeXDrawFrame.222=\ publicado por Free Software Foundation (version 2) LaTeXDrawFrame.229=Importar ... LaTeXDrawFrame.230=Desde archivo TeX LFrame2.0=Definir el tama\u00F1o de un punto. LFrame2.1=Alinear los objetos seleccionados. LFrame2.10=Distribuir de forma vertical, equidistante, los objetos selecionados. LFrame2.11=Distribuir de forma vertical, con centros equidistantes, los objetos selecionados. LFrame2.12=Distribuir de forma vertical, con l\u00EDmites superiores equidistantes, los objetos selecionados. LFrame2.13=Distribuir de forma horizontal, con los lados izquierdos equidistantes, los objetos selecionados. LFrame2.14=Distribuir de forma horizontal, equidistantes, los objetos selecionados. LFrame2.15=Distribuir de forma horizontal, con los centros equidistantes, los objetos selecionados. LFrame2.16=Distribuir de forma horizontal, con los lados derechos equidistantes, los objetos selecionados. LFrame2.17=Colores LFrame2.18=Imposible abrir el archivo. LFrame2.19=No se encuentra la plantilla. LFrame2.2=Alinear los objetos seleccionados a la izquierda. LFrame2.20=Actualize el menu de plantillas por favor LFrame2.21=Plantilla no encontrada LFrame2.22=No se puede imprimir el documento. LFrame2.23=No se encuentra la impresora. LFrame2.25=Se utiliza la librer\u00ED a jlibeps para crear figuras EPS. LFrame2.3=Alinear los objetos seleccionados a la derecha. LFrame2.4=Alinear los objetos seleccionados a la parte superior. LFrame2.5=Alinear los objetos seleccionados a la parte inferior. LFrame2.6=Alinear los objetos seleccionados horizontalmente por su centro. LFrame2.7=Alinear los objetos seleccionados verticalmente por su centro. LFrame2.8=Distribuir de forma equidistante los objetos seleccionados. LFrame2.9=Distribuir de forma vertical, con la parte inferior equidistante, los objetos seleccionados. LFrame2.26=Nuevo proyecto con la selecci\u00F3n LaTeXDrawFrame.49=Hatchings LaTeXDrawFrame.137=Piece of advice : to select several latexdraw-2.0.8+1.orig/lang/es/1_6.properties0000644000000000000000000000750111347255510015536 0ustar BatchConvertFrame.1=A\u00F1adir subdirectorios BatchConvertFrame.2=A\u00F1adir archivos BatchConvertFrame.4=Eliminar todo BatchConvertFrame.5=Sobreescribir BatchConvertFrame.6=Seleccionar ruta BatchConvertFrame.7=Seleccionar formato BatchConvertFrame.8=Convertir BatchConvertFrame.9=Detener BatchConvertFrame.11=Lista de tareas a ejecutar BatchConvertFrame.12=Seleccione un directorio BatchConvertFrame.13=Seleccionar im\u00E1genes BatchConvertFrame.14=Convertir como : LaTeXDrawFrame.0=Insertar c\u00F3digo PSTricks LaTeXDrawFrame.1=Insertar una imagen LaTeXDrawFrame.2=Convertir figuras LaTeXDrawFrame.3=stop LaTeXDrawFrame.4=Dibujar l\u00EDneas una tras otra LaTeXDrawFrame.5=imagen PPM LaTeXDrawFrame.6=imagen BMP LaTeXDrawFrame.7=imagen PNG LaTeXDrawFrame.9=Parar el an\u00E1lisis gramatical \! LaTeXDrawFrame.10=Insertar LaTeXDrawFrame.11=Insertar varias figuras usando c\u00F3digo PSTricks LaTeXDrawFrame.14=Dibujar varias l\u00EDneas una tras otra LaTeXDrawFrame.15=Importando un archivo PSTriks... LaTeXDrawFrame.16=El int\u00E9rprete actual para PSTricks s\u00F3lo interpreta algunos comandos.
S\u00F3lo puede importar comandos gestionados por LaTeXDraw. LaTeXDrawFrame.17=Importar c\u00F3digo PSTricks LaTeXDrawFrame.18=Este programa usa JUI, utilidades de im\u00E1genes en java. Distribuido bajo LaTeXDrawFrame.19=los t\u00E9rminos de la Licencia P\u00FAblica General GNU. http://schmidt.devlib.org/jiu/ LaTeXDrawFrame.23=Advertencias:
  • PSTricks no puede incluir archivos JPEG, BMP, ...; por lo tanto se crear\u00E1 una imagen EPS con base en la imagen seleccionada,
    en el mismo directorio. La imagen s\u00F3lo ser\u00E1 incluida si usted tiene derechos de escritura en dicho directorio. Adem\u00E1s, TeX no soporta espacios en la ruta, as\u00ED que por favor intente que \u00E9sta no tenga ningun espacio.
LaTeXDrawFrame.25=Cargando la figura .. LaTeXDrawFrame.26=¡ La figura es inv\u00E1lida \! LaTeXDrawFrame.27=¡ No es posible cargar la figura \! LaTeXDrawFrame.28=¡ Figura insertada \! LaTeXDrawFrame.30=\! No hay figura para importar en el archivo \!
Si no es cierto, verifique que su c\u00F3digo esta contenido entre begin{psicture} ...end{pspicture}.
Usted puede enviar el archivo a LaTeXDrawFrame.31=\ si usted cree que existe un error en el int\u00E9rprete de PSTricks. LaTeXDrawFrame.32=¡No se ha selecciona ninguna figura\! LaTeXDrawFrame.33=¡No se ha encontrado ninguna figura para importar\! LaTeXDrawFrame.34=¡ No es posible importar el archivo PSTricks \! LaTeXDrawFrame.35=¡ Importaci\u00F3n cancelada \! LaTeXDrawFrame.36=¡El c\u00F3digo fue convertido en figuras\! InsertPSTricksCodeFrame.0=Insertar figuras basadas en c\u00F3digo PSTricks FatalErrorParsingException.0=
Si el archivo es v\u00E1lido, puede enviarlo a arno_b@users.sourceforge.net Picture.0=% Advertencia : la ruta de la siguiente figura contiene espacios y no podr\u00E1 ser compilada usando TeX \! ParserCmdMessage.0=L\u00EDnea ParserCmdMessage.1=Comando: ParserCmdMessage.2=Excepci\u00F3n: ParserMessagesFrame.0=Comando ParserMessagesFrame.1=L\u00EDnea ParserMessagesFrame.2=Excepci\u00F3n ParserMessagesFrame.3=Se han producido una o m\u00E1s advertencias durante la conversi\u00F3n ParserMessagesFrame.4=int\u00E9rprete de TeX: advertencia(s) ParametersGridFrame.0=Invertir la posici\u00F3n de etiqueta siguiendo X ParametersGridFrame.1=Invertir la posici\u00F3n de etiqueta siguiendo Y PSTricksParser.0=¡ Error durante la lectura del archivo : archivo inv\u00E1lido \! PSTricksParser.1=El uso de pspicture en forma anidada no est\u00E1 aun definida en este programa :
PSTricksParser.2=begin{pspicture}...begin{pspicture} ... end{pspicture}... PSTricksParser.3=¡Error durante la interpretaci\u00F3n del archivo\! latexdraw-2.0.8+1.orig/lang/es/dialogFrames.properties0000644000000000000000000001263511347255510017552 0ustar PreferencesFrame.Pref=Preferencias ... PreferencesFrame.grid=Cuadr\u00EDcula PreferencesFrame.codePanel=Panel de c\u00F3digo PreferencesFrame.antiAl=Anti-alias PreferencesFrame.rendQ=Calidad de dibujo PreferencesFrame.colRendQ=Calidad de color en dibujo PreferencesFrame.AlphaQ=Calidad de interpolaci\u00F3n alfa PreferencesFrame.bordersDraw=Bordes del dibujo PreferencesFrame.codeAuto=Actualizaci\u00F3n de c\u00F3digo autom\u00E1tica (lento) PreferencesFrame.newVers=Verificar nueva versi\u00F3n al abrir el programa PreferencesFrame.lge=Lenguaje (necesita reiniciar el programa) PreferencesFrame.general=General PreferencesFrame.folders=Directorios PreferencesFrame.quality=Calidad PreferencesFrame.selectFolder=Seleccionar un directorio PreferencesFrame.defOpenSave=Directorio por defecto para abrir/guardar acciones: PreferencesFrame.defFold=Directorio por defecto para importar/exportar acciones: PreferencesFrame.errorReadPref=Error de lectura del archivo de preferencias\! PreferencesFrame.prefSaved=Preferencias guardadas \! DrawPropertiesFrame.0=La etiqueta del dibujo DrawPropertiesFrame.1=La leyenda del dibujo DrawPropertiesFrame.2=Propiedades del dibujo DrawPropertiesFrame.3=Por DrawPropertiesFrame.5=En una p\u00E1gina con objetos en cualquier posici\u00F3n DrawPropertiesFrame.6=En la parte superior de la p\u00E1gina DrawPropertiesFrame.7=En la parte inferior de la p\u00E1gina DrawPropertiesFrame.8=Aqu\u00ED DrawPropertiesFrame.9=AQUI \! DrawPropertiesFrame.10=En el centro de la p\u00E1gina DrawPropertiesFrame.11=Posici\u00F3n vertical del dibujo DrawPropertiesFrame.12=Posici\u00F3n horizontal del dibujo DrawPropertiesFrame.13=Cambiar el n\u00FAmero de pixels por unidad de longitud ExceptionFrameDialog.0=Enviar reporte ExceptionFrameDialog.1=¡ Ha ocurrido un error \!
ExceptionFrameDialog.2=
Usted puede enviar el reporte al programador de LaTeXDraw ExceptionFrameDialog.3=Error de LaTeXDraw: ha ocurrido una excepci\u00F3n ExceptionFrameDialog.4=Ha ocurrido un error:
ExceptionFrameDialog.5=Habilitar para crear ExceptionFrameDialog AbstractParametersFrame.0=L\u00EDmite de borde doble AbstractParametersFrame.2=Separador: AbstractParametersFrame.3=Par\u00E1metros generales AbstractParametersFrame.4=Ok AbstractParametersFrame.5=Defecto AbstractParametersFrame.6=Cancelar AbstractParametersFrame.7=Angulo de rotaci\u00F3n: AbstractParametersFrame.8=Espesura: AbstractParametersFrame.10=Tipo de l\u00EDnea: AbstractParametersFrame.11=Anchura del sombreado: AbstractParametersFrame.12=Extremo izquierdo: AbstractParametersFrame.13=Extremo derecho: AbstractParametersFrame.14=Par\u00E1metros de las flechas AbstractParametersFrame.15=Mostrar puntos ctrl AbstractParametersFrame.16=Redondeado AbstractParametersFrame.17=Coord. de centrado eje-X: AbstractParametersFrame.18=Coord. de centrado eje-Y: AbstractParametersFrame.19=Radio : AbstractParametersFrame.20=Di\u00E1metro del punto = AbstractParametersFrame.21=Anchura de la barra = AbstractParametersFrame.22=Longitud del par\u00E9ntesis = AbstractParametersFrame.23=Longitud del par\u00E9ntesis redondeado AbstractParametersFrame.24=por ancho + AbstractParametersFrame.25=por ancho + AbstractParametersFrame.26=Long. punta de flecha AbstractParametersFrame.27=Long. interior punta de flecha AbstractParametersFrame.28=Ancho punta de flecha AbstractParametersFrame.29=Coordenada-X: AbstractParametersFrame.30=Coordenada-Y: AbstractParametersFrame.31=Ancho: AbstractParametersFrame.32=Altura: AbstractParametersFrame.33=Par\u00E1metros de AbstractParametersFrame.34=Seleccionar color de las sombras AbstractParametersFrame.35=Elegir color de frontera doble AbstractParametersFrame.36=Elegir color de los b\u00F3rderes AbstractParametersFrame.37=Elegir color interior AbstractParametersFrame.38=Flechas ParametersArcFrame.0=\u00E1ngulo inicial: ParametersArcFrame.1=\u00E1ngulo final: ParametersArcFrame.2=Tipo de arco: ParametersDotFrame.0=Tipo de punto: ParametersDrawFrame.0=Noroeste X ParametersDrawFrame.1=Noroeste Y ParametersDrawFrame.2=Sudeste X ParametersDrawFrame.3=Sudeste Y ParametersGridFrame.0=Origen en Y: ParametersGridFrame.1=Origen en X: ParametersGridFrame.2=Etiquetas: ParametersGridFrame.3=Unidad: ParametersGridFrame.4=Puntos de subcuadr\u00EDcula: ParametersGridFrame.5=Puntos de cuadr\u00EDcula: ParametersGridFrame.6=Ancho de cuadr\u00EDcula: ParametersGridFrame.7=Ancho de subcuadr\u00EDcula: ParametersGridFrame.8=Subdivisi\u00F3n de rejilla ParametersGridFrame.9=Tama\u00F1o de etiqueta: ParametersLineFrame.0=Coordenada en X izquierda: ParametersLineFrame.1=Coordenada en Y izquierda: ParametersLineFrame.2=Coordenada en X derecha: ParametersLineFrame.3=Coordenada en Y derecha: ParametersTextFrame.0=Negrita ParametersTextFrame.1=It\u00E1lica ParametersTextFrame.2=Fuente: ParametersTextFrame.3=Tama\u00F1o: ParametersTextFrame.4=Texto ParametersGridFrame.10=Subcuadr\u00EDcula: ParametersGridFrame.11=X max: ParametersGridFrame.12=X min: ParametersGridFrame.13=Y max: ParametersGridFrame.14=Y min: ParametersGridFrame.15=Dibujar etiquetas ParametersGridFrame.17=Elegir color de etiquetas ParametersGridFrame.18=Elegir color de subcuadr\u00EDcula ParametersPolygonFrame.1=Punto n\u00B0 ParametersTriangleFrame.0=Centro de base coord-X: ParametersTriangleFrame.1=Centro de base coord-Y: ParamsBC.0=Mover todo ParamsBC.1=Si no est\u00E1 seleccionado, cuando mueva un punto sus puntos de control tambi\u00E9n se mover\u00E1n. ExportDialog.0=Compresi\u00F3n latexdraw-2.0.8+1.orig/lang/es/1_8.properties0000644000000000000000000000477111347255510015546 0ustar UndoRedoManager.0=Transformaci\u00F3n AbstractParametersFrame.0=intervalo: ParametersAxeFrame.0=Forma: ParametersAxeFrame.1=Mostrar origen ParametersAxeFrame.2=Ejes ParametersAxeFrame.3=Mostrar etiquetas-X ParametersAxeFrame.4=Mostrar etiquetas-Y ParametersAxeFrame.5=Definir separaci\u00F3n de las etiquetas (cm) ParametersAxeFrame.6=Distancia etiquetas-X: ParametersAxeFrame.7=Distancia etiquetas-Y: ParametersAxeFrame.8=Incremento etiquetas-X: ParametersAxeFrame.9=Incremento etiquetas-Y: ParametersAxeFrame.10=Origen etiquetas-X: ParametersAxeFrame.11=Origen etiquetas-Y: ParametersAxeFrame.12=Etiquetas ParametersAxeFrame.13=Tama\u00F1o: ParametersAxeFrame.14=Estilo: ParametersAxeFrame.15=Mostrar divisiones-X ParametersAxeFrame.16=Mostrar divisiones-Y ParametersAxeFrame.17=Divisiones PreferencesFrame.3=Ruta de su editor LaTeX: PreferencesFrame.4=Cuadr\u00EDcula est\u00E1ndar PreferencesFrame.5=Cuadr\u00EDcula personal PreferencesFrame.6=Cuadr\u00EDcula magn\u00E9tica PreferencesFrame.7=Intervalo: LaTeXDrawFrame.0=Dibujar Ejes LaTeXDrawFrame.2=Rotar el objeto(s) seleccionado. LaTeXDrawFrame.3=Rotar la(s) figura(s) seleccionadas 90\u00B0. LaTeXDrawFrame.4=Rotar la(s) figura(s) seleccionadas 180\u00B0. LaTeXDrawFrame.5=Rotar la(s) figura(s) seleccionadas 270\u00B0. LaTeXDrawFrame.6=Invertir objeto usando simetr\u00EDa. LaTeXDrawFrame.7=Invertir horizontalmente. LaTeXDrawFrame.8=Invertir verticalmente. LaTeXDrawFrame.10=Mostrar la cuadr\u00EDcula est\u00E1ndar (en cm o en pulg.) LaTeXDrawFrame.11=Mostrar una cuadr\u00EDcula cuya separaci\u00F3n entre l\u00EDneas puede ser modificada. LaTeXDrawFrame.12=Contiene los par\u00E1metros de la cuadri. (magn\u00E9tica) LaTeXDrawFrame.13=magn\u00E9tica LaTeXDrawFrame.14=Si habilitado, los objetos se acoplar\u00E1n (magnetizar\u00E1n) a la cuadr\u00EDcula. LaTeXDrawFrame.15=Definir la separaci\u00F3n entre l\u00EDneas de la cuadri. personal (en pixeles). LaTeXDrawFrame.16=Dibujar cuadr\u00EDculas y ejes. LaTeXDrawFrame.17=Dibujar ejes. LaTeXDrawFrame.18=Abrir su editor LaTeX. LaTeXDrawFrame.19=Ejecutando su editor de LaTeX... LaTeXDrawFrame.20=Usted debe definir la ruta de su editor de LaTeX en el panel de preferencias. LaTeXDrawFrame.21=El archivo que seleccion\u00F3 es inv\u00E1lido. LaTeXDrawFrame.22=Redefinir la ruta en el panel de preferencias. LaTeXDrawFrame.23=Cerrar LaTeXDrawFrame.25=Librer\u00EDas LaTeXDrawFrame.26=Traductores LaTeXDrawFrame.27=Nota de lanzamiento LaTeXDrawFrame.28=Licencia Axe.0=Ninguno Axe.1=Eje Axe.2=Ventana Axe.3=Relleno Axe.4=Arriba Axe.5=Abajo latexdraw-2.0.8+1.orig/lang/es/others.properties0000644000000000000000000000432211347255510016453 0ustar XScale.cm=cm XScale.inch=pulgadas LaTeXDrawException.valueInc=Valor incorrecto LaTeXDrawException.invFile=¡Este archivo no es un archivo LaTeXDraw\! LaTeXDrawException.invLaTeXDrawVer=¡Esta versi\u00F3n de LaTeXDraw no est\u00E1 administrada\! LaTeXDrawException.invException=LaTeXDrawException : error de c\u00F3digo desconocido Arc.arc=Arco Arc.wedge=Angulo Arc.chord=Cuerda Arc.arcType=Tipo de arco Figure.boundPos=Posici\u00F3n de Frontera DrawContainer.nameTemplate=Escriba el nombre de la plantilla DrawContainer.overwriteTemplate=Esta plantilla ya existe, ¿desea reemplazarla? CloseButton.closePanel=Cerrar el panel UndoRedoManager.changeParams=Cambiar par\u00E1metros UndoRedoManager.changeDispo=Cambiar disposici\u00F3n UndoRedoManager.move=Mover UndoRedoManager.delete=Borrar UndoRedoManager.create=Crear UndoRedoManager.join=Agrupar UndoRedoManager.seperate=Desagrupar UndoRedoManager.filled=Cambiar estilo interior UndoRedoManager.intCol=Cambiar color interior UndoRedoManager.bordCol=Cambiar color de bordes UndoRedoManager.thick=Cambiar ancho UndoRedoManager.style=Cambiar estilo UndoRedoManager.lArrow=Cambiar estilo de extremo izq. UndoRedoManager.rArrow=Cambiar estilo de extremo der. UndoRedoManager.dotStyle=Cambiar estilo de punto UndoRedoManager.noRedo=Rehacer no posible UndoRedoManager.noUndo=Deshacer no posible UndoRedoManager.align=alineaci\u00F3n UndoRedoManager.distrib=distribuci\u00F3n CodePanel.reload=Recargar CodePanel.autoUpdate=Actualizaci\u00F3n auto. CodePanel.copySel=Copiar el texto seleccionado CodePanel.copyAll=Copiar todo el c\u00F3digo CodePanel.tip=
Si lo selecciona, el c\u00F3digo se actualiza en tiempo real.
Consejo: desactive la actualizaci\u00F3n autom\u00E1tica o no muestre el panel de c\u00F3digo cuando el dibujo sea complejo o
cuando est\u00E9 moviendo una figura grande.
CodePanel.updateCode=Actualizar el c\u00F3digo CodePanel.addComment=A\u00F1adir comentarios al c\u00F3digo CodePanel.reloadText=c\u00F3digo PSTricks recargado \! CodePanel.copiedText=c\u00F3digo PSTricks copiado en memoria \! CodePanel.copiedSelText=Selecci\u00F3n copiada en memoria \! SVGManager.0=Imposible generar las formas desde el documento SVG. latexdraw-2.0.8+1.orig/lang/es/1_7.properties0000644000000000000000000000561211347255510015540 0ustar LaTeXDrawException.0=Figura inv\u00E1lida. LaTeXDrawFrame.0=Sombreado LaTeXDrawFrame.9=Seleccionar color de sombreado LaTeXDrawFrame.1=Gradiente 1 LaTeXDrawFrame.2=Gradiente 2 LaTeXDrawFrame.4=A\u00F1adir sombreado a la figura. LaTeXDrawFrame.5=Elegir color de sombreado. LaTeXDrawFrame.6=Posicionar figuras en el dibujo (en frente, detr\u00E1s, ...). LaTeXDrawFrame.7=Seleccionar el primer color del gradiente. LaTeXDrawFrame.8=Seleccionar el segundo color del gradiente. ParametersTextFrame.0=Transparencia ParametersTextFrame.1=Lista de cajas ParametersTextFrame.2=Opaco ParametersTextFrame.3=C\u00EDrculo ParametersTextFrame.4=Rect\u00E1ngulo ParametersTextFrame.5=Tri\u00E1ngulo ParametersTextFrame.6=Rombo ParametersTextFrame.7=Elipse ParametersTextFrame.8=Caja simple ParametersTextFrame.9=Varias cajas ParametersGridFrame.0=Par\u00E1metros de cuadr\u00EDcula ParametersTextFrame.10=Habilitar caja(s) enmarcada(s) ParametersTextFrame.11=A\u00F1adir ParametersTextFrame.12=Modificar ParametersTextFrame.13=Remover ParametersTextFrame.14=Separador: ParametersTextFrame.15=Editar caja ParametersTextFrame.16=Considerar tama\u00F1o de caja ParametersTextFrame.17=Si habilitado, el transfondo del texto estar\u00E1 opacado. ParametersTextFrame.18=Caja(s) enmarcada(s) ParametersTextFrame.20=Crear uno o varios marcos alrededor del texto. ParametersTextFrame.21=La caja ser\u00E1 un rect\u00E1ngulo. ParametersTextFrame.22=La caja ser\u00E1 un tri\u00E1ngulo. ParametersTextFrame.23=Crear una caja simple alrededor de todo el texto. ParametersTextFrame.24=La caja ser\u00E1 una elipse. ParametersTextFrame.25=La caja ser\u00E1 un rombo. ParametersTextFrame.26=Crear varios marcos alrededor del texto. ParametersTextFrame.27=La caja ser\u00E1 un c\u00EDrculo. ParametersTextFrame.28=A\u00F1adir una nueva caja. ParametersTextFrame.29=Editar la posici\u00F3n de la caja seleccionada. ParametersTextFrame.30=Remover la caja seleccionada. ParametersTextFrame.31=Cambiar el espaciado entre el texto y la caja. ParametersTextFrame.32=Si lo habilita, la caja no se dibujar\u00E1 sobre el texto ni al inicio ni despu\u00E9s del texto enmarcado. ParametersTextFrame.33=Abrir el panel de par\u00E1metros de la baja para editarla. ParametersTextFrame.34=Texto seleccionado ParametersTextFrame.35=Elegir el texto para enmarcar: ParametersTextFrame.36=Selecci\u00F3n de Texto ParametersTextFrame.37=Caja inv\u00E1lida; se traslapa con otra caja. AbstractParametersFrame.0=Dimensiones/Posici\u00F3n AbstractParametersFrame.1=Angulo de sombreado AbstractParametersFrame.2=Tama\u00F1o de sombreado AbstractParametersFrame.3=Angulo del gradiente AbstractParametersFrame.4=Punto medio AbstractParametersFrame.6=Otros AbstractParametersFrame.7=Esquina redondeada: AbstractParametersFrame.8=Cuadriculado AbstractParametersFrame.9=L\u00EDnea doble AbstractParametersFrame.11=Rebastecimiento AbstractParametersFrame.12=Gradiente BatchConvertFrame.0=En los mismos directorios latexdraw-2.0.8+1.orig/lang/en/0000755000000000000000000000000011347255510013023 5ustar latexdraw-2.0.8+1.orig/lang/en/1_9.properties0000644000000000000000000000763511347255510015544 0ustar LaTeXDrawFrame.0=Recent files LaTeXDrawFrame.1=Draw Closed B\u00E9zier Curve LaTeXDrawFrame.2=Clear all LaTeXDrawFrame.3=Shortcuts LaTeXDrawFrame.4=Check update LaTeXDrawFrame.5=Shapes LaTeXDrawFrame.6=Set visible all the figures LaTeXDrawFrame.7=If a figure has its coordinates under (0,0), you cannot see it.
This button allows to move all the figures in order to be visible. LaTeXDrawFrame.8=Define the properties of the handlers. LaTeXDrawFrame.9=Handlers opacity LaTeXDrawFrame.10=Define the transparency of the handlers. LaTeXDrawFrame.11=Draw a closed B\u00E9zier curve LaTeXDrawFrame.12=Check that the version of the Java Runtime Environment you used
to create this file is the same of the JRE you currently use. LaTeXDrawFrame.13=The help directory is unreachable, the help page cannot be loaded. LaTeXDrawFrame.14=Not able to create the help page. PSTricksParser.0=begin{center} must be out of begin{pspicture}...end{pspicture} PSTricksParser.1=end{center} must be out of begin{pspicture}...end{pspicture} PSTricksParser.2=end{figure} must be out of begin{pspicture}...end{pspicture} PSTricksParser.3=end{pspicture} or pspicture not found. DrawPanel.0=Update figures to the grid ParametersAkinPointsFrame.0=Points interval: ParametersAkinPointsFrame.1=Open ParametersAkinPointsFrame.2=type: ParametersAkinPointsFrame.3=Free hand parameters ParametersBezierCurveFrame.2=Equilibrate ParametersBezierCurveFrame.3=Equilibrate the control points in respect of the position of the points. ParametersBezierCurveFrame.4=Distance: ParametersBezierCurveFrame.5=Define the space between the control point and the point when equilibrating the curve. ParametersBezierCurveFrame.6=X 1st ctrl pt ParametersBezierCurveFrame.7=Y 1st ctrl pt ParametersBezierCurveFrame.8=X 2nd ctrl pt ParametersBezierCurveFrame.9=Y 2nd ctrl pt PreferencesFrame.0=Number of recent files: PreferencesFrame.1=Theme (need restart): ShortcutsFrame.1=Sequence ShortcutsFrame.3=Category ShortcutsFrame.4=Navigation ShortcutsFrame.5=Transformation ShortcutsFrame.6=Drawing ShortcutsFrame.7=\ (big move) ShortcutsFrame.8=left click ShortcutsFrame.9=Move the horizontal scrollbar to the right ShortcutsFrame.10=Move the horizontal scrollbar to the left ShortcutsFrame.11=Move the vertical scrollbar to the top ShortcutsFrame.12=Move the vertical scrollbar to the bottom ShortcutsFrame.14=Go to the end of the horizontal scrollbar ShortcutsFrame.15=Go to the beginning of the horizontal scrollbar ShortcutsFrame.16=Go to the top of the vertical scrollbar ShortcutsFrame.17=Go to the bottom of the vertical scrollbar ShortcutsFrame.18=Move the selected figures to the right ShortcutsFrame.19=Move the selected figures to the left ShortcutsFrame.20=Move the selected figures to the top ShortcutsFrame.21=Move the selected figures to the bottom ShortcutsFrame.23=Update the selected figures to the displayed grid ShortcutsFrame.25=Select all the figures of the drawing ShortcutsFrame.26=Add the clicked figure to the selection ShortcutsFrame.27=Remove the clicked figure from the selection ShortcutsFrame.28=Select the next or the first figure (in selection mode only) ShortcutsFrame.29=Mouse wheel ShortcutsFrame.30=Zoom in/out MenusListener.0=Press the left button and drag the mouse to place the second point. Release the button to finish the creation. MenusListener.1=A left-click to add a point, a right-click or a double left-click to place the last point and to finish the creation. MenusListener.4=Press the left button and drag the mouse to place the last point. Release the button to finish the creation. MenusListener.5=A left-click adds text. MenusListener.6=A left-click adds a grid. MenusListener.7=A left-click adds axes. MenusListener.8=Press the left button and drag the mouse to draw the shape. Release the button to finish the creation. MenusListener.9=A left-click adds a dot. RecentFilesListener.0=It is impossible to access to this file. RecentFilesListener.1=Cannot open the file latexdraw-2.0.8+1.orig/lang/en/LaTeXDrawFrame.properties0000644000000000000000000002076111347255510017715 0ustar LaTeXDrawFrame.0=\ help LaTeXDrawFrame.1=About LaTeXDrawFrame.2=Draw line LaTeXDrawFrame.3=Draw rectangle LaTeXDrawFrame.4=Draw dot LaTeXDrawFrame.5=Draw square LaTeXDrawFrame.6=Draw rhombus LaTeXDrawFrame.7=Freehand LaTeXDrawFrame.8=Draw triangle LaTeXDrawFrame.9=Draw circle LaTeXDrawFrame.10=Draw grid LaTeXDrawFrame.11=Draw ellipse LaTeXDrawFrame.12=Draw polygon LaTeXDrawFrame.13=Select figure(s) LaTeXDrawFrame.14=Display borders LaTeXDrawFrame.15=Auto borders adjustment LaTeXDrawFrame.16=Export as... LaTeXDrawFrame.17=Delete Figure LaTeXDrawFrame.18=Quit LaTeXDrawFrame.19=PSTricks code LaTeXDrawFrame.20=JPEG picture LaTeXDrawFrame.21=EPS picture LaTeXDrawFrame.22=Redo LaTeXDrawFrame.23=Undo LaTeXDrawFrame.25=Save project LaTeXDrawFrame.26=Save project as LaTeXDrawFrame.27=Open project LaTeXDrawFrame.28=New project LaTeXDrawFrame.29=Print code LaTeXDrawFrame.30=Print drawing LaTeXDrawFrame.31=Behind a figure LaTeXDrawFrame.32=In front of a figure LaTeXDrawFrame.33=Group LaTeXDrawFrame.34=Separate LaTeXDrawFrame.35=Draw arc LaTeXDrawFrame.36=Draw wedge LaTeXDrawFrame.37=Draw chord LaTeXDrawFrame.38=X-Scale LaTeXDrawFrame.39=Y-Scale LaTeXDrawFrame.40=Copy LaTeXDrawFrame.41=Update templates LaTeXDrawFrame.42=Export as template LaTeXDrawFrame.43=Paste LaTeXDrawFrame.44=Cut LaTeXDrawFrame.45=Standard Grid LaTeXDrawFrame.46=Code Panel LaTeXDrawFrame.47=Borders LaTeXDrawFrame.48=Interior LaTeXDrawFrame.49=Hatchings LaTeXDrawFrame.51=filled LaTeXDrawFrame.53=Figure Properties LaTeXDrawFrame.55=Add comments LaTeXDrawFrame.56=Preferences LaTeXDrawFrame.57=Zoom in LaTeXDrawFrame.58=Zoom out LaTeXDrawFrame.60=Add text LaTeXDrawFrame.61=Foreground LaTeXDrawFrame.62=Background LaTeXDrawFrame.63=Draw B\u00E9zier curve LaTeXDrawFrame.64=Rotate the figure LaTeXDrawFrame.65=Change the thickness of the figure LaTeXDrawFrame.66=Change the colour of the borders of the figure LaTeXDrawFrame.67=If selected, the figure will be filled LaTeXDrawFrame.68=Change the colour of the interior of the figure LaTeXDrawFrame.69=Change the colour of the hatchings LaTeXDrawFrame.70=Put the figure in the foreground LaTeXDrawFrame.71=Put the figure in the background LaTeXDrawFrame.72=Select the figure which will be behind the selected figure LaTeXDrawFrame.73=Select the figure which will be in front of the selected figure LaTeXDrawFrame.74=If activated, you can rotate a figure with the mouse using handlers LaTeXDrawFrame.75=Group several figures LaTeXDrawFrame.76=Separate several figures LaTeXDrawFrame.77=Define the position of the borders of the figure LaTeXDrawFrame.78=If selected, the figure will have double borders LaTeXDrawFrame.79=Change to colour of the space between the double borders LaTeXDrawFrame.80=\ Thickness LaTeXDrawFrame.82=An error occurred during the launch of LaTeXDraw:
LaTeXDrawFrame.83=LaTeXDraw is not able to start LaTeXDrawFrame.86=LaTeXDraw Error LaTeXDrawFrame.88=File LaTeXDrawFrame.89=Edit LaTeXDrawFrame.90=Display LaTeXDrawFrame.91=Draw LaTeXDrawFrame.92=Code LaTeXDrawFrame.93=Help LaTeXDrawFrame.94=Zoom in the drawing LaTeXDrawFrame.95=Zoom out the drawing LaTeXDrawFrame.96=Zoom 100% LaTeXDrawFrame.103=Templates LaTeXDrawFrame.105=Not able to create the templates menu\! LaTeXDrawFrame.107=Toolbar LaTeXDrawFrame.108=Create a new project LaTeXDrawFrame.109=Open a project LaTeXDrawFrame.110=Save the project LaTeXDrawFrame.113=100% LaTeXDrawFrame.114=Undo an action LaTeXDrawFrame.115=Redo an action LaTeXDrawFrame.116=Draw a line LaTeXDrawFrame.117=Draw a dot LaTeXDrawFrame.118=Draw a rectangular shape LaTeXDrawFrame.119=Draw a rectangle LaTeXDrawFrame.120=Draw a square LaTeXDrawFrame.121=Draw a polygon LaTeXDrawFrame.123=Draw a rhombus LaTeXDrawFrame.124=Draw a triangle LaTeXDrawFrame.125=Draw an ellipse LaTeXDrawFrame.127=Draw a circle LaTeXDrawFrame.128=Draw an arc LaTeXDrawFrame.130=Draw a wedge LaTeXDrawFrame.131=Draw a chord LaTeXDrawFrame.132=Draw a B\u00E9zier curve LaTeXDrawFrame.133=Draw a grid LaTeXDrawFrame.136=Select one or several figures
LaTeXDrawFrame.137=Piece of advice : to select several LaTeXDrawFrame.138=figures, click and
drag the mouse on the figures you want LaTeXDrawFrame.139=Delete the selected figure(s) LaTeXDrawFrame.140=Change the figure properties LaTeXDrawFrame.141=Display the borders of the drawing
LaTeXDrawFrame.142=Piece of advice : if you display the borders of the
LaTeXDrawFrame.143=drawing, disable the borders autoupdate to be able to
LaTeXDrawFrame.144=change the dimensions of the drawing LaTeXDrawFrame.146=Copied... LaTeXDrawFrame.147=Pasted... LaTeXDrawFrame.148=Cut... LaTeXDrawFrame.149=Deleted... LaTeXDrawFrame.151=Select double borders colour LaTeXDrawFrame.154=Grouped... LaTeXDrawFrame.155=Separated... LaTeXDrawFrame.156=Do you want to save the project? LaTeXDrawFrame.158=Redo... LaTeXDrawFrame.159=Undo... LaTeXDrawFrame.160=Templates updated... LaTeXDrawFrame.161=Error for file LaTeXDrawFrame.162=Printing the drawing... LaTeXDrawFrame.163=Drawing printed\! LaTeXDrawFrame.164=Not able to print the drawing\! LaTeXDrawFrame.165=Printing code... LaTeXDrawFrame.166=Code printed\! LaTeXDrawFrame.167=Not able to print the code\! LaTeXDrawFrame.168=Exporting as template... LaTeXDrawFrame.169=Template exported\! LaTeXDrawFrame.170=Exporting as PSTricks code... LaTeXDrawFrame.171=Select LaTeXDrawFrame.172=Export the PSTricks code as a TeX file LaTeXDrawFrame.173=Do you want to replace the file? LaTeXDrawFrame.174=Export as PSTricks LaTeXDrawFrame.175=PSTricks code exported\! LaTeXDrawFrame.176=Not able to export PSTricks code\! LaTeXDrawFrame.177=Exporting as picture... LaTeXDrawFrame.179=Export figures as LaTeXDrawFrame.182=Export as LaTeXDrawFrame.183=\ file LaTeXDrawFrame.184=Export as picture done\! LaTeXDrawFrame.185=Not able to export as picture\! LaTeXDrawFrame.186=Saving project... LaTeXDrawFrame.188=Save the drawing LaTeXDrawFrame.190=Export as JPEG file LaTeXDrawFrame.191=Project saved\! LaTeXDrawFrame.192=Not able to save the project\! LaTeXDrawFrame.193=An error occurred during the saving of a file:
LaTeXDrawFrame.197=Creation of a new project... LaTeXDrawFrame.198=New project created\! LaTeXDrawFrame.200=Open a drawing LaTeXDrawFrame.201=Opening a file... LaTeXDrawFrame.202=File opened\! LaTeXDrawFrame.203=Not able to open file\! LaTeXDrawFrame.204=An error occurred during the loading of a file:
LaTeXDrawFrame.208=
Version LaTeXDrawFrame.209=\ released\! LaTeXDrawFrame.210=New Version LaTeXDrawFrame.211=New version released\! LaTeXDrawFrame.212=No new version LaTeXDrawFrame.213=Unable to check if a new version exists\! LaTeXDrawFrame.215=LaTeXDraw help LaTeXDrawFrame.218=A PSTricks code generator for LaTeX\! LaTeXDrawFrame.219=Version LaTeXDrawFrame.220=, build LaTeXDrawFrame.221=\ is distributed under the terms of the GNU General Public License LaTeXDrawFrame.222=\ as published by the Free Software Foundation (version 2) LaTeXDrawFrame.229=Import... LaTeXDrawFrame.230=From TeX file LFrame2.0=Define the size of a dot. LFrame2.1=Align the selected figures. LFrame2.10=Distribute vertically, at equal distance between, the selected figures. LFrame2.11=Distribute vertically at equal distance between the middle of the selected figures. LFrame2.12=Distribute vertically at equal distance between the top sides of the selected figures. LFrame2.13=Distribute horizontally at equal distance between the left sides of the selected figures. LFrame2.14=Distribute horizontally, at equal distance between, the selected figures. LFrame2.15=Distribute horizontally at equal distance between the middle of the selected figures. LFrame2.16=Distribute horizontally at equal distance between the right sides of the selected figures. LFrame2.17=Colours LFrame2.18=Impossible to open the file. LFrame2.19=This template cannot be found LFrame2.2=Align on the left the selected figures. LFrame2.20=Please, update the templates menu LFrame2.21=Template not found LFrame2.22=The document cannot be printed. LFrame2.23=No printer found. LFrame2.25=The GPL library jlibeps is used to create EPS pictures. LFrame2.3=Align on the right the selected figures. LFrame2.4=Align on the top the selected figures. LFrame2.5=Align on the bottom the selected figures. LFrame2.6=Align horizontally in the middle the selected figures. LFrame2.7=Align vertically in the middle the selected figures. LFrame2.8=Distribute at equal distance the selected figures. LFrame2.9=Distribute vertically, at equal distance between the bottom sides of the selected figures. LFrame2.26=New project with selection latexdraw-2.0.8+1.orig/lang/en/1_6.properties0000644000000000000000000000627111347255510015534 0ustar BatchConvertFrame.1=Add sub folders BatchConvertFrame.2=Add files BatchConvertFrame.4=Remove All BatchConvertFrame.5=Overwrite BatchConvertFrame.6=Select path BatchConvertFrame.7=Select format BatchConvertFrame.8=Convert BatchConvertFrame.9=Stop BatchConvertFrame.11=Batch list BatchConvertFrame.12=Select directory BatchConvertFrame.13=Select pictures BatchConvertFrame.14=Convert as: LaTeXDrawFrame.0=Insert PSTricks code LaTeXDrawFrame.1=Insert a picture LaTeXDrawFrame.2=Convert pictures LaTeXDrawFrame.3=stop LaTeXDrawFrame.4=Draw joined lines LaTeXDrawFrame.5=PPM picture LaTeXDrawFrame.6=BMP picture LaTeXDrawFrame.7=PNG picture LaTeXDrawFrame.9=Stop the parsing\! LaTeXDrawFrame.10=Insert LaTeXDrawFrame.11=Insert several figures from PSTricks code LaTeXDrawFrame.14=Draw several joined lines LaTeXDrawFrame.15=Importing a PSTricks file... LaTeXDrawFrame.16=The current PSTricks parser only parses few commands.
You may import only commands managed by LaTeXDraw. LaTeXDrawFrame.17=Import PSTricks code LaTeXDrawFrame.18=This software uses JIU, the Java Imaging Utilities. Distributed under LaTeXDrawFrame.19=the terms of the GNU General Public License. http://schmidt.devlib.org/jiu/ LaTeXDrawFrame.23=Warnings:
  • PSTricks cannot include JPG, BMP,... files; so an EPS picture will be created from the selected picture,
    in the same directory. So the picture will be included only if you have rights to write in the directory;
  • TeX does not support spaces in the path, so try to do not have any.
LaTeXDrawFrame.25=Loading the picture... LaTeXDrawFrame.26=The picture is invalid\! LaTeXDrawFrame.27=Not able to load the picture\! LaTeXDrawFrame.28=Picture inserted\! LaTeXDrawFrame.30=There is no figure to import\!
If it is false, check that they are surrounded by begin{pspicture} ...end{pspicture}.
You can send the file to LaTeXDrawFrame.31=\ if you think there is a bug in the PSTricks parser. LaTeXDrawFrame.32=No figure found\! LaTeXDrawFrame.33=No figure found to import\! LaTeXDrawFrame.34=Not able to import the PSTricks file\! LaTeXDrawFrame.35=Importation cancelled\! LaTeXDrawFrame.36=Code converted into figures\! InsertPSTricksCodeFrame.0=Insert figures from PSTricks code FatalErrorParsingException.0=
If the file is valid, you can send it to arno_b@users.sourceforge.net Picture.0=% Warning: the path of the following picture contains spaces and will not be compiled by tex\! ParserCmdMessage.0=Line ParserCmdMessage.1=Command: ParserCmdMessage.2=Exception: ParserMessagesFrame.0=Command ParserMessagesFrame.1=Line ParserMessagesFrame.2=Exception ParserMessagesFrame.3=One or several warnings occurred during the parsing ParserMessagesFrame.4=TeX parser: warning(s) ParametersGridFrame.0=Invert label position following X ParametersGridFrame.1=Invert label position following Y PSTricksParser.0=Error during the opening of the file: invalid file\! PSTricksParser.1=The incremental pspicture definition is not yet managed:
PSTricksParser.2=begin{pspicture}...begin{pspicture} ... end{pspicture}... PSTricksParser.3=Error during the parsing of the file\! latexdraw-2.0.8+1.orig/lang/en/dialogFrames.properties0000644000000000000000000001141611347255510017541 0ustar PreferencesFrame.Pref=Preferences... PreferencesFrame.grid=Grid PreferencesFrame.codePanel=Code panel PreferencesFrame.antiAl=Anti-aliasing PreferencesFrame.rendQ=Rendering quality PreferencesFrame.colRendQ=Colour rendering quality PreferencesFrame.AlphaQ=Alpha interpolation quality PreferencesFrame.bordersDraw=Borders of the drawing PreferencesFrame.codeAuto=Code autoupdate (slower) PreferencesFrame.newVers=Check new version on start-up PreferencesFrame.lge=Language (need restart) PreferencesFrame.general=General PreferencesFrame.folders=Folders PreferencesFrame.quality=Quality PreferencesFrame.selectFolder=Select a folder PreferencesFrame.defOpenSave=Default folder for open/save actions: PreferencesFrame.defFold=Default folder for import/export actions: PreferencesFrame.errorReadPref=Error during the reading of the preferences file\! PreferencesFrame.prefSaved=Preferences saved\! DrawPropertiesFrame.0=The label of the drawing DrawPropertiesFrame.1=The caption of the drawing DrawPropertiesFrame.2=Drawing Properties DrawPropertiesFrame.3=pixels per DrawPropertiesFrame.5=In a page with only floats DrawPropertiesFrame.6=At the top of the page DrawPropertiesFrame.7=At the bottom of the page DrawPropertiesFrame.8=Here DrawPropertiesFrame.9=HERE\! DrawPropertiesFrame.10=In the centre of the page DrawPropertiesFrame.11=Vertical position of the drawing DrawPropertiesFrame.12=Horizontal position of the drawing DrawPropertiesFrame.13=Change the number of pixels per unit of length ExceptionFrameDialog.0=Send Report ExceptionFrameDialog.1=An error occurred\!
ExceptionFrameDialog.2=
You can send the report to the LaTeXDraw developer ExceptionFrameDialog.3=LaTeXDraw error: an exception occurred ExceptionFrameDialog.4=An error occurred:
ExceptionFrameDialog.5=Not able to create a ExceptionFrameDialog AbstractParametersFrame.0=Double boundary AbstractParametersFrame.2=Separator: AbstractParametersFrame.3=Generals parameters AbstractParametersFrame.4=Ok AbstractParametersFrame.5=Default AbstractParametersFrame.6=Cancel AbstractParametersFrame.7=Angle of rotation: AbstractParametersFrame.8=Thickness: AbstractParametersFrame.10=Type of line: AbstractParametersFrame.11=Hatchings Width: AbstractParametersFrame.12=Left Arrow: AbstractParametersFrame.13=Right Arrow: AbstractParametersFrame.14=Arrows parameters AbstractParametersFrame.15=Show ctrl points AbstractParametersFrame.16=Rounded AbstractParametersFrame.17=X-centre coordinate: AbstractParametersFrame.18=Y-centre coordinate: AbstractParametersFrame.19=Radius: AbstractParametersFrame.20=Dot diameter = AbstractParametersFrame.21=Bar width = AbstractParametersFrame.22=Bracket length = AbstractParametersFrame.23=Rounded bracket lgth = AbstractParametersFrame.24=x thickness + AbstractParametersFrame.25=x width AbstractParametersFrame.26=Arrow length AbstractParametersFrame.27=Arrow inset AbstractParametersFrame.28=Arrow width AbstractParametersFrame.29=X-coordinate: AbstractParametersFrame.30=Y-coordinate: AbstractParametersFrame.31=Width: AbstractParametersFrame.32=Height: AbstractParametersFrame.33=Parameters of the shape AbstractParametersFrame.34=Select hatchings colour AbstractParametersFrame.35=Select double boundary colour AbstractParametersFrame.36=Select borders colour AbstractParametersFrame.37=Select interior colour AbstractParametersFrame.38=Arrows ParametersArcFrame.0=start angle: ParametersArcFrame.1=end angle: ParametersArcFrame.2=Type of arc: ParametersDotFrame.0=Type of dot: ParametersDrawFrame.0=North-West X ParametersDrawFrame.1=North-West Y ParametersDrawFrame.2=South-East X ParametersDrawFrame.3=South-East Y ParametersGridFrame.0=Y Origin: ParametersGridFrame.1=X Origin: ParametersGridFrame.2=Labels: ParametersGridFrame.3=Unit: ParametersGridFrame.4=Subgrid dots: ParametersGridFrame.5=Grid dots: ParametersGridFrame.6=Grid width: ParametersGridFrame.7=Subgrid width: ParametersGridFrame.8=Subgrid division: ParametersGridFrame.9=Label size: ParametersLineFrame.0=Left X-coordinate: ParametersLineFrame.1=Left Y-coordinate: ParametersLineFrame.2=Right X-coordinate: ParametersLineFrame.3=Right Y-coordinate: ParametersTextFrame.0=Bold ParametersTextFrame.1=Italic ParametersTextFrame.2=Font: ParametersTextFrame.3=Size: ParametersTextFrame.4=Text ParametersGridFrame.10=Subgrid: ParametersGridFrame.11=X max: ParametersGridFrame.12=X min: ParametersGridFrame.13=Y max: ParametersGridFrame.14=Y min: ParametersGridFrame.15=Draw labels ParametersGridFrame.17=Select labels colour ParametersGridFrame.18=Select subgrid colour ParametersPolygonFrame.1=Point n\u00B0 ParametersTriangleFrame.0=Base centre X-coord: ParametersTriangleFrame.1=Base centre Y-coord: ParamsBC.0=Move all ParamsBC.1=If not selected, when you move a point its control points are moved too. ExportDialog.0=Compression latexdraw-2.0.8+1.orig/lang/en/1_8.properties0000644000000000000000000000435611347255510015540 0ustar UndoRedoManager.0=Transformation AbstractParametersFrame.0=interval: ParametersAxeFrame.0=Shape: ParametersAxeFrame.1=Show origin ParametersAxeFrame.2=Axes ParametersAxeFrame.3=Display X-labels ParametersAxeFrame.4=Display Y-labels ParametersAxeFrame.5=Define distance between labels (cm) ParametersAxeFrame.6=X-labels distance: ParametersAxeFrame.7=Y-labels distance: ParametersAxeFrame.8=X-labels increment: ParametersAxeFrame.9=Y-labels increment: ParametersAxeFrame.10=X-labels origin: ParametersAxeFrame.11=Y-labels origin: ParametersAxeFrame.12=Labels ParametersAxeFrame.13=Size: ParametersAxeFrame.14=Style: ParametersAxeFrame.15=Display X-ticks ParametersAxeFrame.16=Display Y-ticks ParametersAxeFrame.17=Ticks PreferencesFrame.3=Path of your LaTeX editor: PreferencesFrame.4=Standard grid PreferencesFrame.5=Personal grid PreferencesFrame.6=Magnetic grid PreferencesFrame.7=Interval: LaTeXDrawFrame.0=Draw Axes LaTeXDrawFrame.2=Rotate the selected figure(s). LaTeXDrawFrame.3=Rotate the selected figure(s) of 90\u00B0. LaTeXDrawFrame.4=Rotate the selected figure(s) of 180\u00B0. LaTeXDrawFrame.5=Rotate the selected figure(s) of 270\u00B0. LaTeXDrawFrame.6=Reverse figures by symmetry. LaTeXDrawFrame.7=Reverse horizontally the selected figures. LaTeXDrawFrame.8=Reverse vertically the selected figures. LaTeXDrawFrame.10=Display a standard grid (in cm or inch). LaTeXDrawFrame.11=Display a grid you can modify the interval between its lines. LaTeXDrawFrame.12=Contains the parameters of the (magnetic) grid LaTeXDrawFrame.13=magnetic LaTeXDrawFrame.14=If selected, the figures will be magnetic to the grid. LaTeXDrawFrame.15=Define the interval between the lines of the personal grid (in pixels). LaTeXDrawFrame.16=Draw grids and axes. LaTeXDrawFrame.17=Draw axes. LaTeXDrawFrame.18=Launch your LaTeX editor. LaTeXDrawFrame.19=Launching of your LaTeX editor... LaTeXDrawFrame.20=You must define the path of your LaTeX editor in the preferences window. LaTeXDrawFrame.21=The file you selected is invalid. LaTeXDrawFrame.22=Redefine the path in the panel of preferences. LaTeXDrawFrame.23=Close LaTeXDrawFrame.25=Libraries LaTeXDrawFrame.26=Translators LaTeXDrawFrame.27=Release note LaTeXDrawFrame.28=Licence Axe.0=None Axe.1=Axe Axe.2=Frame Axe.3=Full Axe.4=Top Axe.5=Bottom latexdraw-2.0.8+1.orig/lang/en/others.properties0000644000000000000000000000374411347255510016455 0ustar XScale.cm=cm XScale.inch=inch LaTeXDrawException.valueInc=Incorrect value LaTeXDrawException.invFile=This file is not a LaTeXDraw file\! LaTeXDrawException.invLaTeXDrawVer=This version of LaTeXDraw is not managed\! LaTeXDrawException.invException=LaTeXDrawException: unknown code error Arc.arc=Arc Arc.wedge=Wedge Arc.chord=Chord Arc.arcType=Kind of arc Figure.boundPos=Boundary position DrawContainer.nameTemplate=Enter the name of the template DrawContainer.overwriteTemplate=This template already exists; overwrite it? CloseButton.closePanel=Close the window UndoRedoManager.changeParams=Change parameters UndoRedoManager.changeDispo=Change disposition UndoRedoManager.move=Move UndoRedoManager.delete=Delete UndoRedoManager.create=Create UndoRedoManager.join=Join UndoRedoManager.seperate=Separate UndoRedoManager.filled=Change interior style UndoRedoManager.intCol=Change interior colour UndoRedoManager.bordCol=Change borders colour UndoRedoManager.thick=Change thickness UndoRedoManager.style=Change style UndoRedoManager.lArrow=Change left arrow style UndoRedoManager.rArrow=Change right arrow style UndoRedoManager.dotStyle=Change dot style UndoRedoManager.noRedo=No redo possible UndoRedoManager.noUndo=No undo possible UndoRedoManager.align=alignment UndoRedoManager.distrib=distribution CodePanel.reload=Reload CodePanel.autoUpdate=Auto update CodePanel.copySel=Copy the selected text CodePanel.copyAll=Copy all the code CodePanel.tip=
If selected, the code is updated in real time
Piece of advice : disable the autoupdate or do not
display the codepanel when the drawing is complex or
when you move a big figure.
CodePanel.updateCode=Update the code CodePanel.addComment=Add comments to the code CodePanel.reloadText=PSTricks code reloaded\! CodePanel.copiedText=PSTricks code copied in the clipboard\! CodePanel.copiedSelText=Selection copied in the clipboard\! SVGManager.0=Unable to generate the shapes from the SVG document. latexdraw-2.0.8+1.orig/lang/en/1_7.properties0000644000000000000000000000517511347255510015537 0ustar LaTeXDrawException.0=Invalid picture. LaTeXDrawFrame.0=Shadow LaTeXDrawFrame.9=Select shadow colour LaTeXDrawFrame.1=Gradient 1 LaTeXDrawFrame.2=Gradient 2 LaTeXDrawFrame.4=Add a shadow to the figure. LaTeXDrawFrame.5=Choose the colour of the shadow. LaTeXDrawFrame.6=Position figures into the drawing (in front of, behind,...). LaTeXDrawFrame.7=Choose the first colour of the gradient. LaTeXDrawFrame.8=Choose the second colour of the gradient. ParametersTextFrame.0=Opacity ParametersTextFrame.1=Boxes list ParametersTextFrame.2=Opaque ParametersTextFrame.3=Circle ParametersTextFrame.4=Rectangle ParametersTextFrame.5=Triangle ParametersTextFrame.6=Diamond ParametersTextFrame.7=Ellipse ParametersTextFrame.8=Simple box ParametersTextFrame.9=Several boxes ParametersGridFrame.0=Grid parameters ParametersTextFrame.10=Enable framed box(es) ParametersTextFrame.11=Add ParametersTextFrame.12=Modify ParametersTextFrame.13=Remove ParametersTextFrame.14=Separator: ParametersTextFrame.15=Edit box ParametersTextFrame.16=Consider box size ParametersTextFrame.17=If selected, the background of the text will be opaque. ParametersTextFrame.18=Framed box(es) ParametersTextFrame.20=Create a or several frames around the text. ParametersTextFrame.21=The box will be a rectangle. ParametersTextFrame.22=The box will be a triangle. ParametersTextFrame.23=Create a simple box around the whole text. ParametersTextFrame.24=The box will be an ellipse. ParametersTextFrame.25=The box will be a diamond. ParametersTextFrame.26=Create several boxes around different parts of the text. ParametersTextFrame.27=The box will be a circle. ParametersTextFrame.28=Add a new box. ParametersTextFrame.29=Edit the position of the selected box. ParametersTextFrame.30=Remove the selected box. ParametersTextFrame.31=Change the spacing between the text and the box. ParametersTextFrame.32=If selected, the box will not be drawn on the text at the start and the end of the framed text. ParametersTextFrame.33=Open the panel of parameters of the box to edit it. ParametersTextFrame.34=Text selection ParametersTextFrame.35=Select the text to frame: ParametersTextFrame.36=Text Selection ParametersTextFrame.37=Invalid box; it overlaps another box. AbstractParametersFrame.0=Dimensions/Position AbstractParametersFrame.1=Shadow angle AbstractParametersFrame.2=Shadow size AbstractParametersFrame.3=Gradient angle AbstractParametersFrame.4=Middle Pt AbstractParametersFrame.6=Other AbstractParametersFrame.7=Round corner: AbstractParametersFrame.8=Hatching AbstractParametersFrame.9=Double line AbstractParametersFrame.11=Replenishment AbstractParametersFrame.12=Gradient BatchConvertFrame.0=In the same directories latexdraw-2.0.8+1.orig/lang/fr/0000755000000000000000000000000011347255510013030 5ustar latexdraw-2.0.8+1.orig/lang/fr/1_9.properties0000644000000000000000000001130611347255510015537 0ustar LaTeXDrawFrame.0=Fichiers r\u00E9cents LaTeXDrawFrame.1=Tracer Courbe de B\u00E9zier Ferm\u00E9e LaTeXDrawFrame.2=Tout supprimer LaTeXDrawFrame.3=Raccourcis LaTeXDrawFrame.4=V\u00E9rifier nouvelle version LaTeXDrawFrame.5=Formes LaTeXDrawFrame.6=Rendre visible ttes les figures LaTeXDrawFrame.7=Si une figure a ses coordonn\u00E9es inf\u00E9rieures \u00E0 (0,0), vous ne pouvez la voir \u00E0 l'\u00E9cran ;
ce bouton permet de rendre visible toutes les figures. LaTeXDrawFrame.8=D\u00E9finir les propri\u00E9t\u00E9s des poign\u00E9es de contr\u00F4le. LaTeXDrawFrame.9=Opacit\u00E9 des poign\u00E9es de contr\u00F4le LaTeXDrawFrame.10=D\u00E9finir la transparence des poign\u00E9es de contr\u00F4le. LaTeXDrawFrame.11=Tracer une courbe de B\u00E9zier close LaTeXDrawFrame.12=V\u00E9rifiez que la version de Java que vous avez utilis\u00E9
pour cr\u00E9er ce fichier est la m\u00EAme que le Java que vous utilisez en ce moment. LaTeXDrawFrame.13=Le r\u00E9pertoire de l'aide est introuvable, la page d'aide ne peut \u00EAtre charg\u00E9e. LaTeXDrawFrame.14=Impossible de cr\u00E9er la page d'aide. PSTricksParser.0=begin{center} doit \u00EAtre en dehors de begin{pspicture}...end{pspicture} PSTricksParser.1=end{center} doit \u00EAtre en dehors de begin{pspicture}...end{pspicture} PSTricksParser.2=end{figure} doit \u00EAtre en dehors de begin{pspicture}...end{pspicture} PSTricksParser.3=end{pspicture} ou pspicture introuvable. DrawPanel.0=Accorder figures \u00E0 la grille ParametersAkinPointsFrame.0=intervalle points : ParametersAkinPointsFrame.1=Ouvrir ParametersAkinPointsFrame.2=type : ParametersAkinPointsFrame.3=Param\u00E8tres trac\u00E9 \u00E0 la main ParametersBezierCurveFrame.2=Equilibrer ParametersBezierCurveFrame.3=Equilibre les points de contr\u00F4le en se basant sur la position des points. ParametersBezierCurveFrame.4=Distance : ParametersBezierCurveFrame.5=D\u00E9finir l'espace entre le point de contr\u00F4le et le point lors de l'\u00E9quilibrage de la courbe. ParametersBezierCurveFrame.6=1ier pt ctrl X ParametersBezierCurveFrame.7=1ier pt ctrl Y ParametersBezierCurveFrame.8=2nd pt ctrl X ParametersBezierCurveFrame.9=2nd pt ctrl Y PreferencesFrame.0=Nombre de fichiers r\u00E9cents : PreferencesFrame.1=Th\u00E8me (avec red\u00E9marrage) : ShortcutsFrame.1=S\u00E9quence ShortcutsFrame.3=Cat\u00E9gorie ShortcutsFrame.4=Navigation ShortcutsFrame.5=Transformation ShortcutsFrame.6=Dessin ShortcutsFrame.7=\ (Gros mouvement) ShortcutsFrame.8=clic gauche ShortcutsFrame.9=Bouger l'ascenseur horizontal vers la droite ShortcutsFrame.10=Bouger l'ascenseur horizontal vers la gauche ShortcutsFrame.11=Bouger l'ascenseur vertical vers le haut ShortcutsFrame.12=Bouger l'ascenseur vertical vers le bas ShortcutsFrame.14=Aller au bout de l'ascenseur horizontal ShortcutsFrame.15=Aller au d\u00E9but de l'ascenseur horizontal ShortcutsFrame.16=Aller au plus haut de l'ascenseur vertical ShortcutsFrame.17=Aller au plus base de l'ascenseur vertical ShortcutsFrame.18=Bouger les figures s\u00E9lectionn\u00E9es vers la droite ShortcutsFrame.19=Bouger les figures s\u00E9lectionn\u00E9es vers la gauche ShortcutsFrame.20=Bouger les figures s\u00E9lectionn\u00E9es vers le haut ShortcutsFrame.21=Bouger les figures s\u00E9lectionn\u00E9es vers le bas ShortcutsFrame.23=Bouger les figures s\u00E9lectionn\u00E9es afin qu'elles s'alignent sur la grille ShortcutsFrame.25=S\u00E9lectionner toutes les figures du dessin ShortcutsFrame.26=Ajouter la figure cliqu\u00E9e \u00E0 la s\u00E9lection ShortcutsFrame.27=Supprimer la figure cliqu\u00E9e de la s\u00E9lection ShortcutsFrame.28=S\u00E9lectionne la prochaine ou la premi\u00E8re figure (en mode s\u00E9lection seulement) ShortcutsFrame.29=Roulette souris ShortcutsFrame.30=Zoom avant/arri\u00E8re MenusListener.0=Presser le bouton gauche et d\u00E9placer la souris pour placer le deuxi\u00E8me point. Rel\u00E2cher ensuite le bouton pour terminer la cr\u00E9ation de la figure. MenusListener.1=Un clic gauche pour ajouter un point, un clic droit ou un double clic gauche pour placer le dernier point et terminer la cr\u00E9ation de la figure. MenusListener.4=Presser le bouton gauche et d\u00E9placer la souris afin de placer le dernier point. Rel\u00E2cher ensuite le bouton pour terminer la cr\u00E9ation de la figure. MenusListener.5=Un clic gauche ajoute du texte. MenusListener.6=Un clic gauche ajoute une grille. MenusListener.7=Un clic gauche ajoute des axes. MenusListener.8=Presser le bouton gauche and d\u00E9placer la souris pour dessiner la figure. Rel\u00E2cher ensuite le bouton pour terminer la cr\u00E9ation. MenusListener.9=Un clic gauche ajoute un point. RecentFilesListener.0=Il n'est pas possible d'acc\u00E9der \u00E0 ce fichier. RecentFilesListener.1=Impossible d'ouvrir le fichier latexdraw-2.0.8+1.orig/lang/fr/LaTeXDrawFrame.properties0000644000000000000000000002400011347255510017710 0ustar LaTeXDrawFrame.0=\ aide LaTeXDrawFrame.1=A Propos de LaTeXDrawFrame.2=Tracer ligne LaTeXDrawFrame.3=Tracer rectangle LaTeXDrawFrame.4=Tracer point LaTeXDrawFrame.5=Tracer carr\u00E9 LaTeXDrawFrame.6=Tracer losange LaTeXDrawFrame.7=Trac\u00E9 \u00E0 main lev\u00E9e LaTeXDrawFrame.8=Tracer triangle LaTeXDrawFrame.9=Tracer cercle LaTeXDrawFrame.10=Tracer grille LaTeXDrawFrame.11=Tracer ellipse LaTeXDrawFrame.12=Tracer polygone LaTeXDrawFrame.13=S\u00E9lectionner figure(s) LaTeXDrawFrame.14=Afficher bordure du dessin LaTeXDrawFrame.15=Ajustement auto. bordure LaTeXDrawFrame.16=Exporter en... LaTeXDrawFrame.17=Supprimer Figure LaTeXDrawFrame.18=Quitter LaTeXDrawFrame.19=Code PSTricks LaTeXDrawFrame.20=Image JPEG LaTeXDrawFrame.21=Image EPS LaTeXDrawFrame.22=Refaire LaTeXDrawFrame.23=D\u00E9faire LaTeXDrawFrame.25=Enregistrer projet LaTeXDrawFrame.26=Enregistrer projet sous LaTeXDrawFrame.27=Ouvrir projet LaTeXDrawFrame.28=Nouveau projet LaTeXDrawFrame.29=Imprimer code LaTeXDrawFrame.30=Imprimer dessin LaTeXDrawFrame.31=Derri\u00E8re une figure LaTeXDrawFrame.32=Devant une figure LaTeXDrawFrame.33=Grouper LaTeXDrawFrame.34=S\u00E9parer LaTeXDrawFrame.35=Tracer arc LaTeXDrawFrame.36=Tracer camembert LaTeXDrawFrame.37=Tracer arc ferm\u00E9 LaTeXDrawFrame.38=Echelle X LaTeXDrawFrame.39=Echelle Y LaTeXDrawFrame.40=Copier LaTeXDrawFrame.41=Mettre \u00E0 jour mod\u00E8les LaTeXDrawFrame.42=Exporter comme mod\u00E8le LaTeXDrawFrame.43=Coller LaTeXDrawFrame.44=Couper LaTeXDrawFrame.45=Grille Standard LaTeXDrawFrame.46=Panneau du code LaTeXDrawFrame.47=Bordures LaTeXDrawFrame.48=Int\u00E9rieur LaTeXDrawFrame.49=Hachures LaTeXDrawFrame.51=rempli LaTeXDrawFrame.53=Propri\u00E9t\u00E9s figure LaTeXDrawFrame.55=Ajouter commentaire LaTeXDrawFrame.56=Pr\u00E9f\u00E9rences LaTeXDrawFrame.57=Zoom avant LaTeXDrawFrame.58=Zoom arri\u00E8re LaTeXDrawFrame.60=Ajouter texte LaTeXDrawFrame.61=Premier plan LaTeXDrawFrame.62=Arri\u00E8re plan LaTeXDrawFrame.63=Tracer Courbe de B\u00E9zier LaTeXDrawFrame.64=Pivoter figure LaTeXDrawFrame.65=Change l'\u00E9paisseur de la figure LaTeXDrawFrame.66=Change la couleur des bords de la figure LaTeXDrawFrame.67=Si s\u00E9lectionn\u00E9, la figure sera remplie LaTeXDrawFrame.68=Change la couleur de l'int\u00E9rieur de la figure LaTeXDrawFrame.69=Changer la couleur des hachures LaTeXDrawFrame.70=Mettre la figure au premier plan LaTeXDrawFrame.71=Mettre la figure en arri\u00E8re plan LaTeXDrawFrame.72=S\u00E9lectionner la figure \u00E0 mettre derri\u00E8re la figure s\u00E9lectionn\u00E9e LaTeXDrawFrame.73=S\u00E9lectionner la figure \u00E0 mettre devant la figure s\u00E9lectionn\u00E9e LaTeXDrawFrame.74=Si activ\u00E9, vous pouvez pivoter une figure avec la souris en utilisant les poign\u00E9es de contr\u00F4le LaTeXDrawFrame.75=Joindre plusieurs figures LaTeXDrawFrame.76=S\u00E9parer plusieurs figures LaTeXDrawFrame.77=D\u00E9finir la position des bords de la figure LaTeXDrawFrame.78=Si s\u00E9lectionn\u00E9, la figure aura une double bordure LaTeXDrawFrame.79=Changer la couleur de l'espace entre les doubles bords LaTeXDrawFrame.80=\ Epaisseur LaTeXDrawFrame.82=Une erreur est survenue lors du lancement de LaTeXDraw :
LaTeXDrawFrame.83=Impossible de d\u00E9marrer LaTeXDraw LaTeXDrawFrame.86=Erreur LaTeXDraw LaTeXDrawFrame.88=Fichier LaTeXDrawFrame.89=Edition LaTeXDrawFrame.90=Affichage LaTeXDrawFrame.91=Dessin LaTeXDrawFrame.92=Code LaTeXDrawFrame.93=Aide LaTeXDrawFrame.94=Zoomer sur le dessin LaTeXDrawFrame.95=Zoom arri\u00E8re sur le dessin LaTeXDrawFrame.96=Zoom 100% LaTeXDrawFrame.103=Mod\u00E8les LaTeXDrawFrame.105=Impossible de cr\u00E9er le menu des mod\u00E8les \! LaTeXDrawFrame.107=Barre d'outils LaTeXDrawFrame.108=Cr\u00E9ation d'un nouveau projet LaTeXDrawFrame.109=Ouverture d'un projet LaTeXDrawFrame.110=Sauvegarde d'un projet LaTeXDrawFrame.113=100% LaTeXDrawFrame.114=D\u00E9faire l'action LaTeXDrawFrame.115=Refaire l'action LaTeXDrawFrame.116=Tracer une ligne LaTeXDrawFrame.117=Dessiner un point LaTeXDrawFrame.118=Tracer une forme rectangulaire LaTeXDrawFrame.119=Tracer un rectangle LaTeXDrawFrame.120=Tracer un carr\u00E9 LaTeXDrawFrame.121=Tracer un polygone LaTeXDrawFrame.123=Tracer un losange LaTeXDrawFrame.124=Tracer un triangle LaTeXDrawFrame.125=Tracer une ellipse LaTeXDrawFrame.127=Tracer un cercle LaTeXDrawFrame.128=Tracer un arc LaTeXDrawFrame.130=Tracer un camenbert LaTeXDrawFrame.131=Tracer un arc ferm\u00E9 LaTeXDrawFrame.132=Tracer une courbe de B\u00E9zier LaTeXDrawFrame.133=Tracer une grille LaTeXDrawFrame.136=S\u00E9lectionner une ou plusieurs figures
LaTeXDrawFrame.137=Conseil : pour s\u00E9lectionner plusieurs LaTeXDrawFrame.138=figures, cliquez et
faites glisser la souris sur les figures de votre choix. LaTeXDrawFrame.139=Supprimer les figures selectionn\u00E9es LaTeXDrawFrame.140=Changer les propri\u00E9t\u00E9s de la figure LaTeXDrawFrame.141=Afficher les bordures du dessin
LaTeXDrawFrame.142=Conseil : si vous voulez afficher les bordures du
LaTeXDrawFrame.143=dessin, d\u00E9sactivez la mise \u00E0 jour automatique des bords afin de pouvoir
LaTeXDrawFrame.144=changer les dimensions du dessin. LaTeXDrawFrame.146=Copi\u00E9 ... LaTeXDrawFrame.147=Coll\u00E9 ... LaTeXDrawFrame.148=Coup\u00E9 ... LaTeXDrawFrame.149=Supprim\u00E9 ... LaTeXDrawFrame.151=Choisir la couleur de la double bordure LaTeXDrawFrame.154=Joint ... LaTeXDrawFrame.155=S\u00E9par\u00E9 ... LaTeXDrawFrame.156=Voulez-vous enregistrer le projet ? LaTeXDrawFrame.158=Refait ... LaTeXDrawFrame.159=D\u00E9fait ... LaTeXDrawFrame.160=Mod\u00E8les mis \u00E0 jour ... LaTeXDrawFrame.161=Erreur pour le fichier LaTeXDrawFrame.162=Impression du dessin en cours ... LaTeXDrawFrame.163=Dessin imprim\u00E9 \! LaTeXDrawFrame.164=Impossible d'imprimer le dessin \! LaTeXDrawFrame.165=Impression du code en cours ... LaTeXDrawFrame.166=Code imprim\u00E9 \! LaTeXDrawFrame.167=Impossible d'imprimer le code \! LaTeXDrawFrame.168=Exportation du mod\u00E8le ... LaTeXDrawFrame.169=Mod\u00E8le export\u00E9 \! LaTeXDrawFrame.170=Exportation en PSTricks... LaTeXDrawFrame.171=S\u00E9lectionner LaTeXDrawFrame.172=Exporter le code PSTricks dans un fichier LaTeXDrawFrame.173=Voulez-vous remplacer le fichier ? LaTeXDrawFrame.174=Exporter en code PSTricks LaTeXDrawFrame.175=Code PStricks export\u00E9 \! LaTeXDrawFrame.176=Impossible d'exporter le code PSTricks \! LaTeXDrawFrame.177=Exporter en image ... LaTeXDrawFrame.179=Exporter les figures en LaTeXDrawFrame.182=Exporter comme LaTeXDrawFrame.183=\ fichier LaTeXDrawFrame.184=Exportation en une image termin\u00E9e \! LaTeXDrawFrame.185=Impossible d'exporter en fichier image \! LaTeXDrawFrame.186=Sauvegarde du dessin ... LaTeXDrawFrame.188=Enregistrer le dessin LaTeXDrawFrame.190=Exporter en fichier JPEG LaTeXDrawFrame.191=Projet enregistr\u00E9 \! LaTeXDrawFrame.192=Impossible d'enregistrer le projet \! LaTeXDrawFrame.193=Une erreur est survenue lors de la sauvegarde d'un fichier :
LaTeXDrawFrame.197=Cr\u00E9ation d'un nouveau projet... LaTeXDrawFrame.198=Nouveau projet cr\u00E9\u00E9 \! LaTeXDrawFrame.200=Ouvrir un dessin LaTeXDrawFrame.201=Ouverture d'un fichier ... LaTeXDrawFrame.202=Fichier ouvert \! LaTeXDrawFrame.203=Impossible d'ouvrir le fichier \! LaTeXDrawFrame.204=Une erreur est survenue lors du chargement d'un fichier :
LaTeXDrawFrame.208=
Version LaTeXDrawFrame.209=\ disponible \! LaTeXDrawFrame.210=Nouvelle Version LaTeXDrawFrame.211=Nouvelle version disponible \! LaTeXDrawFrame.212=Pas de nouvelle version LaTeXDrawFrame.213=Impossible de v\u00E9rifier l'existence d'une nouvelle version \! LaTeXDrawFrame.215=L'aide pour LaTeXDraw LaTeXDrawFrame.218=Un g\u00E9n\u00E9rateur de code PSTricks pour LaTeX \! LaTeXDrawFrame.219=Version LaTeXDrawFrame.220=, build LaTeXDrawFrame.221=\ est distribu\u00E9 sous les termes de la licence publique g\u00E9n\u00E9rale GNU LaTeXDrawFrame.222=\ comme publi\u00E9e par la Free Software Foundation (version 2) LaTeXDrawFrame.229=Importer ... LaTeXDrawFrame.230=Depuis un fichier TeX LFrame2.0=D\u00E9finir la taille d'un point. LFrame2.1=Aligner les figures s\u00E9lectionn\u00E9es. LFrame2.10=R\u00E9partir verticalement, \u00E0 \u00E9gale distance entre les figures s\u00E9lectionn\u00E9es. LFrame2.11=R\u00E9partir verticalement, \u00E0 \u00E9gale distance entre le milieu des figures s\u00E9lectionn\u00E9es. LFrame2.12=R\u00E9partir verticalement, \u00E0 \u00E9gale distance entre le haut des figures s\u00E9lectionn\u00E9es. LFrame2.13=R\u00E9partir horizontalement, \u00E0 \u00E9gale distance entre le c\u00F4t\u00E9 gauche des figures s\u00E9lectionn\u00E9es. LFrame2.14=R\u00E9partir horizontalement, \u00E0 \u00E9gale distance entre les figures s\u00E9lectionn\u00E9es. LFrame2.15=R\u00E9partir horizontalement, \u00E0 \u00E9gale distance entre le milieu des figures s\u00E9lectionn\u00E9es. LFrame2.16=R\u00E9partir horizontalement, \u00E0 \u00E9gale distance entre le c\u00F4t\u00E9 droit des figures s\u00E9lectionn\u00E9es. LFrame2.17=Couleurs LFrame2.18=Impossible d'ouvrir le fichier LFrame2.19=Ce mod\u00E8le n'a pas pu \u00EAtre trouv\u00E9 LFrame2.2=Aligner le c\u00F4t\u00E9 gauche des figures s\u00E9lectionn\u00E9es. LFrame2.20=SVP, mettez \u00E0 jour le menu des mod\u00E8les LFrame2.21=mod\u00E8le introuvable LFrame2.22=Le document ne peut pas \u00EAtre imprim\u00E9. LFrame2.23=Aucune imprimante trouv\u00E9e. LFrame2.25=La librairie GPL jlibeps est utilis\u00E9e pour cr\u00E9er des images EPS. LFrame2.3=Aligner le c\u00F4t\u00E9 droit des figures s\u00E9lectionn\u00E9es. LFrame2.4=Aligner le haut des figures s\u00E9lectionn\u00E9es. LFrame2.5=Aligner le bas des figures s\u00E9lectionn\u00E9es. LFrame2.6=Aligner horizontalement le milieu des figures s\u00E9lectionn\u00E9es. LFrame2.7=Aligner verticalement le milieu des figures s\u00E9lectionn\u00E9es. LFrame2.8=R\u00E9partir de mani\u00E8re r\u00E9guli\u00E8re les figures s\u00E9lectionn\u00E9es. LFrame2.9=R\u00E9partir verticalement, \u00E0 \u00E9gale distance au-dessus et en-dessous des figures s\u00E9lectionn\u00E9es. LFrame2.26=Nouveau projet utilisant la s\u00E9lection latexdraw-2.0.8+1.orig/lang/fr/1_6.properties0000644000000000000000000000724411347255510015542 0ustar BatchConvertFrame.1=Sous dossier BatchConvertFrame.2=Fichiers BatchConvertFrame.4=Tt Supp. BatchConvertFrame.5=Ecraser BatchConvertFrame.6=Choisir emplacement BatchConvertFrame.7=S\u00E9lectionner format BatchConvertFrame.8=Convertir BatchConvertFrame.9=Arr\u00EAter BatchConvertFrame.11=Liste de convertion BatchConvertFrame.12=Choisir r\u00E9pertoire BatchConvertFrame.13=S\u00E9lectionner images BatchConvertFrame.14=Convertir en : LaTeXDrawFrame.0=Ins\u00E9rer du code PSTricks LaTeXDrawFrame.1=Ins\u00E9rer une figure LaTeXDrawFrame.2=Convertir images LaTeXDrawFrame.3=Arr\u00EAter LaTeXDrawFrame.4=Tracer lignes jointes LaTeXDrawFrame.5=Image PPM LaTeXDrawFrame.6=Image BMP LaTeXDrawFrame.7=Image PNG LaTeXDrawFrame.9=Arr\u00EAter l'analyse syntaxique \! LaTeXDrawFrame.10=Ins\u00E9rer LaTeXDrawFrame.11=Ins\u00E9rer plusieurs figures \u00E0 partir de code PSTricks LaTeXDrawFrame.14=Tracer plusieurs lignes jointes LaTeXDrawFrame.15=Importation d'un fichier PSTricks... LaTeXDrawFrame.16=L'analyseur PSTricks ne g\u00E8re que peu de fonctions.
Il est conseill\u00E9 d'importer seulement les fonctions g\u00E9r\u00E9es par LaTeXDraw. LaTeXDrawFrame.17=Importer du code PSTricks LaTeXDrawFrame.18=Ce logiciel utilise JIU, the Java Imaging Utilities. Distribu\u00E9 sous LaTeXDrawFrame.19=les termes de la licence publique g\u00E9n\u00E9rale GNU. http://schmidt.devlib.org/jiu/ LaTeXDrawFrame.23=Attention :
  • PSTricks ne peut inclure des fichiers jpeg, bmp, ... ; donc un fichier EPS sera cr\u00E9\u00E9 \u00E0 partir de l'image choisie
    dans le m\u00EAme r\u00E9pertoire. Donc l'image sera incluse seulement si vous avez les droits d'\u00E9criture dans le r\u00E9pertoire.
  • TeX ne g\u00E9re pas les espaces dans les noms, donc d\u00E9brouillez-vous pour ne pas en avoir.
LaTeXDrawFrame.25=Chargement de l'image ... LaTeXDrawFrame.26=L'image est invalide \! LaTeXDrawFrame.27=Impossible de charger l'image \! LaTeXDrawFrame.28=Image ins\u00E9r\u00E9e \! LaTeXDrawFrame.30=Il n'y a pas de figure \u00E0 importer \!
Dans le cas contraire, v\u00E9rifiez la pr\u00E9sence des balises begin{psicture} ...end{pspicture}.
Vous pouvez envoyer le fichier au LaTeXDrawFrame.31=\ si vous pensez qu'il s'agit d'une erreur de l'analyseur PSTricks. LaTeXDrawFrame.32=Pas de figure trouv\u00E9e \! LaTeXDrawFrame.33=Pas de figure trouv\u00E9e \u00E0 importer \! LaTeXDrawFrame.34=Impossible d'importer le fichier PSTricks \! LaTeXDrawFrame.35=Importation annul\u00E9e \! LaTeXDrawFrame.36=Le code est converti en figures \! InsertPSTricksCodeFrame.0=Ins\u00E9rer des figures \u00E0 partir de code PSTricks FatalErrorParsingException.0=
Si le fichier est correct, vous pouvez l'envoyer \u00E0 arno_b@users.sourceforge.net Picture.0=% Attention : le chemin de la figure contient des espaces et ne pourra pas \u00EAtre compil\u00E9 par TeX \! ParserCmdMessage.0=Ligne ParserCmdMessage.1=Commande : ParserCmdMessage.2=Exception : ParserMessagesFrame.0=Commande ParserMessagesFrame.1=Ligne ParserMessagesFrame.2=Exception ParserMessagesFrame.3=Une ou plusieurs erreurs sont apparues lors de l'importation ParserMessagesFrame.4=Analyseur PSTricks : avertissement(s) ParametersGridFrame.0=Inverser position \u00E9tq suivant X ParametersGridFrame.1=Inverser position \u00E9tq suivant Y PSTricksParser.0=Erreur durant l'ouverture du fichier : fichier invalide \! PSTricksParser.1=La d\u00E9finition incr\u00E9mentale de figure pspicture n'est pas g\u00E9r\u00E9e :
PSTricksParser.2=begin{pspciture}...begin{pspciture} ... end{picture}... PSTricksParser.3=Erreur durant l'analyse du fichier \! latexdraw-2.0.8+1.orig/lang/fr/dialogFrames.properties0000644000000000000000000001261711347255510017552 0ustar PreferencesFrame.Pref=Pr\u00E9f\u00E9rences... PreferencesFrame.grid=Grille PreferencesFrame.codePanel=Panneau du code PreferencesFrame.antiAl=Anti-cr\u00E9nelage PreferencesFrame.rendQ=Qualit\u00E9 du rendu PreferencesFrame.colRendQ=Qualit\u00E9 du rendu des couleurs PreferencesFrame.AlphaQ=Qualit\u00E9 de l'interpolation alpha PreferencesFrame.bordersDraw=Bords du dessin PreferencesFrame.codeAuto=Mise \u00E0 jour auto. du code (plus lent) PreferencesFrame.newVers=V\u00E9rifier l'existance d'une nouvelle version au d\u00E9marrage PreferencesFrame.lge=Langue (avec red\u00E9marrage) PreferencesFrame.general=G\u00E9n\u00E9ral PreferencesFrame.folders=Dossiers PreferencesFrame.quality=Qualit\u00E9 PreferencesFrame.selectFolder=S\u00E9lectionner un dossier PreferencesFrame.defOpenSave=Dossier par d\u00E9faut pour l'enregistrement/chargement : PreferencesFrame.defFold=Dossier par d\u00E9faut pour l'importation/exportation : PreferencesFrame.errorReadPref=Probl\u00E8me lors de la lecture du fichier des pr\u00E9f\u00E9rences \! PreferencesFrame.prefSaved=Pr\u00E9f\u00E9rences enregistr\u00E9es \! DrawPropertiesFrame.0=L'\u00E9tiquette du dessin DrawPropertiesFrame.1=Le titre du dessin DrawPropertiesFrame.2=Propri\u00E9t\u00E9s du dessin DrawPropertiesFrame.3=pixels par DrawPropertiesFrame.5=Dans une page avec que des figures, tableaux,... DrawPropertiesFrame.6=En haut de page DrawPropertiesFrame.7=En bas de page DrawPropertiesFrame.8=Ici DrawPropertiesFrame.9=ICI \! DrawPropertiesFrame.10=En milieu de page DrawPropertiesFrame.11=Position verticale du dessin DrawPropertiesFrame.12=Position horizontale du dessin DrawPropertiesFrame.13=Changer le nombre de pixels par unit\u00E9 de mesure ExceptionFrameDialog.0=Envoyer le rapport ExceptionFrameDialog.1=Une erreur est survenue \!
ExceptionFrameDialog.2=
Vous pouvez envoyer un rapport au d\u00E9veloppeur de LaTeXDraw ExceptionFrameDialog.3=Erreur LaTeXDraw : une exception est survenue ExceptionFrameDialog.4=Une erreur est survenue :
ExceptionFrameDialog.5=Impossible de cr\u00E9er une fen\u00EAtre ExceptionFrameDialog AbstractParametersFrame.0=Doubles bords AbstractParametersFrame.2=S\u00E9parateur : AbstractParametersFrame.3=Param\u00E8tres g\u00E9n\u00E9raux AbstractParametersFrame.4=Valider AbstractParametersFrame.5=D\u00E9faut AbstractParametersFrame.6=Annuler AbstractParametersFrame.7=Angle de rotation : AbstractParametersFrame.8=Epaisseur : AbstractParametersFrame.10=Type de ligne : AbstractParametersFrame.11=Largeur hachures : AbstractParametersFrame.12=Fl\u00E8che gauche : AbstractParametersFrame.13=Fl\u00E8che droite : AbstractParametersFrame.14=Param\u00E8tres fl\u00E8ches AbstractParametersFrame.15=Afficher pts ctrl AbstractParametersFrame.16=Arrondi AbstractParametersFrame.17=coord. X du centre : AbstractParametersFrame.18=coord. Y du centre : AbstractParametersFrame.19=Rayon : AbstractParametersFrame.20=Diam\u00E8tre point = AbstractParametersFrame.21=Largeur bar = AbstractParametersFrame.22=Lgr crochet = AbstractParametersFrame.23=Lgr crochet arrondi = AbstractParametersFrame.24=x \u00E9paisseur + AbstractParametersFrame.25=x largeur AbstractParametersFrame.26=Longueur fl\u00E8che AbstractParametersFrame.27=Encart fl\u00E8che AbstractParametersFrame.28=Largeur fl\u00E8che AbstractParametersFrame.29=Coordonn\u00E9e X : AbstractParametersFrame.30=Coordonn\u00E9e Y : AbstractParametersFrame.31=Largeur : AbstractParametersFrame.32=Hauteur : AbstractParametersFrame.33=Param\u00E8tres de la figure AbstractParametersFrame.34=Choisir la couleur des hachures AbstractParametersFrame.35=S\u00E9lectionner la couleur des doubles bords AbstractParametersFrame.36=S\u00E9lectionner la couleur des bords AbstractParametersFrame.37=S\u00E9lectionner la couleur de l'int\u00E9rieur AbstractParametersFrame.38=Fl\u00E8ches ParametersArcFrame.0=Angle de d\u00E9part : ParametersArcFrame.1=Angle d'arriv\u00E9 : ParametersArcFrame.2=Type d'arc : ParametersDotFrame.0=Type de point : ParametersDrawFrame.0=Nord-Ouest X ParametersDrawFrame.1=Nord-Ouest Y ParametersDrawFrame.2=Sud-Est X ParametersDrawFrame.3=Sud-Est Y ParametersGridFrame.0=Origine Y : ParametersGridFrame.1=Origine X : ParametersGridFrame.2=Etiquettes : ParametersGridFrame.3=Unit\u00E9 : ParametersGridFrame.4=Pts sous-grille : ParametersGridFrame.5=Points grille : ParametersGridFrame.6=Largeur grille : ParametersGridFrame.7=Largeur ss-grille : ParametersGridFrame.8=Division sous-grille : ParametersGridFrame.9=Taille \u00E9tiquettes : ParametersLineFrame.0=Coord. X gauche : ParametersLineFrame.1=Coord. Y gauche : ParametersLineFrame.2=Coord. X droite : ParametersLineFrame.3=Coord. Y droite : ParametersTextFrame.0=Gras ParametersTextFrame.1=Italique ParametersTextFrame.2=Police : ParametersTextFrame.3=Taille : ParametersTextFrame.4=Texte ParametersGridFrame.10=Sous-grille : ParametersGridFrame.11=X max : ParametersGridFrame.12=X min : ParametersGridFrame.13=Y max : ParametersGridFrame.14=Y min : ParametersGridFrame.15=Afficher \u00E9tiquettes ParametersGridFrame.17=S\u00E9lectionner couleur \u00E9tiquettes ParametersGridFrame.18=S\u00E9lectionner couleur sous-grille ParametersPolygonFrame.1=Point n\u00B0 ParametersTriangleFrame.0=Coord X centre base : ParametersTriangleFrame.1=Coord Y centre base : ParamsBC.0=Tout bouger ParamsBC.1=Si non s\u00E9lectionn\u00E9, le mouvement d'un point provoque le mouvement de son point de contr\u00F4le. ExportDialog.0=Compression latexdraw-2.0.8+1.orig/lang/fr/1_8.properties0000644000000000000000000000527511347255510015546 0ustar UndoRedoManager.0=Transformation AbstractParametersFrame.0=intervalle : ParametersAxeFrame.0=Forme : ParametersAxeFrame.1=Afficher origine ParametersAxeFrame.2=Axes ParametersAxeFrame.3=Afficher \u00E9tiquettes X ParametersAxeFrame.4=Afficher \u00E9tiquettes Y ParametersAxeFrame.5=D\u00E9finir distance entre etiquettes (cm) ParametersAxeFrame.6=Dist. \u00E9tiquettes X : ParametersAxeFrame.7=Dist. \u00E9tiquettes Y : ParametersAxeFrame.8=Incr\u00E9ment \u00E9tiq. X : ParametersAxeFrame.9=Incr\u00E9ment \u00E9tiq. Y : ParametersAxeFrame.10=Origine \u00E9tiquettes X : ParametersAxeFrame.11=Origine \u00E9tiquettes Y : ParametersAxeFrame.12=Etiquettes ParametersAxeFrame.13=Taille : ParametersAxeFrame.14=Style : ParametersAxeFrame.15=Afficher marques X ParametersAxeFrame.16=Afficher marques Y ParametersAxeFrame.17=Marques PreferencesFrame.3=Chemin de l'\u00E9diteur LaTeX : PreferencesFrame.4=Grille standard PreferencesFrame.5=Grille personnelle PreferencesFrame.6=Grille magn\u00E9tique PreferencesFrame.7=Intervalle : LaTeXDrawFrame.0=Dessiner Axes LaTeXDrawFrame.2=Pivoter les figures s\u00E9lectionn\u00E9es. LaTeXDrawFrame.3=Pivoter les figures s\u00E9lectionn\u00E9es de 90\u00B0. LaTeXDrawFrame.4=Pivoter les figures s\u00E9lectionn\u00E9es de 180\u00B0. LaTeXDrawFrame.5=Pivoter les figures s\u00E9lectionn\u00E9es de 270\u00B0. LaTeXDrawFrame.6=Renverser les figures s\u00E9lectionn\u00E9es par une sym\u00E9trie. LaTeXDrawFrame.7=Renverser horizontalement les figures s\u00E9lectionn\u00E9es. LaTeXDrawFrame.8=Renverser verticalement les figures s\u00E9lectionn\u00E9es. LaTeXDrawFrame.10=Afficher la grille standard (en cm ou en pouce). LaTeXDrawFrame.11=Afficher une grille dont vous pouvez modifier l'intervalle entre les lignes. LaTeXDrawFrame.12=Contient les paramet\u00E8res concernant la grille magn\u00E9tique. LaTeXDrawFrame.13=magn\u00E9tique LaTeXDrawFrame.14=Si coch\u00E9, les figures seront magn\u00E9tiques \u00E0 la grille. LaTeXDrawFrame.15=D\u00E9finit l'intervalle entre les lignes de la grille personnelle (en pixels). LaTeXDrawFrame.16=Dessiner des grilles et des axes. LaTeXDrawFrame.17=Dessiner axes. LaTeXDrawFrame.18=Ouvre votre \u00E9diteur LaTeX. LaTeXDrawFrame.19=Lancement de votre \u00E9diteur LaTeX... LaTeXDrawFrame.20=Vous devez d\u00E9finir le chemin de votre \u00E9diteur LaTeX dans la fen\u00EAtre des pr\u00E9f\u00E9rences. LaTeXDrawFrame.21=Le fichier s\u00E9lectionn\u00E9 est invalide. LaTeXDrawFrame.22=Red\u00E9finissez le chemin dans le panneau des pr\u00E9f\u00E9rences. LaTeXDrawFrame.23=Fermer LaTeXDrawFrame.25=Librairies LaTeXDrawFrame.26=Traducteurs LaTeXDrawFrame.27=Note des versions LaTeXDrawFrame.28=Licence Axe.0=Aucune Axe.1=Axe Axe.2=Rectangle Axe.3=Tout Axe.4=Haut Axe.5=Bas latexdraw-2.0.8+1.orig/lang/fr/others.properties0000644000000000000000000000430611347255510016455 0ustar XScale.cm=cm XScale.inch=pouce LaTeXDrawException.valueInc=Valeur incorrecte LaTeXDrawException.invFile=Ce fichier n'est pas un fichier LaTeXDraw \! LaTeXDrawException.invLaTeXDrawVer=Cette version de LaTeXDraw n'est pas g\u00E9r\u00E9e \! LaTeXDrawException.invException=LaTeXDrawException : code inconnu Arc.arc=Arc Arc.wedge=Camenbert Arc.chord=Arc ferm\u00E9 Arc.arcType=Type d'arc Figure.boundPos=Position des bords DrawContainer.nameTemplate=Entrez le nom du mod\u00E8le DrawContainer.overwriteTemplate=Ce mod\u00E8le existe d\u00E9j\u00E0 ; l'\u00E9craser ? CloseButton.closePanel=Fermer le panneau UndoRedoManager.changeParams=Changer param\u00E8tres UndoRedoManager.changeDispo=Changer disposition UndoRedoManager.move=Bouger UndoRedoManager.delete=Supprimer UndoRedoManager.create=Cr\u00E9er UndoRedoManager.join=Joindre UndoRedoManager.seperate=S\u00E9parer UndoRedoManager.filled=Changer le style de l'int\u00E9rieur UndoRedoManager.intCol=Changer couleur int\u00E9rieure UndoRedoManager.bordCol=Changer couleur bordure UndoRedoManager.thick=Changer \u00E9paisseur UndoRedoManager.style=Changer style UndoRedoManager.lArrow=Changer style fl\u00E8che gauche UndoRedoManager.rArrow=Changer style fl\u00E8che droite UndoRedoManager.dotStyle=Changer style point UndoRedoManager.noRedo=Impossible de refaire UndoRedoManager.noUndo=Impossible de d\u00E9faire UndoRedoManager.align=alignement UndoRedoManager.distrib=distribution CodePanel.reload=Recharger CodePanel.autoUpdate=M\u00E0J auto. CodePanel.copySel=Copier le code s\u00E9lectionn\u00E9 CodePanel.copyAll=Copier tout le code CodePanel.tip=
Si coch\u00E9, le code sera mis \u00E0 jour en temps r\u00E9el
Conseil : d\u00E9sactivez la mise \u00E0 jour automatique ou
n'affichez pas le panneau de code lorsque le dessin est complexe.
CodePanel.updateCode=Mettre \u00E0 jour le code CodePanel.addComment=Ajouter des commentaires CodePanel.reloadText=Code PSTricks recharg\u00E9 \! CodePanel.copiedText=Code PSTricks copi\u00E9 dans le presse-papier \! CodePanel.copiedSelText=Selection copi\u00E9e dans le presse-papier \! SVGManager.0=Impossible de g\u00E9n\u00E9rer les formes \u00E0 partir du document SVG. latexdraw-2.0.8+1.orig/lang/fr/1_7.properties0000644000000000000000000000603611347255510015541 0ustar LaTeXDrawException.0=Image invalide. LaTeXDrawFrame.0=Ombre LaTeXDrawFrame.9=S\u00E9lectionner couleur ombre LaTeXDrawFrame.1=D\u00E9grad\u00E9 1 LaTeXDrawFrame.2=D\u00E9grad\u00E9 2 LaTeXDrawFrame.4=Ajouter une ombre \u00E0 la figure. LaTeXDrawFrame.5=Choisir la couleur de l'ombre. LaTeXDrawFrame.6=Positionner des figures dans le dessin (devant, derri\u00E8re,...). LaTeXDrawFrame.7=Choisir la premi\u00E8re couleur du d\u00E9grad\u00E9. LaTeXDrawFrame.8=Choisir la seconde couleur du d\u00E9grad\u00E9. ParametersTextFrame.0=Opacit\u00E9 ParametersTextFrame.1=Liste des bo\u00EEtes ParametersTextFrame.2=Opaque ParametersTextFrame.3=Cercle ParametersTextFrame.4=Rectangle ParametersTextFrame.5=Triangle ParametersTextFrame.6=Losange ParametersTextFrame.7=Ellipse ParametersTextFrame.8=Simple bo\u00EEte ParametersTextFrame.9=Plusieurs bo\u00EEtes ParametersGridFrame.0=Param\u00E8tres de la grille ParametersTextFrame.10=Encadrement possible ParametersTextFrame.11=Ajouter ParametersTextFrame.12=Modifier ParametersTextFrame.13=Supprimer ParametersTextFrame.14=S\u00E9parateur : ParametersTextFrame.15=Editer bo\u00EEte ParametersTextFrame.16=Consid\u00E9rer taille bo\u00EEte ParametersTextFrame.17=Si s\u00E9lectionn\u00E9, l'arri\u00E8re-plan du texte sera opaque. ParametersTextFrame.18=Bo\u00EEte(s) encadrante(s) ParametersTextFrame.20=Cr\u00E9er une ou plusieurs bo\u00EEtes autour du texte. ParametersTextFrame.21=La bo\u00EEte sera un rectangle. ParametersTextFrame.22=La bo\u00EEte sera un triangle. ParametersTextFrame.23=Cr\u00E9er une bo\u00EEte encadrant tout le texte. ParametersTextFrame.24=La bo\u00EEte sera une ellipse. ParametersTextFrame.25=La bo\u00EEte sera un losange. ParametersTextFrame.26=Cr\u00E9er plusieurs bo\u00EEtes autour de diff\u00E9rentes parties du texte. ParametersTextFrame.27=La bo\u00EEte sera un cercle. ParametersTextFrame.28=Ajouter une nouvelle bo\u00EEte. ParametersTextFrame.29=Editer la position de la bo\u00EEte s\u00E9lectionn\u00E9e. ParametersTextFrame.30=Supprimer la bo\u00EEte s\u00E9lectionn\u00E9e. ParametersTextFrame.31=Changer l'espacement entre le texte et la bo\u00EEte. ParametersTextFrame.32=Si s\u00E9lectionn\u00E9, la bo\u00EEte ne sera pas dessin\u00E9e sur les autres parties du texte. ParametersTextFrame.33=Ouvrir le panneau des param\u00E8tres pour l'\u00E9diter la bo\u00EEte. ParametersTextFrame.34=S\u00E9lection du texte ParametersTextFrame.35=S\u00E9lectionner le texte \u00E0 encadrer : ParametersTextFrame.36=S\u00E9lection du texte ParametersTextFrame.37=Bo\u00EEte invalide ; elle chevauche une autre bo\u00EEte. AbstractParametersFrame.0=Dimensions/Position AbstractParametersFrame.1=Angle de l'ombre AbstractParametersFrame.2=Taille de l'ombre AbstractParametersFrame.3=Angle du d\u00E9grad\u00E9 AbstractParametersFrame.4=Pt du milieu AbstractParametersFrame.6=Autres AbstractParametersFrame.7=Coin rond : AbstractParametersFrame.8=Hachures AbstractParametersFrame.9=Double ligne AbstractParametersFrame.11=Remplissage AbstractParametersFrame.12=D\u00E9grad\u00E9 BatchConvertFrame.0=Dans les m\u00EAmes dossiers latexdraw-2.0.8+1.orig/lang/it/0000755000000000000000000000000011347255510013035 5ustar latexdraw-2.0.8+1.orig/lang/it/1_9.properties0000644000000000000000000001064411347255510015550 0ustar LaTeXDrawFrame.0=File recenti LaTeXDrawFrame.1=Disegna curva di B\u00E9zier chiusa LaTeXDrawFrame.2=Pulisci tutto LaTeXDrawFrame.3=Scorciatoie LaTeXDrawFrame.4=Controlla aggiornamenti LaTeXDrawFrame.5=Forme LaTeXDrawFrame.6=Imposta tutte le figure come visibili LaTeXDrawFrame.7=Se una figura ha le sue coordinate su (0,0), tu non la puoi vedere.
Questo pulsante ti permette di sostituire tutte le figure affinch\u00E9 siano visibili. LaTeXDrawFrame.8=Definisce le propriet\u00E0 dei gestore LaTeXDrawFrame.9=Gestori opacit\u00E0: LaTeXDrawFrame.10=DEfinisci la trasparenza dei gestori. LaTeXDrawFrame.11=Disegna una curva di B\u00E9zier chiusa. LaTeXDrawFrame.12=Controlla che la versione del runtime di Java che \u00E8 stato usato
per creare questo file sia la stessa del JRE attualmente in uso. LaTeXDrawFrame.13=La cartella di aiuto \u00E8 irraggiungibile, la pagina di aiuto non pu\u00F2 essere caricata. LaTeXDrawFrame.14=Impossibile creare la pagina di aiuto. PSTricksParser.0=begin{center} deve essere all'esterno di begin{pspicture}...end{pspicture} PSTricksParser.1=end{center} deve essere all'esterno di begin{pspicture}...end{pspicture} PSTricksParser.2=end{figure} deve essere all'esterno di begin{pspicture}...end{pspicture} PSTricksParser.3=end{pspicture} o pspicturenon trovato. DrawPanel.0=Aggiorna le figure rispetto alla griglia ParametersAkinPointsFrame.0=Intervallo punti: ParametersAkinPointsFrame.1=Apri ParametersAkinPointsFrame.2=tipo: ParametersAkinPointsFrame.3=Parametri mano libera ParametersBezierCurveFrame.2=Equilibra ParametersBezierCurveFrame.4=Distanza: PreferencesFrame.0=Numero di file recenti: PreferencesFrame.1=Tema (richiede riavvio): ShortcutsFrame.1=Sequenza ShortcutsFrame.3=Categoria ShortcutsFrame.4=Navigazione ShortcutsFrame.5=Trasformazione ShortcutsFrame.6=Disegno ShortcutsFrame.7=\ (movimento ampio) ShortcutsFrame.8=click sinistro ShortcutsFrame.9=Muove la barra di scorrimento orizzontale verso destra ShortcutsFrame.10=Muove la barra di scorrimento orizzontale verso sinistra ShortcutsFrame.11=Muove la barra di scorrimento verticale verso l'alto ShortcutsFrame.12=Muove la barra di scorrimento verticale verso il basso ShortcutsFrame.14=Va alla fine dalla barra di scorrimento orizzontale ShortcutsFrame.15=Va all'inizio della barra di scorrimento orizzontale ShortcutsFrame.16=Va in testa alla barra di scorrimento verticale ShortcutsFrame.17=Va in fondo alla barra di scorrimento verticale ShortcutsFrame.18=Muove le figure selezionate verso destra ShortcutsFrame.19=Muove le figure selezionate verso sinistra ShortcutsFrame.20=Muove le figure selezionate verso l'alto ShortcutsFrame.21=Muove le figure selezionate verso il basso ShortcutsFrame.23=Aggiorna le figure selezionate alla griglia disegnata ShortcutsFrame.25=Seleziona tutte le figure del disegno ShortcutsFrame.26=Aggiunge la figura cliccata alla selezione ShortcutsFrame.27=Rimuove le figure dalla selezione ShortcutsFrame.28=Seleziona la prossima o la prima figura (solo in modalit\u00E0 selezione) ShortcutsFrame.29=Rotella del mouse ShortcutsFrame.30=Zoom in/out MenusListener.0=Premi il bottone sinistro e trascina il mouse nella posizione del secondo punto. Rilascia il bottone per concludere la creazione. MenusListener.1=Un click sinistro per aggiungere un punto, un click destro o un doppio click sinistro per collocare l'ultimo punto e finire la creazione. MenusListener.4=Premi il bottone sinistro e trascina il mouse per posizionare l'ultimo punto. Rilascia il bottone per concludere la creazione. MenusListener.5=Il tasto sinistro del mouse aggiunge un testo. MenusListener.6=Il tasto sinistro del mouse aggiunge una griglia. MenusListener.7=Il tasto sinistro del mouse aggiunge gli assi. MenusListener.8=Premi il bottone sinistro e trascina il mouse per disegnare la forma. Rilascia il bottone per concludere la creazione. MenusListener.9=Il tasto sinistro del mouse aggiunge un punto. RecentFilesListener.0=Impossibile accedere a questo file. RecentFilesListener.1=Impossibile aprire il file ParametersBezierCurveFrame.3=Equilibra i punti di controllo rispetto alla posizione dei punti. ParametersBezierCurveFrame.5=Definisci lo spazio fra il punto di controllo ed il punto quando si equilibria la curva. ParametersBezierCurveFrame.6=Asse X, punto di controllo n. 1 ParametersBezierCurveFrame.7=Asse Y, punto di controllo n. 1 ParametersBezierCurveFrame.8=Asse X, punto di controllo n. 2 ParametersBezierCurveFrame.9=Asse Y, punto di controllo n. 2 latexdraw-2.0.8+1.orig/lang/it/LaTeXDrawFrame.properties0000644000000000000000000002202211347255510017717 0ustar LaTeXDrawFrame.0=\ Aiuto LaTeXDrawFrame.1=Informazioni LaTeXDrawFrame.2=Disegna linea LaTeXDrawFrame.3=Disegna rettangolo LaTeXDrawFrame.4=Disegna punto LaTeXDrawFrame.5=Disegna quadrato LaTeXDrawFrame.6=Disegna rombo LaTeXDrawFrame.7=A mano libera LaTeXDrawFrame.8=Disegna triangolo LaTeXDrawFrame.9=Disegna cerchio LaTeXDrawFrame.10=Disegna griglia LaTeXDrawFrame.11=Disegna ellisse LaTeXDrawFrame.12=Disegna poligono LaTeXDrawFrame.13=Seleziona figura (e) LaTeXDrawFrame.14=Mostra bordi LaTeXDrawFrame.15=Aggiustamento automatico dei bordi LaTeXDrawFrame.16=Esporta come... LaTeXDrawFrame.17=Cancella figura LaTeXDrawFrame.18=Esci LaTeXDrawFrame.19=Codice PSTricks LaTeXDrawFrame.20=Immagine JPEG LaTeXDrawFrame.21=Immagine EPS LaTeXDrawFrame.22=Ripeti LaTeXDrawFrame.23=Annulla LaTeXDrawFrame.25=Salva progetto LaTeXDrawFrame.26=Salva come progetto LaTeXDrawFrame.27=Apri progetto LaTeXDrawFrame.28=Nuovo progetto LaTeXDrawFrame.29=Stampa codice LaTeXDrawFrame.30=Stampa disegno LaTeXDrawFrame.35=Disegna arco LaTeXDrawFrame.38=Scala X LaTeXDrawFrame.39=Scala Y LaTeXDrawFrame.40=Copia LaTeXDrawFrame.41=Aggiorna modelli LaTeXDrawFrame.42=Esporta come modello LaTeXDrawFrame.43=Incolla LaTeXDrawFrame.44=Taglia LaTeXDrawFrame.45=Griglia standard LaTeXDrawFrame.47=Bordi LaTeXDrawFrame.48=Interni LaTeXDrawFrame.51=riempito LaTeXDrawFrame.53=Propriet\u00E0 della Figura LaTeXDrawFrame.55=Aggiungi commenti LaTeXDrawFrame.56=Preferenze LaTeXDrawFrame.57=Zoom avanti LaTeXDrawFrame.58=Zoom indietro LaTeXDrawFrame.60=Aggiungi testo LaTeXDrawFrame.61=Primo piano LaTeXDrawFrame.62=Sfondo LaTeXDrawFrame.63=Disegna curva di B\u00E9zier LaTeXDrawFrame.64=Ruota la figura LaTeXDrawFrame.65=Cambia lo spessore della figura LaTeXDrawFrame.66=Cambia il colore dei bordi della figura LaTeXDrawFrame.68=Cambia il colore dell'interno della figura LaTeXDrawFrame.69=Cambia il colore del tratteggio LaTeXDrawFrame.70=Metti la figura in primo piano LaTeXDrawFrame.71=Metti la figura sullo sfondo LaTeXDrawFrame.72=Seleziona la figura che andr\u00E0 dietro alla figura selezionata LaTeXDrawFrame.73=Seleziona la figura che andr\u00E0 davanti alla figura selezionata LaTeXDrawFrame.75=Raggruppa alcune figure LaTeXDrawFrame.76=Separa alcune figure LaTeXDrawFrame.77=Definisce la posizione dei bordi della figura LaTeXDrawFrame.80=\ Spessore LaTeXDrawFrame.82=Un errore si \u00E8 verificato durante il lancio di LaTeXDraw:
LaTeXDrawFrame.83=LaTeXDraw non \u00E8 in grado di partire LaTeXDrawFrame.86=LaTeXDraw Error LaTeXDrawFrame.88=File LaTeXDrawFrame.89=Modifica LaTeXDrawFrame.90=Mostra LaTeXDrawFrame.91=Disegna LaTeXDrawFrame.92=Codice LaTeXDrawFrame.93=Aiuto LaTeXDrawFrame.94=Ingrandisci il disegno LaTeXDrawFrame.95=Rimpicciolisci il disegno LaTeXDrawFrame.96=ingrandimento 100% LaTeXDrawFrame.103=Modelli LaTeXDrawFrame.105=Impossibile creare il menu dei modelli\! LaTeXDrawFrame.107=Barra degli strumenti LaTeXDrawFrame.108=Crea un nuovo progetto LaTeXDrawFrame.109=Apri un progetto LaTeXDrawFrame.110=Salva il progetto LaTeXDrawFrame.113=100% LaTeXDrawFrame.114=Anulla LaTeXDrawFrame.115=Rifai LaTeXDrawFrame.116=Disegna una linea LaTeXDrawFrame.117=Disegna un punto LaTeXDrawFrame.118=Disegna una forma rettangolare LaTeXDrawFrame.119=Disegna un rettangolo LaTeXDrawFrame.120=Disegna un quadrato LaTeXDrawFrame.121=Disegna un poligono LaTeXDrawFrame.123=Disegna un rombo LaTeXDrawFrame.124=Disegna un triangolo LaTeXDrawFrame.125=Disegna un'ellisse LaTeXDrawFrame.127=Disegna un cerchio LaTeXDrawFrame.128=Disegna un arco LaTeXDrawFrame.132=Disegna una curva di B\u00E9zier LaTeXDrawFrame.133=Disegna una griglia LaTeXDrawFrame.136=Seleziona una o pi\u00F9 figure
LaTeXDrawFrame.140=Cambia le propriet\u00E0 della figura LaTeXDrawFrame.141=Mostra i bordi del disegno
LaTeXDrawFrame.146=Copiato... LaTeXDrawFrame.147=Incollato... LaTeXDrawFrame.148=Tagliato... LaTeXDrawFrame.149=Cancellato... LaTeXDrawFrame.154=Raggruppato... LaTeXDrawFrame.155=Separato... LaTeXDrawFrame.156=Vuoi salvare il progetto? LaTeXDrawFrame.158=Rifatto... LaTeXDrawFrame.159=Annullato... LaTeXDrawFrame.160=Aggiornati i Modelli... LaTeXDrawFrame.161=Errore per il file LaTeXDrawFrame.162=Stampo il disegno... LaTeXDrawFrame.163=Disegno stampato\! LaTeXDrawFrame.164=Impossibile stampare il disegno\! LaTeXDrawFrame.165=Stampo il codice... LaTeXDrawFrame.166=Codice stampato\! LaTeXDrawFrame.167=Impossibile stampare il codice\! LaTeXDrawFrame.168=Esporto come modello... LaTeXDrawFrame.169=Modello esportato\! LaTeXDrawFrame.170=Esporto come codice PSTricks... LaTeXDrawFrame.171=Seleziona LaTeXDrawFrame.172=Esporta il codice PSTricks come file TEX LaTeXDrawFrame.173=Vuoi rimpiazzare il file? LaTeXDrawFrame.174=Esporta come PSTricks LaTeXDrawFrame.175=Codice PSTricks esportato\! LaTeXDrawFrame.176=Impossibile esportare il codice PSTricks\! LaTeXDrawFrame.177=Esporto come immagine... LaTeXDrawFrame.179=Esporta figure come LaTeXDrawFrame.182=Esporta come LaTeXDrawFrame.183=\ file LaTeXDrawFrame.184=Esportato come immagine\! LaTeXDrawFrame.185=Impossibile esportare come immagine\! LaTeXDrawFrame.186=Salvataggio del progetto... LaTeXDrawFrame.188=Salva il disegno LaTeXDrawFrame.190=Esporta come file JPEG LaTeXDrawFrame.191=Progetto salvato\! LaTeXDrawFrame.192=Impossibile salvare il progetto\! LaTeXDrawFrame.193=Un errore si \u00E8 verificato durante il salvataggio di un file:
LaTeXDrawFrame.198=Creato un nuovo progetto\! LaTeXDrawFrame.200=Apri un disegno LaTeXDrawFrame.201=Apro un disegno... LaTeXDrawFrame.202=File aperto\! LaTeXDrawFrame.203=Impossibile aprire il file\! LaTeXDrawFrame.204=Un errore si \u00E8 verificato durante l'apertura di un file:
LaTeXDrawFrame.208=
Versione LaTeXDrawFrame.209=\ rilasciata\! LaTeXDrawFrame.210=Nuova Versione LaTeXDrawFrame.211=Rilasciata una nuova versione\! LaTeXDrawFrame.212=Nessuna nuova versione LaTeXDrawFrame.215=Aiuto di LaTeXDraw LaTeXDrawFrame.218=Un generatore di codice PSTricks per LaTeX\! LaTeXDrawFrame.219=Versione LaTeXDrawFrame.220=, build LaTeXDrawFrame.221=\ \u00E8 distribuito sotto le condizioni della General Public License GNU LaTeXDrawFrame.222=\ come pubblicata dalla Free Software Foundation (versione 2) LaTeXDrawFrame.229=Importa... LaTeXDrawFrame.230=Da file TeX LFrame2.0=Definisce la dimensione di un punto. LFrame2.1=Allinea le figure selezionate. LFrame2.17=Colori LFrame2.18=Impossibile aprire il file. LFrame2.19=Questo modello non pu\u00F2 essere trovato LFrame2.2=Allinea le figure selezionate sulla sinistra. LFrame2.20=Per favore aggiornare il menu dei modelli LFrame2.21=Modello non trovato LFrame2.22=Il documento non pu\u00F2 essere stampato. LFrame2.23=Non \u00E8 stata trovata nessuna stampante. LFrame2.25=La libreria GPL jlibeps viene usata per creare immagini EPS. LFrame2.3=Allinea sulla destra le figure selezionate. LFrame2.4=Allinea verso l'alto le figure selezionate. LFrame2.5=Allinea verso il basso le figure selezionate. LFrame2.6=Allinea orizzontalmente al centro le figure selezionate. LFrame2.7=Allinea verticalmente al centro le figure selezionate. LFrame2.8=Distribuisce le figure selezionate ad uguale distanza. LFrame2.26=Nuovo progetto con selezione LaTeXDrawFrame.31=Dietro una figura LaTeXDrawFrame.32=Davanti ad una figura LaTeXDrawFrame.33=Gruppo LaTeXDrawFrame.34=Separa LaTeXDrawFrame.36=Draw wedge LaTeXDrawFrame.37=Draw chord LaTeXDrawFrame.46=Pannello Codice LaTeXDrawFrame.49=Hatchings LaTeXDrawFrame.67=Se selezionata, la figura verr\u00E0 riempita LaTeXDrawFrame.74=If activated, you can rotate a figure with the mouse using handlers LaTeXDrawFrame.78=Se selezionata, la figura avr\u00E0 doppi bordi LaTeXDrawFrame.79=Change to color of the space between the double borders LaTeXDrawFrame.130=Draw a wedge LaTeXDrawFrame.131=Draw a chord LaTeXDrawFrame.137=Informazione : per selezionare diverse LaTeXDrawFrame.138=figure, clicca e
trascina il mouse sulle figure che vuoi LaTeXDrawFrame.139=Elimina la/le figura/e selezionata/e LaTeXDrawFrame.142=Informazione : se mostri i bordi del
LaTeXDrawFrame.143=disegno, disabilita l'auto-aggiornamento dei bordi per essere in grado di
LaTeXDrawFrame.144=cambiare le dimensioni del disegno LaTeXDrawFrame.151=Seleziona il colore dei bordi doppi LaTeXDrawFrame.197=Creazione di un nuovo progetto... LaTeXDrawFrame.213=Unable to check if a new version exists! LFrame2.10=Distribute vertically, at equal distance between, the selected figures. LFrame2.11=Distribute vertically at equal distance between the middle of the selected figures. LFrame2.12=Distribute vertically at equal distance between the top sides of the selected figures. LFrame2.13=Distribute horizontally at equal distance between the left sides of the selected figures. LFrame2.14=Distribute horizontally, at equal distance between, the selected figures. LFrame2.15=Distribute horizontally at equal distance between the middle of the selected figures. LFrame2.16=Distribute horizontally at equal distance between the right sides of the selected figures. LFrame2.9=Distribute vertically, at equal distance between the bottom sides of the selected figures. latexdraw-2.0.8+1.orig/lang/it/1_6.properties0000644000000000000000000000660011347255510015542 0ustar BatchConvertFrame.1=Aggiungi sottocartelle BatchConvertFrame.2=Aggiungi files BatchConvertFrame.4=Elimina tutto BatchConvertFrame.5=Sovrascrivi BatchConvertFrame.6=Seleziona percorso BatchConvertFrame.7=Seleziona formato BatchConvertFrame.8=Converti BatchConvertFrame.9=Stop BatchConvertFrame.11=Elenco batch BatchConvertFrame.12=Seleziona cartella BatchConvertFrame.13=Seleziona immagini BatchConvertFrame.14=Converti in: LaTeXDrawFrame.0=Inserisci codice PSTricks LaTeXDrawFrame.1=Inserisci un'immagine LaTeXDrawFrame.2=Converti immagini LaTeXDrawFrame.3=stop LaTeXDrawFrame.4=Disegna linee unite LaTeXDrawFrame.5=Immagine PPM LaTeXDrawFrame.6=Immagine BMP LaTeXDrawFrame.7=Immagine PNG LaTeXDrawFrame.9=Ferma il parsing\! LaTeXDrawFrame.10=Inserisci LaTeXDrawFrame.11=Inserisci figure da codice PSTricks LaTeXDrawFrame.14=Disegna linee unite LaTeXDrawFrame.15=Importo un file PSTricks... LaTeXDrawFrame.16=Il parser PSTricks corrente supporta solo alcuni comandi.
Dovresti importare solo comandi gestiti da LaTeXDraw. LaTeXDrawFrame.17=Importa un codice PSTricks LaTeXDrawFrame.18=Questo software utilizza JIU, le Java Imaging Utiities. Distribuito LaTeXDrawFrame.19=nei termini della GNU General Public License. http://schmidt.devlib.org/jiu/ LaTeXDrawFrame.23=Attenzione:
  • PSTricks non pu\u00F2 includere file JPG, BMP,...; perci\u00F2 dall'immagine selezionata verr\u00E0 creata un'immagine EPS
    nella stessa cartella. Cos\u00EC l'immagine sar\u00E0 inclusa solo se si hanno i diritti di scrittura nella cartella;
  • TeX non supporta spazi nel percorso, perci\u00F2 fai in modo di non averne.
LaTeXDrawFrame.25=Carico l'immagine... LaTeXDrawFrame.26=L'immagine non \u00E8 valida\! LaTeXDrawFrame.27=Impossibile caricare l'immagine\! LaTeXDrawFrame.28=Immagine inserita\! LaTeXDrawFrame.30=Nessuna immagine da importare\!
Se questo \u00E8 falso, controlla che siano racchiuse fra begin{pspicture} ...end{pspicture}.
Puoi inviare il file a LaTeXDrawFrame.31=\ se pensi ci sia una bug in PSTricks. LaTeXDrawFrame.32=Non \u00E8 stata trovata nessuna figura\! LaTeXDrawFrame.33=Non \u00E8 stata trovata nessuna figura da importare\! LaTeXDrawFrame.34=Impossibile importare il file PSTricks\! LaTeXDrawFrame.35=Importazione annullata\! LaTeXDrawFrame.36=Codice convertito in figure\! InsertPSTricksCodeFrame.0=Inserisci figure da codice PSTricks FatalErrorParsingException.0=
Se il file \u00E8 valido, puoi inviarlo ad arno_b@users.sourceforge.net Picture.0=% Attenzione: il percorso della seguente immagine contiene spazi e non sar\u00E0 compilato da tex\! ParserCmdMessage.0=Linea ParserCmdMessage.1=Comando: ParserCmdMessage.2=Eccezione: ParserMessagesFrame.0=Comando ParserMessagesFrame.1=Linea ParserMessagesFrame.2=Eccezione ParserMessagesFrame.3=Ci sono stati uno o pi\u00F9 warning durante il parsing ParserMessagesFrame.4=Parser TeX: warning ParametersGridFrame.0=Inverte la posizione dell'etichetta seguendo X ParametersGridFrame.1=Inverte la posizione dell'etichetta seguendo Y PSTricksParser.0=Errore durante l'apertura del file: file non valido\! PSTricksParser.1=Non \u00E8 ancora gestito l'incremento della definizione di pspicture:
PSTricksParser.2=begin{pspicture}...begin{pspicture} ... end{pspicture}... PSTricksParser.3=Errore durante il parsing del file\! latexdraw-2.0.8+1.orig/lang/it/dialogFrames.properties0000644000000000000000000001240411347255510017551 0ustar PreferencesFrame.Pref=Preferenze... PreferencesFrame.grid=Griglia PreferencesFrame.codePanel=Pannello del codice PreferencesFrame.antiAl=Anti-aliasing PreferencesFrame.rendQ=Qualit\u00E0 del rendering PreferencesFrame.colRendQ=QUalit\u00E0 del rendering del colore PreferencesFrame.AlphaQ=Qualit\u00E0 dell'interpolazione alpha PreferencesFrame.bordersDraw=Bordi dell'area di disegno PreferencesFrame.codeAuto=Auto aggiornamento del codice (pi\u00F9 lento) PreferencesFrame.newVers=Controlla esistenza nuova versione all'avvio PreferencesFrame.lge=Linguaggio (richiede riavvio) PreferencesFrame.general=Generale PreferencesFrame.folders=Cartelle PreferencesFrame.quality=Qualit\u00E0 PreferencesFrame.selectFolder=Seleziona una cartella PreferencesFrame.defOpenSave=Cartella di default per azioni di apertura/salvataggio: PreferencesFrame.defFold=Cartella di default per azioni di import/export: PreferencesFrame.errorReadPref=Si \u00E8 verificato un errore durante la apertura del file delle preferenze. PreferencesFrame.prefSaved=Preferenze salvate. DrawPropertiesFrame.0=L'etichetta del disegno DrawPropertiesFrame.1=Il contenuto del disegno DrawPropertiesFrame.2=Propriet\u00E0 del disegno DrawPropertiesFrame.3=pixels per DrawPropertiesFrame.5=In una pagina con solo flottanti DrawPropertiesFrame.6=In cima alla pagina DrawPropertiesFrame.7=Al fondo della pagina DrawPropertiesFrame.8=Qui DrawPropertiesFrame.9=QUI\! DrawPropertiesFrame.10=Al centro della pagina DrawPropertiesFrame.13=Cambia il numeor di pixel per unit\u00E0 di lunghezza ExceptionFrameDialog.0=Invia Rapporto ExceptionFrameDialog.1=Si \u00E8 verificato un errore\!
ExceptionFrameDialog.2=
Puoi inviare un rapporto allo sviluppatore di LaTeXDraw ExceptionFrameDialog.3=si \u00E8 verificata un'eccezione ExceptionFrameDialog.4=Si \u00E8 verificato un errore:
ExceptionFrameDialog.5=Impossibile creare un ExceptionFrameDialog AbstractParametersFrame.0=Doppio limite AbstractParametersFrame.2=Separatore: AbstractParametersFrame.3=Parametri generali AbstractParametersFrame.4=OK AbstractParametersFrame.5=Standard AbstractParametersFrame.6=Annulla AbstractParametersFrame.7=Angolo di rotazione AbstractParametersFrame.8=Spessore: AbstractParametersFrame.10=Tipo di linea AbstractParametersFrame.12=Freccia a sinistra: AbstractParametersFrame.13=Freccia a destra: AbstractParametersFrame.14=Parametri della freccia AbstractParametersFrame.15=Mostra punti di controllo AbstractParametersFrame.16=Arrotondato AbstractParametersFrame.19=Raggio: AbstractParametersFrame.20=DIametro del punto= AbstractParametersFrame.26=Lunghezza della freccia AbstractParametersFrame.28=Spessore della freccia AbstractParametersFrame.29=Coordinata x: AbstractParametersFrame.30=Coordinata y: AbstractParametersFrame.31=Larghezza: AbstractParametersFrame.32=Altezza: AbstractParametersFrame.33=Parametri della figura AbstractParametersFrame.36=Scegli il colore dei bordi AbstractParametersFrame.37=Scegli colore di riempimento AbstractParametersFrame.38=Frecce ParametersArcFrame.0=angolo iniziale ParametersArcFrame.1=angolo finale ParametersArcFrame.2=Tipo di arco: ParametersDotFrame.0=Tipo di punto: ParametersGridFrame.0=Origine X: ParametersGridFrame.1=Origine Y: ParametersGridFrame.2=Etichetta: ParametersGridFrame.3=Unit\u00E0: ParametersGridFrame.5=Punti della griglia: ParametersGridFrame.6=Larghezza della griglia ParametersGridFrame.7=Larghezza della sottogriglia: ParametersGridFrame.9=Dimensioni dell'etichetta: ParametersTextFrame.0=Grasseto ParametersTextFrame.1=Italico ParametersTextFrame.2=Carattere: ParametersTextFrame.3=Dimensione: ParametersTextFrame.4=Testo ParametersGridFrame.10=Sottogriglia ParametersGridFrame.11=X massimo: ParametersGridFrame.12=X minimo: ParametersGridFrame.13=Y massimo: ParametersGridFrame.14=Y minimo: ParametersGridFrame.15=Disegna etichette ParametersGridFrame.17=Seleziona il colore delle etichette ParametersGridFrame.18=Seleziona il colore delle sottogriglie ParametersPolygonFrame.1=Punto n\u00B0 ParamsBC.0=Muovi tutto ExportDialog.0=Compressione DrawPropertiesFrame.11=Posizione verticale del disegno DrawPropertiesFrame.12=Posizione orizzontale del disegno AbstractParametersFrame.11=Hatchings Width: AbstractParametersFrame.17=Coordinata X-centro: AbstractParametersFrame.18=Coordinata Y-centro: AbstractParametersFrame.21=Larghezza barra = AbstractParametersFrame.22=Bracket length = AbstractParametersFrame.23=Rounded bracket lgth = AbstractParametersFrame.24=sottigliezza x + AbstractParametersFrame.25=larghezza x AbstractParametersFrame.27=Arrow inset AbstractParametersFrame.34=Select hatchings color AbstractParametersFrame.35=Seleziona il colore del doppio limite ParametersDrawFrame.0=X Nord-Ovest ParametersDrawFrame.1=Y Nord-Ovest ParametersDrawFrame.2=X Sud-Est ParametersDrawFrame.3=Y Sud-Est ParametersGridFrame.4=Punti sotto-griglia: ParametersGridFrame.8=Divisione sotto-griglia: ParametersLineFrame.0=Coordinata X sinistra: ParametersLineFrame.1=Coordinata Y sinistra: ParametersLineFrame.2=Coordinata X destra: ParametersLineFrame.3=Coordinata Y destra: ParametersTriangleFrame.0=Coordinata X del centro della base: ParametersTriangleFrame.1=Coordinata Y del centro della base: ParamsBC.1=Se non selezionato, quando sposti un punto anche i suoi punti di controllo vengono spostati. latexdraw-2.0.8+1.orig/lang/it/1_8.properties0000644000000000000000000000462511347255510015551 0ustar UndoRedoManager.0=Trasformazione AbstractParametersFrame.0=intervallo: ParametersAxeFrame.0=Forma: ParametersAxeFrame.1=Mostra origine ParametersAxeFrame.2=Assi ParametersAxeFrame.3=Mostra le etichette su X ParametersAxeFrame.4=Mostra le etichette su Y ParametersAxeFrame.5=Definisci la distanza fra le etichette (cm) ParametersAxeFrame.6=Distanza etichette X: ParametersAxeFrame.7=Distanza etichette Y: ParametersAxeFrame.8=Incremento etichette X: ParametersAxeFrame.9=Incremento etichette Y: ParametersAxeFrame.10=Origine etichette X: ParametersAxeFrame.11=Origine etichette Y: ParametersAxeFrame.12=Etichette ParametersAxeFrame.13=Dimensione: ParametersAxeFrame.14=Stile: ParametersAxeFrame.15=Mostra i marcatori su X ParametersAxeFrame.16=Mostra i marcatori su Y ParametersAxeFrame.17=Trattini PreferencesFrame.3=Percorso al tuo editor LaTeX: PreferencesFrame.4=Griglia standard PreferencesFrame.5=Griglia personale PreferencesFrame.6=Griglia magnetica PreferencesFrame.7=Intervallo: LaTeXDrawFrame.0=Disegna assi LaTeXDrawFrame.2=Ruota le figure selezionate. LaTeXDrawFrame.3=Ruota le figure selezionate di 90\u00B0. LaTeXDrawFrame.4=Ruota le figure selezionate di 180\u00B0. LaTeXDrawFrame.5=Ruota le figure selezionate di 270\u00B0. LaTeXDrawFrame.6=Inverti simmetricamente le figure. LaTeXDrawFrame.7=Inverti le figure selezionate orizzontalmente. LaTeXDrawFrame.8=Inverti le figure selezionate verticalmente. LaTeXDrawFrame.10=Mostra una griglia standard (in cm o pollici). LaTeXDrawFrame.11=Mostra una griglia con intervallo di ampiezza personalizzabile fra le linee guida. LaTeXDrawFrame.12=Contiene il parametro della griglia (magnetica) LaTeXDrawFrame.13=magnetica LaTeXDrawFrame.14=Se selezionato, le figure saranno agganciate alla griglia. LaTeXDrawFrame.15=Definisce l'intervallo fra le linee della griglia personale (in pixel). LaTeXDrawFrame.16=Disegna gliglia ed assi. LaTeXDrawFrame.17=Disegna assi. LaTeXDrawFrame.18=Esegui il tuo editor LaTeX. LaTeXDrawFrame.19=Esecuzione editor LaTeX... LaTeXDrawFrame.20=Devi definire il percorso del tuo editor LaTeX dal pannello delle preferenze. LaTeXDrawFrame.21=Il file selezionato non \u00E8 valido. LaTeXDrawFrame.22=Ridefinisci il percorso dal pannello delle preferenze. LaTeXDrawFrame.23=Chiudi LaTeXDrawFrame.25=Librerie LaTeXDrawFrame.26=Traduttori LaTeXDrawFrame.27=Note di release LaTeXDrawFrame.28=Licenza Axe.0=Nessuno Axe.2=Frame Axe.3=Completo Axe.4=Alto Axe.5=Basso Axe.1=Asse latexdraw-2.0.8+1.orig/lang/it/others.properties0000644000000000000000000000422011347255510016455 0ustar XScale.cm=cm XScale.inch=pollici LaTeXDrawException.valueInc=Valore incorretto LaTeXDrawException.invFile=Questo file non \u00E8 un file di LaTeXDraw\! LaTeXDrawException.invLaTeXDrawVer=Questa versione di LaTeXDraw non \u00E8 gestita\! LaTeXDrawException.invException=LaTeXDrawException: codice d'errore sconosciuto Arc.arc=Arco Arc.wedge=Cuneo Arc.chord=Corda Arc.arcType=Tipo di arco Figure.boundPos=Posizione del contorno DrawContainer.nameTemplate=Inserisci il nome del modello DrawContainer.overwriteTemplate=Questo modello esiste gi\u00E0: sovrascriverlo? CloseButton.closePanel=Chiudi il pannello UndoRedoManager.changeParams=Cambia i parametri UndoRedoManager.changeDispo=Cambia la disposizione UndoRedoManager.move=Sposta UndoRedoManager.delete=Elimina UndoRedoManager.create=Crea UndoRedoManager.join=Unisci UndoRedoManager.seperate=Separa UndoRedoManager.intCol=Cabia il colore dell'interno UndoRedoManager.bordCol=Cambia il colore del bordo UndoRedoManager.thick=Cambia lo spessore UndoRedoManager.style=Cambia lo stile UndoRedoManager.lArrow=Cambia lo stile della freccia sinistra UndoRedoManager.rArrow=Cambia lo stile della freccia destra UndoRedoManager.dotStyle=Cambia lo stile del punto UndoRedoManager.noRedo=Impossibile rifare UndoRedoManager.noUndo=Impossibile annullare UndoRedoManager.align=allineamento UndoRedoManager.distrib=distribuzione CodePanel.reload=Ricarica CodePanel.autoUpdate=Auto aggiorna CodePanel.copySel=Copia il testo selezionato CodePanel.copyAll=Copia tutto il codice CodePanel.tip=
Se selezionato, il codice \u00E8 aggiornato in tempo reale
Consiglio : Disabilita l'autoaggiornamento o non mostrare il pannello
del codice quando il disegno \u00E8 complesso
o stai muovendo una grande figura
CodePanel.updateCode=Aggiorna il codice CodePanel.addComment=Aggiungi commenti al codice CodePanel.reloadText=Codice PSTricks ricaricato\! CodePanel.copiedText=Codice PSTricks copiato nella clipboard\! CodePanel.copiedSelText=Selezione copiata nella clipboard\! SVGManager.0=Impossibile generare le figure dal documento SVG. UndoRedoManager.filled=Cambia lo stile per l'interno latexdraw-2.0.8+1.orig/lang/it/1_7.properties0000644000000000000000000000534111347255510015544 0ustar LaTeXDrawException.0=Immagine non valida. LaTeXDrawFrame.0=Ombra LaTeXDrawFrame.9=Seleziona colore dell'ombra LaTeXDrawFrame.1=Gradiente 1 LaTeXDrawFrame.2=Gradiente 2 LaTeXDrawFrame.4=Aggiungi un'ombra alla figura. LaTeXDrawFrame.5=Scegli il colore dell'ombra. LaTeXDrawFrame.6=Posizione figure nel disegno (davanti, dietro, ...). LaTeXDrawFrame.7=Scegli il primo colore del gradiente. LaTeXDrawFrame.8=Scegli il secondo colore del gradiente. ParametersTextFrame.0=Opacit\u00E0 ParametersTextFrame.1=Lista box ParametersTextFrame.2=Opaco ParametersTextFrame.3=Cerchio ParametersTextFrame.4=Rettangolo ParametersTextFrame.5=Triangolo ParametersTextFrame.6=Losanga ParametersTextFrame.7=Ellisse ParametersTextFrame.8=Box semplice ParametersTextFrame.9=Molte box ParametersGridFrame.0=Parametri della griglia ParametersTextFrame.10=Abilita le cornici ai box ParametersTextFrame.11=Aggiungi ParametersTextFrame.12=Modifica ParametersTextFrame.13=Elimina ParametersTextFrame.14=Separatore: ParametersTextFrame.15=Modifica box ParametersTextFrame.16=Considera dimensione box ParametersTextFrame.17=Se selezionato, lo shondo del testo sar\u00E0 opaco. ParametersTextFrame.18=Box corniciate ParametersTextFrame.20=Crea uno o molti bordi attorno al testo. ParametersTextFrame.21=Il box sar\u00E0 un rettangolo. ParametersTextFrame.22=Il box sar\u00E0 un triangolo. ParametersTextFrame.23=Crea un semplice box attorno a tutto il testo. ParametersTextFrame.24=Il box sar\u00E0 una ellisse. ParametersTextFrame.25=Il box sar\u00E0 un diamante. ParametersTextFrame.26=Crea varie box attorno a porzioni differenti del testo. ParametersTextFrame.27=Il box sar\u00E0 un cerchio. ParametersTextFrame.28=Aggiungi un nuovo box. ParametersTextFrame.29=Modifica la posizione del box selezionato. ParametersTextFrame.30=Rimuovi il box selezionato. ParametersTextFrame.31=Cambia lo spazio fra il box ed il testo. ParametersTextFrame.32=Se selezionato, il box non sar\u00E0 disegnato sul testo all'inizio ed alla fine del testo bordato. ParametersTextFrame.33=Apri il pannello dei parametri del box per modificarlo. ParametersTextFrame.34=Selezione testo ParametersTextFrame.35=Seleziona il testo da corniciare: ParametersTextFrame.36=Selezione testo ParametersTextFrame.37=Box non valido; si sovrappone ad un altro box. AbstractParametersFrame.0=Dimensioni/Posizione AbstractParametersFrame.1=Ombra dell'angolo AbstractParametersFrame.2=Dimensione ombra AbstractParametersFrame.3=Angolo gradiente AbstractParametersFrame.4=Punto medio AbstractParametersFrame.6=Altro AbstractParametersFrame.7=Angolo arrotondato: AbstractParametersFrame.8=Tratteggio AbstractParametersFrame.9=Linea doppia AbstractParametersFrame.11=Riempimento AbstractParametersFrame.12=Gradiente BatchConvertFrame.0=nelle stesse cartelle latexdraw-2.0.8+1.orig/lang/de/0000755000000000000000000000000011347255510013011 5ustar latexdraw-2.0.8+1.orig/lang/de/1_9.properties0000644000000000000000000001056511347255510015526 0ustar LaTeXDrawFrame.0=Letzte Dateien LaTeXDrawFrame.1=Zeichne geschlossene B\u00E9zier Kurve LaTeXDrawFrame.2=L\u00F6sche alle LaTeXDrawFrame.3=Tastenkombinationen LaTeXDrawFrame.4=Nach Update pr\u00FCfen LaTeXDrawFrame.5=Formen LaTeXDrawFrame.6=Alle Figuren sichtbar machen LaTeXDrawFrame.7=Wenn eine Figur Koordinaten unter (0,0) hat, ist sie nicht sichtbar.
Diese Taste setzt alle Figuren, dass sie sichtbar sind. LaTeXDrawFrame.8=Die Eigenschaften des Handlers definieren. LaTeXDrawFrame.9=Deckkraft des Handler LaTeXDrawFrame.10=Die Transparenz des Handlers definieren. LaTeXDrawFrame.11=Geschlossene B\u00E9zier Kurve zeichnen LaTeXDrawFrame.12=\u00DCberpr\u00FCen Sie, dass die Version des Java Runtime Environment, dass
Sie verwendet haben um diese Datei zu erzeugen, die gleiche ist, die sie momentan verwenden. LaTeXDrawFrame.13=Das Hilfe Verzeichnis ist nicht erreichbar, die Hilfe Seite kann nicht geladen werden. LaTeXDrawFrame.14=Die Hilfe Seite kann nicht erstellt werden. PSTricksParser.0=begin{center} muss Ausserhalb von begin{pspicture}...end{pspicture} sein PSTricksParser.1=end{center} muss Ausserhalb von begin{pspicture}...end{pspicture} sein PSTricksParser.2=end{figure} muss Ausserhalb von begin{pspicture}...end{pspicture} sein PSTricksParser.3=end{pspicture} oder pspicture nicht gefunden. DrawPanel.0=Figuren am Gitter ausrichten ParametersAkinPointsFrame.0=Punkte Intervall: ParametersAkinPointsFrame.1=\u00D6ffnen ParametersAkinPointsFrame.2=Typ: ParametersAkinPointsFrame.3=Freihand Parameter ParametersBezierCurveFrame.2=Ausgleichen ParametersBezierCurveFrame.3=Kontrollpunkte in Beziehung auf die Punkte ausgleichen. ParametersBezierCurveFrame.4=Abstand: ParametersBezierCurveFrame.5=Den Abstand zwischen dem Kontrollpunkt und dem Punkt beim Ausgleichen definieren. ParametersBezierCurveFrame.6=X 1er ctrl pt ParametersBezierCurveFrame.7=Y 1er ctrl pt ParametersBezierCurveFrame.8=X 2er ctrl pt ParametersBezierCurveFrame.9=Y 2er ctrl pt PreferencesFrame.0=Anzahl zuletzt ge\u00F6ffneter Dateien: PreferencesFrame.1=Theme (neustart erforderlich): ShortcutsFrame.1=Sequenz ShortcutsFrame.3=Kategorie ShortcutsFrame.4=Navigation ShortcutsFrame.5=Transformation ShortcutsFrame.6=Zeichnung ShortcutsFrame.7=\ (grosse Bewegung) ShortcutsFrame.8=Linksklick ShortcutsFrame.9=Verschiebe die horizontale Bildlaufleiste nach rechts ShortcutsFrame.10=Verschiebe die horizontale Bildlaufleiste nach links ShortcutsFrame.11=Verschiebe die vertikale Bildlaufleiste nach oben ShortcutsFrame.12=Verschiebe die vertikale Bildlaufleiste nach unten ShortcutsFrame.14=Gehe zum Ende der horizontalen Bildlaufleiste ShortcutsFrame.15=Gehe zum Anfang der horizontalen Bildlaufleiste ShortcutsFrame.16=Gehe zum oberen Teil der vertikalen Bildlaufleiste ShortcutsFrame.17=Gehe zum unteren Teil der vertikalen Bildlaufleiste ShortcutsFrame.18=Verschiebe die ausgew\u00E4hlte Figur nach rechts ShortcutsFrame.19=Verschiebe die ausgew\u00E4hlte Figur nach links ShortcutsFrame.20=Verschiebe die ausgew\u00E4hlte Figur nach oben ShortcutsFrame.21=Verschiebe die ausgew\u00E4hlte Figur nach unten ShortcutsFrame.23=Richte die ausgew\u00E4hlten Figuren am dargestellten Gitter aus ShortcutsFrame.25=Alle Figuren der Zeichnung ausw\u00E4hlen ShortcutsFrame.26=Die angeklickte Figur zur Auswahl hinzuf\u00FCgen ShortcutsFrame.27=Die angeklickte Figur aus der Auswahl entfernen ShortcutsFrame.28=N\u00E4chste oder die erste Figur ausw\u00E4hlen (nur im Auswahlmodus) ShortcutsFrame.29=Mausrad ShortcutsFrame.30=Zoom in/out MenusListener.0=Die linke Taste dr\u00FCcken und die Maus bewegen um den zweiten Punkt zu setzen. Taste loslassen, um den Vorgang abzuschliessen. MenusListener.1=Linksklick um ein Punkt huzuzuf\u00FCgen, Rechtsklick oder ein doppelter Linksklick um den letzten Punkt zu setzen und den Vorgang abzuschliessen. MenusListener.4=Die Linke Taste dr\u00FCcken und die Maus bewegen um den letzten Punkt zu setzen. Taste loslassen um den Vorgang abzuschliessen. MenusListener.5=Ein Linksklick f\u00FCgt Text hinzu. MenusListener.6=Ein Linksklick f\u00FCgt ein Gitter hizu. MenusListener.7=Ein Linksklick f\u00FCgt Achsen hinzu. MenusListener.8=Linke Taste dr\u00FCcken und die Maus bewegen, um die Form zu Zeichnen. Loslassen der Taste beendet den Vorgang. MenusListener.9=Ein Linksklick f\u00FCgt einen Punkt hinzu. RecentFilesListener.0=Kein Zugriff auf die Datei. RecentFilesListener.1=Datei kann nicht ge\u00F6ffnet werden latexdraw-2.0.8+1.orig/lang/de/LaTeXDrawFrame.properties0000644000000000000000000002257211347255510017705 0ustar LaTeXDrawFrame.0=\ Hilfe LaTeXDrawFrame.1=\u00DCber LaTeXDrawFrame.2=Linie Zeichnen LaTeXDrawFrame.3=Rechteck zeichnen LaTeXDrawFrame.4=Punkt zeichnen LaTeXDrawFrame.5=Quadrat zeichnen LaTeXDrawFrame.6=Rhombus zeichnen LaTeXDrawFrame.7=Freihand LaTeXDrawFrame.8=Dreieck zeichnen LaTeXDrawFrame.9=Kreis zeichnen LaTeXDrawFrame.10=Gitter zeichnen LaTeXDrawFrame.11=Ellipse zeichnen LaTeXDrawFrame.12=Polygon zeichnen LaTeXDrawFrame.13=Figur(en) ausw\u00E4hlen LaTeXDrawFrame.14=Grenzen anzeigen LaTeXDrawFrame.15=Grenzen automatisch anpassen LaTeXDrawFrame.16=Exportieren als... LaTeXDrawFrame.17=Figur l\u00F6schen LaTeXDrawFrame.18=Beenden LaTeXDrawFrame.19=PSTricks Code LaTeXDrawFrame.20=JPEG Bild LaTeXDrawFrame.21=EPS Bild LaTeXDrawFrame.22=Wiederherstellen LaTeXDrawFrame.23=R\u00FCckg\u00E4ngig LaTeXDrawFrame.25=Projekt speichern LaTeXDrawFrame.26=Projekt speichern als LaTeXDrawFrame.27=\u00D6ffne Projekt LaTeXDrawFrame.28=Neues Projekt LaTeXDrawFrame.29=Code drucken LaTeXDrawFrame.30=Zeichnung drucken LaTeXDrawFrame.31=Behind a figure LaTeXDrawFrame.32=In front of a figure LaTeXDrawFrame.33=Gruppe LaTeXDrawFrame.34=Unterteilen LaTeXDrawFrame.35=Bogen zeichnen LaTeXDrawFrame.36=Kreissektor zeichnen LaTeXDrawFrame.37=Kreissegment zeichnen LaTeXDrawFrame.38=X-Massstab LaTeXDrawFrame.39=Y-Massstab LaTeXDrawFrame.40=Kopieren LaTeXDrawFrame.41=Vorlagen aktualisieren LaTeXDrawFrame.42=Als Vorlage exportieren LaTeXDrawFrame.43=Einf\u00FCgen LaTeXDrawFrame.44=Ausschneiden LaTeXDrawFrame.45=Standard Gitter LaTeXDrawFrame.46=Code Feld LaTeXDrawFrame.47=R\u00E4nder LaTeXDrawFrame.48=Innenraum LaTeXDrawFrame.49=Hatchings LaTeXDrawFrame.51=gef\u00FCllt LaTeXDrawFrame.53=Figur Eigenschaften LaTeXDrawFrame.55=Kommentare hinzuf\u00FCgen LaTeXDrawFrame.56=Einstellungen LaTeXDrawFrame.57=Hineinzoomen LaTeXDrawFrame.58=Herauszoomen LaTeXDrawFrame.60=Text hinzuf\u00FCgen LaTeXDrawFrame.61=Vordergrund LaTeXDrawFrame.62=Hintergrund LaTeXDrawFrame.63=B\u00E9zier Kurve zeichnen LaTeXDrawFrame.64=Figur drehen LaTeXDrawFrame.65=Change the thickness of the figure LaTeXDrawFrame.66=Linienfarbe der Figur \u00E4ndern LaTeXDrawFrame.67=If selected, the figure will be filled LaTeXDrawFrame.68=F\u00FCllfarbe der Figur \u00E4ndern LaTeXDrawFrame.69=\u00C4ndere die Farbe der Schraffur LaTeXDrawFrame.70=Figur in den Vordergund verschieben LaTeXDrawFrame.71=Figur in den Hintergrund verschieben LaTeXDrawFrame.72=Select the figure which will be behind the selected figure LaTeXDrawFrame.73=Die Figur ausw\u00E4hlen, die vor der ausgew\u00E4hlten Figur sein wird LaTeXDrawFrame.74=Wenn aktiviert, kann die Figur mit der Maus rotiert werden LaTeXDrawFrame.75=Mehrere Figuren gruppieren LaTeXDrawFrame.76=Mehrere Figuren separieren LaTeXDrawFrame.77=Die Position der Grenzen der Figur festlegen LaTeXDrawFrame.78=If selected, the figure will have double borders LaTeXDrawFrame.79=\u00C4ndere die Farbe des Bereichs zwischen den doppelten R\u00E4ndern LaTeXDrawFrame.80=\ Dicke LaTeXDrawFrame.82=Ein Fehler ist w\u00E4hrend der Ausf\u00FChrung von LaTeXDraw aufgetreten:
LaTeXDrawFrame.83=LaTeXDraw kann nicht gestartet werden LaTeXDrawFrame.86=LaTeXDraw Fehler LaTeXDrawFrame.88=Datei LaTeXDrawFrame.89=Bearbeiten LaTeXDrawFrame.90=Anzeigen LaTeXDrawFrame.91=Zeichnen LaTeXDrawFrame.92=Code LaTeXDrawFrame.93=Hilfe LaTeXDrawFrame.94=Zeichnung hinein zoomen LaTeXDrawFrame.95=Zeichnung heraus zoomen LaTeXDrawFrame.96=Zoom 100% LaTeXDrawFrame.103=Vorlagen LaTeXDrawFrame.105=Nicht m\u00F6glich das Vorlagenmenu zu erzeugen\! LaTeXDrawFrame.107=Werkzeugleiste LaTeXDrawFrame.108=Ein neues Projekt erstellen LaTeXDrawFrame.109=Ein Projekt \u00F6ffnen LaTeXDrawFrame.110=Projekt speichern LaTeXDrawFrame.113=100% LaTeXDrawFrame.114=Eine Aktion r\u00FCckg\u00E4ngig machen LaTeXDrawFrame.115=Eine Aktion wiedeholen LaTeXDrawFrame.116=Eine Linie zeichnen LaTeXDrawFrame.117=Einen Punkt zeichnen LaTeXDrawFrame.118=Draw a rectangular shape LaTeXDrawFrame.119=Ein Rechteck zeichnen LaTeXDrawFrame.120=Ein Quadrat zeichnen LaTeXDrawFrame.121=Ein Polygon zeichnen LaTeXDrawFrame.123=Einen Rhombus zeichnen LaTeXDrawFrame.124=Ein Dreieck zeichnen LaTeXDrawFrame.125=Eine Ellipse zeichnen LaTeXDrawFrame.127=Einen Kreis zeichnen LaTeXDrawFrame.128=Einen Bogen zeichnen LaTeXDrawFrame.130=Einen Kreissektor zeichnen LaTeXDrawFrame.131=Ein Kreissegment zeichnen LaTeXDrawFrame.132=B\u00E9zier Kurve zeichnen LaTeXDrawFrame.133=Ein Gitter zeichnen LaTeXDrawFrame.136=Eine oder mehrere Figuren ausw\u00E4hlen
LaTeXDrawFrame.137=Piece of advice : to select several LaTeXDrawFrame.138=figures, click and
drag the mouse on the figures you want LaTeXDrawFrame.139=Delete the selected figure(s) LaTeXDrawFrame.140=\u00C4ndere die Eigenschaften der Figur LaTeXDrawFrame.141=R\u00E4nder der Zeichnung anzeigen
LaTeXDrawFrame.142=Tipp: wenn Sie die Grenzend der Zeichnung
LaTeXDrawFrame.143=anzeigen, deaktivieren Sie die autoaktualisierung der Grenzen
LaTeXDrawFrame.144=um die Gr\u00F6sse der Zeichnung zu \u00E4ndern LaTeXDrawFrame.146=Kopiert... LaTeXDrawFrame.147=Eingef\u00FCgt... LaTeXDrawFrame.148=Ausgeschnitten... LaTeXDrawFrame.149=Gel\u00F6scht... LaTeXDrawFrame.151=Farbe der doppelten R\u00E4nder ausw\u00E4hlen LaTeXDrawFrame.154=Gruppiert... LaTeXDrawFrame.155=Separated... LaTeXDrawFrame.156=Wollen Sie dieses Projekt speichern? LaTeXDrawFrame.158=Wiederhohlen... LaTeXDrawFrame.159=R\u00FCckg\u00E4ngig... LaTeXDrawFrame.160=Vorlagen aktualisiert LaTeXDrawFrame.161=Error for file LaTeXDrawFrame.162=Printing the drawing... LaTeXDrawFrame.163=Zeichnung wurde gedruckt\! LaTeXDrawFrame.164=Nicht m\u00F6glich die Zeichnung zu drucken\! LaTeXDrawFrame.165=Code drucken... LaTeXDrawFrame.166=Code wurde gedruckt\! LaTeXDrawFrame.167=Nicht m\u00F6glich den Code zu drucken\! LaTeXDrawFrame.168=Exporting as template... LaTeXDrawFrame.169=Vorlage exportiert LaTeXDrawFrame.170=Als PSTricks Code exportieren... LaTeXDrawFrame.171=Ausw\u00E4hlen LaTeXDrawFrame.172=PSTricks Code als TeX Datei exportieren LaTeXDrawFrame.173=Wollen Sie die Datei ersetzen? LaTeXDrawFrame.174=Als PSTricks exportieren LaTeXDrawFrame.175=PSTricks Code wurde exportiert\! LaTeXDrawFrame.176=Nicht m\u00F6glich als PSTricks Code zu exportieren\! LaTeXDrawFrame.177=Als Bild exportieren... LaTeXDrawFrame.179=Figuren exportieren als LaTeXDrawFrame.182=Exportieren als LaTeXDrawFrame.183=\ Datei LaTeXDrawFrame.184=Exportieren als Bild erfolgreich LaTeXDrawFrame.185=Nicht m\u00F6glich als Bild zu exportieren LaTeXDrawFrame.186=Projekt wird gespeichert... LaTeXDrawFrame.188=Zeichnung speichern LaTeXDrawFrame.190=Als JPEG Datei exportieren LaTeXDrawFrame.191=Projekt gespeichert\! LaTeXDrawFrame.192=Nicht m\u00F6glich das Projekt zu speichern\! LaTeXDrawFrame.193=Es ist ein Fehler w\u00E4hrend dem Speichern einer Datei aufgetreten:
LaTeXDrawFrame.197=Creation of a new project... LaTeXDrawFrame.198=Neues Projekt erzeugt LaTeXDrawFrame.200=Eine Zeichnung \u00F6ffnen LaTeXDrawFrame.201=Datei wird ge\u00F6ffnet... LaTeXDrawFrame.202=Datei ge\u00F6ffnet\! LaTeXDrawFrame.203=Not able to open file! LaTeXDrawFrame.204=Es ist ein Fehler w\u00E4hrend dem \u00D6ffnen einer Datei aufgetreten:
LaTeXDrawFrame.208=
Version LaTeXDrawFrame.209= released! LaTeXDrawFrame.210=Neue Version LaTeXDrawFrame.211=Neue Version vorhanden\! LaTeXDrawFrame.212=Keine neue Version LaTeXDrawFrame.213=Unable to check if a new version exists! LaTeXDrawFrame.215=LaTeXDraw Hilfe LaTeXDrawFrame.218=Ein PSTricks Code Generator f\u00FCr LaTeX\! LaTeXDrawFrame.219=Version LaTeXDrawFrame.220=, build LaTeXDrawFrame.221= is distributed under the terms of the GNU General Public License LaTeXDrawFrame.222= as published by the Free Software Foundation (version 2) LaTeXDrawFrame.229=Importieren... LaTeXDrawFrame.230=Aus TeX Datei LFrame2.0=Definiere die Gr\u00F6sse eines Punktes. LFrame2.1=Ausgew\u00E4hlte Figuren in eine Linie bringen. LFrame2.10=Distribute vertically, at equal distance between, the selected figures. LFrame2.11=Distribute vertically at equal distance between the middle of the selected figures. LFrame2.12=Distribute vertically at equal distance between the top sides of the selected figures. LFrame2.13=Distribute horizontally at equal distance between the left sides of the selected figures. LFrame2.14=Distribute horizontally, at equal distance between, the selected figures. LFrame2.15=Distribute horizontally at equal distance between the middle of the selected figures. LFrame2.16=Distribute horizontally at equal distance between the right sides of the selected figures. LFrame2.17=Farben LFrame2.18=Unm\u00F6glich die Datei zu \u00F6ffnen. LFrame2.19=Diese Vorlage kann nicht gefunden werden LFrame2.2=Align on the left the selected figures. LFrame2.20=Please, update the templates menu LFrame2.21=Vorlage nicht gefunden LFrame2.22=Das Dokument kann nicht gedruckt werden LFrame2.23=Kein Drucker gefunden LFrame2.25=Die GPL Bibliothek jlibeps wird verwendet um EPS Bilder zu erzeugen. LFrame2.3=Align on the right the selected figures. LFrame2.4=Align on the top the selected figures. LFrame2.5=Align on the bottom the selected figures. LFrame2.6=Align horizontally in the middle the selected figures. LFrame2.7=Align vertically in the middle the selected figures. LFrame2.8=Distribute at equal distance the selected figures. LFrame2.9=Distribute vertically, at equal distance between the bottom sides of the selected figures. LFrame2.26=Neues Projekt mit Auswahl latexdraw-2.0.8+1.orig/lang/de/1_6.properties0000644000000000000000000000715411347255510015523 0ustar BatchConvertFrame.1=Unterordner hinzuf\u00FCgen BatchConvertFrame.2=Dateien hinzuf\u00FCgen BatchConvertFrame.4=Alle entfernen BatchConvertFrame.5=\u00DCberschreiben BatchConvertFrame.6=Pfad w\u00E4hlen BatchConvertFrame.7=Format ausw\u00E4hlen BatchConvertFrame.8=Konvertieren BatchConvertFrame.9=Stopp BatchConvertFrame.11=Batch Liste BatchConvertFrame.12=Verzeichnis w\u00E4hlen BatchConvertFrame.13=Bilder w\u00E4hlen BatchConvertFrame.14=Konvertieren als: LaTeXDrawFrame.0=PSTricks Code einf\u00FCgen LaTeXDrawFrame.1=Bild einf\u00FCgen LaTeXDrawFrame.2=Bilder konvertieren LaTeXDrawFrame.3=stopp LaTeXDrawFrame.4=Verbundene Linien zeichnen LaTeXDrawFrame.5=PPM Bild LaTeXDrawFrame.6=BMP Bild LaTeXDrawFrame.7=PNG Bild LaTeXDrawFrame.9=Parsing stoppen\! LaTeXDrawFrame.10=Einf\u00FCgen LaTeXDrawFrame.11=Mehrere Figuren aus PSTricks Code einf\u00FCgen LaTeXDrawFrame.14=Mehrere verbundene Linien zeichnen LaTeXDrawFrame.15=PSTricks Datei wird importiert... LaTeXDrawFrame.16=Der aktuelle PSTricks Parser verarbeitet nur einige Befehle.
Sie k\u00F6nnen nur von LaTeXDraw unterst\u00FCtzte Befehle importieren. LaTeXDrawFrame.17=Einen PSTricks Code importieren LaTeXDrawFrame.18=Diese Software verwendet JIU, the Java Imaging Utilities. Ver\u00F6ffentlicht unter LaTeXDrawFrame.19=den Bedingungen der GNU General Public License. http://schmidt.devlib.org/jiu/ LaTeXDrawFrame.23=Warnung:
  • PSTricks kann keine JPG, BMP, ... Dateien einf\u00FCgen; es wird eine EPS Datei vom ausgew\u00E4hlten Bild im gleichen Verzeichnis erstellt
    Das Bild wird nur eingef\u00FCgt, wenn Sie Schreibrechte f\u00FCr das Verzeichnis haben;
  • TeX unterst\u00FCtzt keine Leerzeichen in Pfadangaben, kontrollieren Sie, dass Sie keine Leerzeichen im Pfad haben.
LaTeXDrawFrame.25=Bild laden... LaTeXDrawFrame.26=Das Bild ist ung\u00FCltig\! LaTeXDrawFrame.27=Es ist nicht m\u00F6glich das Bild zu laden\! LaTeXDrawFrame.28=Bild eingef\u00FCgt\! LaTeXDrawFrame.30=In der Datei ist keine Figur, die importiert werden k\u00F6nnte\!
Pr\u00FCfen Sie, dass sie mit begin{pspicture} ...end{pspicture} umschlossen sind.
Sie k\u00F6nnen die Datei an LaTeXDrawFrame.31=\ senden, wenn Sie denken, dass es einen Fehler im PSTricks Parser hat. LaTeXDrawFrame.32=Keine Figuren gefunden\! LaTeXDrawFrame.33=Keine Figuren zum importieren gefunden\! LaTeXDrawFrame.34=Es ist nicht m\u00F6glich das PSTricks file zu importieren\! LaTeXDrawFrame.35=Import abgebrochen\! LaTeXDrawFrame.36=Code wurde in Figuren umgewandelt\! InsertPSTricksCodeFrame.0=Figuren aus PSTricks Code einf\u00FCgen FatalErrorParsingException.0=
Falls die Datei g\u00FCltig ist k\u00F6nnen Sie sie an arno_b@users.sourceforge.net senden Picture.0=% Warnung: der Pfad des folgenden Bildes enth\u00E4llt Leerzeichen und wird nicht von TeX kompiliert\! ParserCmdMessage.0=Linie ParserCmdMessage.1=Befehl: ParserCmdMessage.2=Ausnahme: ParserMessagesFrame.0=Befehl ParserMessagesFrame.1=Linie ParserMessagesFrame.2=Ausnahme ParserMessagesFrame.3=Eine oder mehrere Warnungen sind w\u00E4hrend des Parsings aufgetreten ParserMessagesFrame.4=TeX Parser: Warnung(en) ParametersGridFrame.0=Invertiere Label Position X folgend ParametersGridFrame.1=Invertiere Label Position Y folgend PSTricksParser.0=Fehler w\u00E4hrend des \u00D6ffnens der Datei: ung\u00FCltige Datei\! PSTricksParser.1=Die inkrementelle Definition von pspicture wird noch nicht unterst\u00FCtzt:
PSTricksParser.2=begin{pspicture}...begin{pspicture} ... end{pspicture}... PSTricksParser.3=Fehler beim Parsen der Datei \! latexdraw-2.0.8+1.orig/lang/de/dialogFrames.properties0000644000000000000000000001201711347255510017525 0ustar PreferencesFrame.Pref=Einstellungen... PreferencesFrame.grid=Tabellengitter PreferencesFrame.codePanel=Code Feld PreferencesFrame.antiAl=Antialiasing PreferencesFrame.rendQ=Render Qualit\u00E4t PreferencesFrame.colRendQ=Farbrender Qualit\u00E4t PreferencesFrame.AlphaQ=Alpha Interpolation Qualit\u00E4t PreferencesFrame.bordersDraw=R\u00E4nder der Zeichnung PreferencesFrame.codeAuto=Code autoupdate (langsamer) PreferencesFrame.newVers=Beim Start auf neue Version pr\u00FCfen PreferencesFrame.lge=Sprache (Neustart n\u00F6tig) PreferencesFrame.general=Allgemein PreferencesFrame.folders=Ordner PreferencesFrame.quality=Qualit\u00E4t PreferencesFrame.selectFolder=Ordner ausw\u00E4hlen PreferencesFrame.defOpenSave=Standard Ordner f\u00FCr \u00F6ffnen/speichern aktionen: PreferencesFrame.defFold=Standard Ordner f\u00FCr import/export aktionen: PreferencesFrame.errorReadPref=Fehler w\u00E4hrend dem lesen der Einstellungs Datei\! PreferencesFrame.prefSaved=Einstellungen gespeichert\! DrawPropertiesFrame.0=Beschriftung der Zeichnung DrawPropertiesFrame.1=Beschriftung der Zeichnung DrawPropertiesFrame.2=Zeichnung Eigenschaften DrawPropertiesFrame.3=Pixels pro DrawPropertiesFrame.5=Auf einer Seite mit nur Floats DrawPropertiesFrame.6=Am Anfang der Seite DrawPropertiesFrame.7=Am Ende der Seite DrawPropertiesFrame.8=Hier DrawPropertiesFrame.9=HIER\! DrawPropertiesFrame.10=In der Mitte der Seite DrawPropertiesFrame.11=Vertikale Position der Zeichnung DrawPropertiesFrame.12=Horizontale Position der Zeichnung DrawPropertiesFrame.13=Anzahl der Pixel pro L\u00E4ngeneinheit \u00E4ndern ExceptionFrameDialog.0=Report Senden ExceptionFrameDialog.1=Es ist ein Fehler aufgetreten\!
ExceptionFrameDialog.2=
Sie k\u00F6nnen einen Report an den LaTeXDraw Entwickler senden ExceptionFrameDialog.3=LaTeXDraw Fehler: eine Ausnahme ist aufgetreten ExceptionFrameDialog.4=Es ist Fehler aufgetreten:
ExceptionFrameDialog.5=Nicht m\u00F6glich einen ExceptionFrameDialog zu erzeugen AbstractParametersFrame.0=Double boundary AbstractParametersFrame.2=Trennzeichen: AbstractParametersFrame.3=Allgemeine Parameter AbstractParametersFrame.4=Ok AbstractParametersFrame.5=Standard AbstractParametersFrame.6=Abbrechen AbstractParametersFrame.7=Rotationswinkel AbstractParametersFrame.8=Dicke: AbstractParametersFrame.10=Linientyp AbstractParametersFrame.11=Hatchings Width: AbstractParametersFrame.12=Linker Pfeil: AbstractParametersFrame.13=Rechter Pfeil: AbstractParametersFrame.14=Pfeile Parameter AbstractParametersFrame.15=Show ctrl points AbstractParametersFrame.16=Rounded AbstractParametersFrame.17=X-center Koordinaten: AbstractParametersFrame.18=Y-center Koordinaten: AbstractParametersFrame.19=Radius: AbstractParametersFrame.20=Punkt Durchmesser = AbstractParametersFrame.21=Bar width = AbstractParametersFrame.22=Bracket length = AbstractParametersFrame.23=Rounded bracket lgth = AbstractParametersFrame.24=x thickness + AbstractParametersFrame.25=x Breite AbstractParametersFrame.26=Pfeil L\u00E4nge AbstractParametersFrame.27=Pfeil Inset AbstractParametersFrame.28=Pfeil Breite AbstractParametersFrame.29=X-Koordinaten: AbstractParametersFrame.30=Y-Koordinaten: AbstractParametersFrame.31=Breite: AbstractParametersFrame.32=H\u00F6he: AbstractParametersFrame.33=Paramter der Form AbstractParametersFrame.34=Select hatchings color AbstractParametersFrame.35=Select double boundary color AbstractParametersFrame.36=Randfarben w\u00E4hlen AbstractParametersFrame.37=F\u00FCllfarbe w\u00E4hlen AbstractParametersFrame.38=Pfeile ParametersArcFrame.0=Anfangswinkel: ParametersArcFrame.1=Endwinkel: ParametersArcFrame.2=Typ des Bogens: ParametersDotFrame.0=Typ des Punktes: ParametersDrawFrame.0=Nord-West X ParametersDrawFrame.1=Nord-West Y ParametersDrawFrame.2=S\u00FCd-Ost X ParametersDrawFrame.3=S\u00FCd-Ost Y ParametersGridFrame.0=Y Ursprung: ParametersGridFrame.1=X Ursprung ParametersGridFrame.2=Beschriftungen: ParametersGridFrame.3=Einheit: ParametersGridFrame.4=Subgrid dots: ParametersGridFrame.5=Gitter Punkte ParametersGridFrame.6=Gitter Breite: ParametersGridFrame.7=Untergitter Breite: ParametersGridFrame.8=Subgrid division: ParametersGridFrame.9=Label Gr\u00F6sse ParametersLineFrame.0=Linke X-Koordinaten: ParametersLineFrame.1=Linke Y-Koordinaten: ParametersLineFrame.2=Rechte X-Koordinaten: ParametersLineFrame.3=Rechte Y-Koordinaten: ParametersTextFrame.0=Fett ParametersTextFrame.1=Kursiv ParametersTextFrame.2=Schriftart: ParametersTextFrame.3=Gr\u00F6sse: ParametersTextFrame.4=Text ParametersGridFrame.10=Untergitter: ParametersGridFrame.11=X max: ParametersGridFrame.12=X min: ParametersGridFrame.13=Y max: ParametersGridFrame.14=Y min: ParametersGridFrame.15=Zeichne Labels: ParametersGridFrame.17=Labelfarbe w\u00E4hlen ParametersGridFrame.18=Untergitter Farbe w\u00E4hlen ParametersPolygonFrame.1=Punkt n\u00B0 ParametersTriangleFrame.0=Base center X-coord: ParametersTriangleFrame.1=Base center Y-coord: ParamsBC.0=Alle bewegen ParamsBC.1=If not selected, when you move a point its control points are moved too. ExportDialog.0=Komprimierung latexdraw-2.0.8+1.orig/lang/de/1_8.properties0000644000000000000000000000460711347255510015525 0ustar UndoRedoManager.0=Transformation AbstractParametersFrame.0=Intervall: ParametersAxeFrame.0=Form: ParametersAxeFrame.1=Ursprung zeigen ParametersAxeFrame.2=Achsen ParametersAxeFrame.3=X-Labels anzeigen ParametersAxeFrame.4=Y-Labels anzeigen ParametersAxeFrame.5=Abstand zwischen Labels festlegen (cm) ParametersAxeFrame.6=X-Labels Abstand: ParametersAxeFrame.7=Y-Labels Abstand: ParametersAxeFrame.8=X-Labels Inkrement: ParametersAxeFrame.9=Y-Labels Inkrement: ParametersAxeFrame.10=X-Labels Ursprung: ParametersAxeFrame.11=Y-Labels Ursprung: ParametersAxeFrame.12=Labels ParametersAxeFrame.13=Gr\u00F6sse: ParametersAxeFrame.14=Stil: ParametersAxeFrame.15=X-Ticks anzeigen ParametersAxeFrame.16=Y-Ticks anzeigen ParametersAxeFrame.17=Ticks PreferencesFrame.3=Pfad des LaTeX Editors: PreferencesFrame.4=Standard Gitter PreferencesFrame.5=Benutzerdefiniertes Gitter PreferencesFrame.6=Magnetisches Gitter PreferencesFrame.7=Intervall: LaTeXDrawFrame.0=Achsen zeichnen LaTeXDrawFrame.2=Ausgew\u00E4hlte Figur(en) rotieren. LaTeXDrawFrame.3=Ausgew\u00E4hlte Figur(en) um 90\u00B0 rotieren. LaTeXDrawFrame.4=Ausgew\u00E4hlte Figur(en) um 180\u00B0 rotieren. LaTeXDrawFrame.5=Ausgew\u00E4hlte Figur(en) um 270\u00B0 rotieren. LaTeXDrawFrame.6=Reverse figures by symmetry. LaTeXDrawFrame.7=Ausgew\u00E4hlte Figuren horizontal spiegeln LaTeXDrawFrame.8=Ausgew\u00E4hlte Figuren vertikal spiegeln LaTeXDrawFrame.10=Ein standard Gitter darstellen (in cm oder in inch). LaTeXDrawFrame.11=Ein ver\u00E4nderbares Gitter darstellen. LaTeXDrawFrame.12=Enth\u00E4llt die Parameter des (magnetischen) Gitters LaTeXDrawFrame.13=magnetisch LaTeXDrawFrame.14=Wenn aktiviert, werden die Figuren magnetisch zum Gitter sein. LaTeXDrawFrame.15=Das Intervall zwischen den Linien des benutzerdefinierten Gitters festlegen (in pixeln). LaTeXDrawFrame.16=Draw grids and axes. LaTeXDrawFrame.17=Achsen zeichnen. LaTeXDrawFrame.18=LaTeX Editor ausf\u00FChren. LaTeXDrawFrame.19=Ihr LaTeXDraw Editor ausf\u00FChren... LaTeXDrawFrame.20=Sie m\u00FCssen den Pfad zu Ihrem LaTeX Editor im Einstellungs Men\u00FC festlegen. LaTeXDrawFrame.21=Die ausgew\u00E4hlte Datei ist ung\u00FCltig. LaTeXDrawFrame.22=Redefine the path in the panel of preferences. LaTeXDrawFrame.23=Schliessen LaTeXDrawFrame.25=Bibliotheken LaTeXDrawFrame.26=\u00DCbersetzer LaTeXDrawFrame.27=Release Note LaTeXDrawFrame.28=Lizenz Axe.0=Keine Axe.1=Achse Axe.2=Rahmen Axe.3=Voll Axe.4=Oben Axe.5=Unten latexdraw-2.0.8+1.orig/lang/de/others.properties0000644000000000000000000000440211347255510016433 0ustar XScale.cm=cm XScale.inch=Zoll LaTeXDrawException.valueInc=Ung\u00FCltiger Wert LaTeXDrawException.invFile=Dies ist keine LaTeXDraw-Datei\! LaTeXDrawException.invLaTeXDrawVer=Diese Version von LaTeXDraw wird nicht unterst\u00FCtzt. LaTeXDrawException.invException=LatexDrawAusnahme: unbekannter Fehlercode Arc.arc=Kreisbogen Arc.wedge=Kreissektor Arc.chord=Kreissegment Arc.arcType=Eine Art Bogen Figure.boundPos=Position der Begrenzung DrawContainer.nameTemplate=Name der Vorlage eingeben DrawContainer.overwriteTemplate=Diese Vorlage exisiert bereits; \u00FCberschreiben? CloseButton.closePanel=Feld schlie\u00DFen UndoRedoManager.changeParams=Parameter \u00E4ndern UndoRedoManager.changeDispo=Disposition \u00E4ndern UndoRedoManager.move=Bewegen UndoRedoManager.delete=L\u00F6schen UndoRedoManager.create=Erstellen UndoRedoManager.join=Zusammenf\u00FCgen UndoRedoManager.seperate=Unterteilen UndoRedoManager.filled=Einrichtungsstil ver\u00E4ndern UndoRedoManager.intCol=F\u00FCllfarbe \u00E4ndern UndoRedoManager.bordCol=Randfarben \u00E4ndern UndoRedoManager.thick=Dicke \u00E4ndern UndoRedoManager.style=Styl \u00E4ndern UndoRedoManager.lArrow=Stil des linken Pfeils \u00E4ndern UndoRedoManager.rArrow=Stil des rechten Pfeils \u00E4ndern UndoRedoManager.dotStyle=Punkt-Stil \u00E4ndern UndoRedoManager.noRedo=Wiederholen nicht m\u00F6glich UndoRedoManager.noUndo=R\u00FCckg\u00E4ngig machen nicht m\u00F6glich UndoRedoManager.align=Ausrichtung UndoRedoManager.distrib=Verteilung CodePanel.reload=Erneut laden CodePanel.autoUpdate=Auto-Update CodePanel.copySel=Ausgew\u00E4hlten Text kopieren CodePanel.copyAll=Ganzen Code kopieren CodePanel.tip=
Der Code wird in Echtzeit aktualisiert, wenn er ausgew\u00E4hlt ist.
Empfehlung: Deaktivieren Sie Auto-Update oder schalten Sie die Anzeige des Codepanels ab, wenn die Zeichnung zu komplex ist oder beim Bewegen grosser Objekte.
CodePanel.updateCode=Code aktualisieren CodePanel.addComment=Kommentare in den Code einf\u00FCgen CodePanel.reloadText=PSTricks Code neu geladen\! CodePanel.copiedText=PSTricks Code wurde in die Zwischenablage kopiert\! CodePanel.copiedSelText=Auswahl in die Zwischenablage kopiert\! SVGManager.0=Die Formen konnten nicht vom SVG-Dokument generiert werden. latexdraw-2.0.8+1.orig/lang/de/1_7.properties0000644000000000000000000000560311347255510015521 0ustar LaTeXDrawException.0=Ung\u00FCltiges Bild. LaTeXDrawFrame.0=Schatten LaTeXDrawFrame.9=Schattenfarbe ausw\u00E4hlen LaTeXDrawFrame.1=Farbverlauf 1 LaTeXDrawFrame.2=Farbverlauf 2 LaTeXDrawFrame.4=Schatten zur Figur hinzuf\u00FCgen. LaTeXDrawFrame.5=Farbe des Schattens w\u00E4hlen. LaTeXDrawFrame.6=Position figures into the drawing (in front of, behind,...). LaTeXDrawFrame.7=Die erste Farbe des Farbverlaufes w\u00E4hlen. LaTeXDrawFrame.8=Die zweite Farbe des Farbverlaufes w\u00E4hlen. ParametersTextFrame.0=Deckkraft ParametersTextFrame.1=Boxen Liste ParametersTextFrame.2=Undurchsichtig ParametersTextFrame.3=Kreis ParametersTextFrame.4=Rechteck ParametersTextFrame.5=Dreieck ParametersTextFrame.6=Raute ParametersTextFrame.7=Ellipse ParametersTextFrame.8=Einfache Box ParametersTextFrame.9=Mehrere Boxen ParametersGridFrame.0=Gitter Parameter ParametersTextFrame.10=Eingerahmte Box(en) aktivieren ParametersTextFrame.11=Hinzuf\u00FCgen ParametersTextFrame.12=\u00C4ndern ParametersTextFrame.13=Entfernen ParametersTextFrame.14=Separator: ParametersTextFrame.15=Box editieren ParametersTextFrame.16=Gr\u00F6sse der Box ber\u00FCcksichtigen ParametersTextFrame.17=Wenn aktiviert, wird der Hintergrund des Textes undurchsichtig sein. ParametersTextFrame.18=Eingerahmte Box(en) ParametersTextFrame.20=Einen oder mehrere Rahmen um den Text erstellen. ParametersTextFrame.21=Die Box wird ein Rechteck sein. ParametersTextFrame.22=Die Box wird ein Dreieck sein. ParametersTextFrame.23=Eine simple Box um den ganzen Text erstellen. ParametersTextFrame.24=Die Box wird eine Ellipse sein. ParametersTextFrame.25=Die Box wird eine Raute sein. ParametersTextFrame.26=Mehrere Boxen um die verschiedenen Teile des Textes erstellen. ParametersTextFrame.27=Die Box wird ein Kreis sein. ParametersTextFrame.28=Eine neue Box hinzuf\u00FCgen. ParametersTextFrame.29=Die Position der ausgew\u00E4hlten Box bearbeiten. ParametersTextFrame.30=Die ausgew\u00E4hlte Box entfernen. ParametersTextFrame.31=Change the spacing between the text and the box. ParametersTextFrame.32=Wenn aktiviert, wird die Box nicht auf dem Text vor oder hinter dem umrahmten Text gezeichnet. ParametersTextFrame.33=Open the panel of parameters of the box to edit it. ParametersTextFrame.34=Text Auswahl ParametersTextFrame.35=Text zum Rahmen ausw\u00E4hlen: ParametersTextFrame.36=Text Auswahl ParametersTextFrame.37=Ung\u00FCltige Box; sie \u00FCberlappt eine andere Box. AbstractParametersFrame.0=Dimension/Position AbstractParametersFrame.1=Winkel des Schattens AbstractParametersFrame.2=Gr\u00F6sse des Schattens AbstractParametersFrame.3=Winkel des Farbverlaufs AbstractParametersFrame.4=Mittelpunkt AbstractParametersFrame.6=Weitere AbstractParametersFrame.7=Runde Ecken: AbstractParametersFrame.8=Schraffur AbstractParametersFrame.9=Doppelte Linien AbstractParametersFrame.11=F\u00FCllfarbe AbstractParametersFrame.12=Farbverlauf BatchConvertFrame.0=In den gleichen Verzeichnissen latexdraw-2.0.8+1.orig/lang/pl/0000755000000000000000000000000011347255510013034 5ustar latexdraw-2.0.8+1.orig/lang/pl/1_9.properties0000644000000000000000000001130111347255510015536 0ustar LaTeXDrawFrame.0=Ostatnio otwierane pliki LaTeXDrawFrame.1=Rysuj zamkni\u0119t\u0105 krzyw\u0105 B\u00E9ziera LaTeXDrawFrame.2=Wyczy\u015B\u0107 wszystko LaTeXDrawFrame.3=Skr\u00F3ty LaTeXDrawFrame.4=Sprawd\u017A uaktualnienie LaTeXDrawFrame.5=Figury LaTeXDrawFrame.6=Ustaw widoczne wszystkie figury LaTeXDrawFrame.7=Je\u015Bli figura ma wsp\u00F3\u0142rz\u0119dne mniejsze do (0,0), nie mo\u017Ce jej zobaczy\u0107.
Ten przycisk przesuwa figury tak, aby wszystkie by\u0142y widoczne. LaTeXDrawFrame.8=Okre\u015Bla w\u0142a\u015Bciwo\u015Bci manipulator\u00F3w LaTeXDrawFrame.9=Widoczno\u015B\u0107 manipulator\u00F3w LaTeXDrawFrame.10=Okre\u015Bla przezroczysto\u015B\u0107 manipulator\u00F3w. LaTeXDrawFrame.11=Rysuj zamkni\u0119t\u0105 krzyw\u0105 B\u00E9ziera LaTeXDrawFrame.12=Sprawd\u017A czy wersja \u015Brodowiska Java Runtime Environment, kt\u00F3ra zosta\u0142a u\u017Cyta
do stworzenia tego pliku jest zgodna z obecnie u\u017Cywan\u0105. LaTeXDrawFrame.13=Folder pomocy jest nieosi\u0105galny, strona pomocy nie mog\u0142a zosta\u0107 wczytana. LaTeXDrawFrame.14=Utworzenie strony pomocy by\u0142o niemo\u017Cliwe. PSTricksParser.0=begin{center} musi znajdowa\u0107 si\u0119 poza begin{pspicture}...end{pspicture} PSTricksParser.1=end{center} musi znajdowa\u0107 si\u0119 poza begin{pspicture}...end{pspicture} PSTricksParser.2=end{figure} musi znajdowa\u0107 si\u0119 poza begin{pspicture}...end{pspicture} PSTricksParser.3=end{pspicture} lub pspicture nie odnaleziono. DrawPanel.0=Uaktualnij figury do siatki ParametersAkinPointsFrame.0=Odst\u0119py punkt\u00F3w: ParametersAkinPointsFrame.1=Otw\u00F3rz ParametersAkinPointsFrame.2=typ: ParametersAkinPointsFrame.3=Opcje linii odr\u0119cznej ParametersBezierCurveFrame.2=Kalibruj ParametersBezierCurveFrame.3=Kalibruje regulatory ze wzgl\u0119du na pozycj\u0119 punkt\u00F3w rysunku. ParametersBezierCurveFrame.4=Odleg\u0142o\u015B\u0107: ParametersBezierCurveFrame.5=Okre\u015Bla odst\u0119p pomi\u0119dzy regulatorami a punktami podczas kalibrowania krzywej ParametersBezierCurveFrame.6=wsp. X regulatora 1 ParametersBezierCurveFrame.7=wsp. Y regulatora 1 ParametersBezierCurveFrame.8=wsp. X regulatora 2 ParametersBezierCurveFrame.9=wsp. Y regulatora 2 PreferencesFrame.0=Liczba ostatnio u\u017Cywanych plik\u00F3w: PreferencesFrame.1=Temat (wymaga restartu) ShortcutsFrame.1=Kombinacja klawiszy ShortcutsFrame.3=Kategoria ShortcutsFrame.4=Nawigacja ShortcutsFrame.5=Transformacja ShortcutsFrame.6=Rysunek ShortcutsFrame.7=\ (du\u017Ce przesuni\u0119cie) ShortcutsFrame.8=lewy-klik ShortcutsFrame.9=Przesu\u0144 poziomy pasek przewijania na prawo ShortcutsFrame.10=Przesu\u0144 poziomy pasek przewijania na lewo ShortcutsFrame.11=Przesu\u0144 pionowy pasek przewijania na g\u00F3r\u0119 ShortcutsFrame.12=Przesu\u0144 pionowy pasek przewijania na d\u00F3\u0142 ShortcutsFrame.14=Id\u017A do ko\u0144ca poziomego pasku przewijania ShortcutsFrame.15=Id\u017A do pocz\u0105tku poziomego pasku przewijania ShortcutsFrame.16=Id\u017A do g\u00F3ry pionowego pasku przewijania ShortcutsFrame.17=Id\u017A do do\u0142u pionowego pasku przewijania ShortcutsFrame.18=Przesu\u0144 wybrane figury na prawo ShortcutsFrame.19=Przesu\u0144 wybrane figury na lewo ShortcutsFrame.20=Przesu\u0144 wybrane figury na g\u00F3r\u0119 ShortcutsFrame.21=Przesu\u0144 wybrane figury na d\u00F3\u0142 ShortcutsFrame.23=Dopasuj wybrane figury do wy\u015Bwietlonej siatki ShortcutsFrame.25=Zaznacz wszystkie figury na rysunku ShortcutsFrame.26=Dodaj klikni\u0119t\u0105 figur\u0119 do wyboru ShortcutsFrame.27=Usu\u0144 klikni\u0119t\u0105 figur\u0119 z wyboru ShortcutsFrame.28=Wybierz nast\u0119pn\u0105 lub pierwsz\u0105 figur\u0119 (w trybie wyboru) ShortcutsFrame.29=K\u00F3\u0142ko myszy ShortcutsFrame.30=Powi\u0119kszanie/pomniejszanie MenusListener.0=Wci\u015Bnij lewy przycisk i przeci\u0105gnij mysz, aby zaznaczy\u0107 drugi punkt. Zwolnienie przycisku ko\u0144czy rysowanie. MenusListener.1=Klikni\u0119cie lewym przyciskiem myszy - dodaje punkt, klikni\u0119cie prawym lub podw\u00F3jne lewym ko\u0144czy rysowanie. MenusListener.4=Wci\u015Bnij lewy przycisk i przeci\u0105gnij mysz, aby zaznaczy\u0107 ko\u0144cowy punkt. Zwolnienie przycisku ko\u0144czy rysowanie. MenusListener.5=Klikni\u0119cie lewym przyciskiem myszy dodaje tekst. MenusListener.6=Klikni\u0119cie lewym przyciskiem myszy dodaje siatk\u0119. MenusListener.7=Klikni\u0119cie lewym przyciskiem myszy dodaje osie. MenusListener.8=Wci\u015Bnij lewy przycisk i przeci\u0105gnij mysz, aby narysowa\u0107 figur\u0119. Zwolnienie przycisku ko\u0144czy rysowanie. MenusListener.9=Klikni\u0119cie lewym przyciskiem myszy dodaje punkt. RecentFilesListener.0=Niemo\u017Cliwy dost\u0119p do tego pliku. RecentFilesListener.1=Nie mo\u017Cna otworzy\u0107 pliku latexdraw-2.0.8+1.orig/lang/pl/LaTeXDrawFrame.properties0000644000000000000000000002323711347255510017727 0ustar LaTeXDrawFrame.0=\ pomoc LaTeXDrawFrame.1=O programie LaTeXDrawFrame.2=Rysuj lini\u0119 LaTeXDrawFrame.3=Rysuj prostok\u0105t LaTeXDrawFrame.4=Rysuj punkt LaTeXDrawFrame.5=Rysuj kwadrat LaTeXDrawFrame.6=Rysuj romb LaTeXDrawFrame.7=Linia odr\u0119czna LaTeXDrawFrame.8=Rysuj tr\u00F3jk\u0105t LaTeXDrawFrame.9=Rysuj okr\u0105g LaTeXDrawFrame.10=Rysuj siatk\u0119 LaTeXDrawFrame.11=Rysuj elips\u0119 LaTeXDrawFrame.12=Rysuj wielok\u0105t LaTeXDrawFrame.13=Wybierz figur\u0119(y) LaTeXDrawFrame.14=Wy\u015Bwietl granice LaTeXDrawFrame.15=Automatyczne dopasowanie granic LaTeXDrawFrame.16=Eksport jako... LaTeXDrawFrame.17=Usu\u0144 figur\u0119 LaTeXDrawFrame.18=Wyjd\u017A LaTeXDrawFrame.19=Kod PSTricks LaTeXDrawFrame.20=Obraz JPEG LaTeXDrawFrame.21=Obraz EPS LaTeXDrawFrame.22=Powt\u00F3rz LaTeXDrawFrame.23=Cofnij LaTeXDrawFrame.25=Zapisz projekt LaTeXDrawFrame.26=Zapisz projekt jako LaTeXDrawFrame.27=Otw\u00F3rz projekt LaTeXDrawFrame.28=Nowy projekt LaTeXDrawFrame.29=Drukuj kod LaTeXDrawFrame.30=Drukuj rysunek LaTeXDrawFrame.31=Za figur\u0105 LaTeXDrawFrame.32=Przed figur\u0105 LaTeXDrawFrame.33=Grupuj LaTeXDrawFrame.34=Rozdziel LaTeXDrawFrame.35=Rysuj \u0142uk LaTeXDrawFrame.36=Rysuj wycinek ko\u0142a LaTeXDrawFrame.37=Rysuj odcinek ko\u0142a LaTeXDrawFrame.38=O\u015B X LaTeXDrawFrame.39=O\u015B Y LaTeXDrawFrame.40=Kopiuj LaTeXDrawFrame.41=Uaktualnij szablony LaTeXDrawFrame.42=Eksportuj jako szablon LaTeXDrawFrame.43=Wklej LaTeXDrawFrame.44=Wytnij LaTeXDrawFrame.45=Standardowa siatka LaTeXDrawFrame.46=Kod projektu LaTeXDrawFrame.47=Kraw\u0119dzie LaTeXDrawFrame.48=Wn\u0119trze LaTeXDrawFrame.49=Kreskowanie LaTeXDrawFrame.51=wype\u0142niony LaTeXDrawFrame.53=W\u0142a\u015Bciwo\u015Bci figury LaTeXDrawFrame.55=Dodaj komentarze LaTeXDrawFrame.56=Ustawienia LaTeXDrawFrame.57=Powi\u0119ksz LaTeXDrawFrame.58=Pomniejsz LaTeXDrawFrame.60=Dodaj tekst LaTeXDrawFrame.61=Pierwszy plan LaTeXDrawFrame.62=T\u0142o LaTeXDrawFrame.63=Rysuj krzyw\u0105 B\u00E9ziera LaTeXDrawFrame.64=Obr\u00F3\u0107 figur\u0105 LaTeXDrawFrame.65=Zmie\u0144 grubo\u015B\u0107 figury LaTeXDrawFrame.66=Zmie\u0144 kolor kraw\u0119dzi figury LaTeXDrawFrame.67=Je\u015Bli zaznaczone, figura b\u0119dzie wype\u0142niona LaTeXDrawFrame.68=Zmie\u0144 kolor wn\u0119trza figury LaTeXDrawFrame.69=Zmie\u0144 kolor kreskowania LaTeXDrawFrame.70=Przesu\u0144 figur\u0119 na pierwszy plan LaTeXDrawFrame.71=Przesu\u0144 figur\u0119 w t\u0142o LaTeXDrawFrame.72=Wybierz figur\u0119, kt\u00F3ra b\u0119dzie za wybran\u0105 ju\u017C figur\u0105 LaTeXDrawFrame.73=Wybierz figur\u0119, kt\u00F3ra b\u0119dzie przed wybran\u0105 ju\u017C figur\u0105 LaTeXDrawFrame.74=Je\u015Bli w\u0142\u0105czone, mo\u017Cesz obraca\u0107 figur\u0119 mysz\u0105 korzystaj\u0105c z manipulator\u00F3w LaTeXDrawFrame.75=Grupuj figury LaTeXDrawFrame.76=Rozdziel figury LaTeXDrawFrame.77=Okre\u015Bl pozycj\u0119 kraw\u0119dzi figury LaTeXDrawFrame.78=Je\u015Bli wybrane, figura b\u0119dzie mia\u0142a podw\u00F3jne kraw\u0119dzie LaTeXDrawFrame.79=Zmie\u0144 kolor pomi\u0119dzy podw\u00F3jnymi kraw\u0119dziami LaTeXDrawFrame.80=\ Grubo\u015B\u0107 LaTeXDrawFrame.82=Wyst\u0105pi\u0142 b\u0142\u0105d poczas uruchamiania LaTeXDraw:
LaTeXDrawFrame.83=Start programu LaTeXDraw jest niemo\u017Cliwy LaTeXDrawFrame.86=B\u0142\u0105d LaTeXDraw LaTeXDrawFrame.88=Plik LaTeXDrawFrame.89=Edycja LaTeXDrawFrame.90=Opcje widoku LaTeXDrawFrame.91=Rysuj LaTeXDrawFrame.92=Kod LaTeXDrawFrame.93=Pomoc LaTeXDrawFrame.94=Powi\u0119ksz rysunek LaTeXDrawFrame.95=Pomniejsz rysunek LaTeXDrawFrame.96=Zoom 100% LaTeXDrawFrame.103=Szablony LaTeXDrawFrame.105=Utworzenie menu szablon\u00F3w niemo\u017Cliwe\! LaTeXDrawFrame.107=Pasek narz\u0119dzi LaTeXDrawFrame.108=Utw\u00F3rz nowy projekt LaTeXDrawFrame.109=Otw\u00F3rz projekt LaTeXDrawFrame.110=Zapisz projekt LaTeXDrawFrame.113=100% LaTeXDrawFrame.114=Cofnij akcj\u0119 LaTeXDrawFrame.115=Powt\u00F3rz akcj\u0119 LaTeXDrawFrame.116=Rysuj lini\u0119 LaTeXDrawFrame.117=Rysuj punkt LaTeXDrawFrame.118=Rysuj prostok\u0105tny kszta\u0142t LaTeXDrawFrame.119=Rysuj prostok\u0105t LaTeXDrawFrame.120=Rysuj kwadrat LaTeXDrawFrame.121=Rysuj wielok\u0105t LaTeXDrawFrame.123=Rysuj romb LaTeXDrawFrame.124=Rysuj tr\u00F3jk\u0105t LaTeXDrawFrame.125=Rysuj elips\u0119 LaTeXDrawFrame.127=Rysuj okr\u0105g LaTeXDrawFrame.128=Rysuj \u0142uk LaTeXDrawFrame.130=Rysuj wycinek ko\u0142a LaTeXDrawFrame.131=Rysuj odcinek ko\u0142a LaTeXDrawFrame.132=Rysuj krzyw\u0105 B\u00E9ziera LaTeXDrawFrame.133=Rysuj siatk\u0119 LaTeXDrawFrame.136=Wybierz jedn\u0105 lub wi\u0119cej figur
LaTeXDrawFrame.137=Rada : aby wybra\u0107 wi\u0119cej LaTeXDrawFrame.138=figur, kliknij
i przeci\u0105gnij mysz na figury, kt\u00F3re chcesz wybra\u0107 LaTeXDrawFrame.139=Usu\u0144 wybrane figury LaTeXDrawFrame.140=Zmie\u0144 w\u0142a\u015Bciwo\u015Bci figury LaTeXDrawFrame.141=Wy\u015Bwietl granice rysunku
LaTeXDrawFrame.142=Rada : je\u015Bli wy\u015Bwietlasz granice
LaTeXDrawFrame.143=rysunku, wy\u0142\u0105cz automatyczn\u0105 aktualizacj\u0119 granic rysunku,
LaTeXDrawFrame.144=aby m\u00F3c zmieni\u0107 wymiary rysunku LaTeXDrawFrame.146=Skopiowano... LaTeXDrawFrame.147=Wklejono... LaTeXDrawFrame.148=Wyci\u0119to... LaTeXDrawFrame.149=Usuni\u0119to... LaTeXDrawFrame.151=Wybierz kolor podw\u00F3jnych kraw\u0119dzi LaTeXDrawFrame.154=Zgrupowano... LaTeXDrawFrame.155=Rozdzielono... LaTeXDrawFrame.156=Czy chcesz zapisa\u0107 projekt? LaTeXDrawFrame.158=Powt\u00F3rzono... LaTeXDrawFrame.159=Cofni\u0119to... LaTeXDrawFrame.160=Szablony zaktualizowano... LaTeXDrawFrame.161=B\u0142\u0105d dla pliku LaTeXDrawFrame.162=Drukowanie rysunku... LaTeXDrawFrame.163=Rysunek wydrukowano\! LaTeXDrawFrame.164=Wydruk rysunku niemo\u017Cliwy\! LaTeXDrawFrame.165=Drukowanie kodu... LaTeXDrawFrame.166=Kod wydrukowano\! LaTeXDrawFrame.167=Wydruk kodu niemo\u017Cliwy\! LaTeXDrawFrame.168=Eksportowanie do szablonu... LaTeXDrawFrame.169=Szablon wyeksportowano\! LaTeXDrawFrame.170=Eksportowanie do kodu PSTricks... LaTeXDrawFrame.171=Wybierz LaTeXDrawFrame.172=Eksportuj PSTricks jako plik TeX LaTeXDrawFrame.173=Czy chcesz zast\u0105pi\u0107 plik? LaTeXDrawFrame.174=Eksportuj jako PSTricks LaTeXDrawFrame.175=Kod PSTricks wyeksportowano\! LaTeXDrawFrame.176=Eksport kodu PSTricks niemo\u017Cliwy\! LaTeXDrawFrame.177=Eksportowanie obrazu... LaTeXDrawFrame.179=Eksportuj figury jako LaTeXDrawFrame.182=Eksportuj jako LaTeXDrawFrame.183=\ plik LaTeXDrawFrame.184=Eksport obrazu uko\u0144czono\! LaTeXDrawFrame.185=Eksport obrazu niemo\u017Cliwy\! LaTeXDrawFrame.186=Zapisywanie projektu... LaTeXDrawFrame.188=Zapisz rysunek LaTeXDrawFrame.190=Eksportuj jako plik JPEG LaTeXDrawFrame.191=Projekt zapisano\! LaTeXDrawFrame.192=Zapis projektu niemo\u017Cliwy\! LaTeXDrawFrame.193=Wyst\u0105pi\u0142 b\u0142\u0105d podczas zapisywania pliku:
LaTeXDrawFrame.197=Tworzenie nowego projektu... LaTeXDrawFrame.198=Utworzono nowy projekt\! LaTeXDrawFrame.200=Otw\u00F3rz rysunek LaTeXDrawFrame.201=Otwieranie pliku... LaTeXDrawFrame.202=Plik otworzono\! LaTeXDrawFrame.203=Otworzenie pliku niemo\u017Cliwe\! LaTeXDrawFrame.204=Wyst\u0105pi\u0142 b\u0142\u0105d podczas \u0142adowania pliku:
LaTeXDrawFrame.208=
Wersja LaTeXDrawFrame.209=\ wydano\! LaTeXDrawFrame.210=Nowa wersja LaTeXDrawFrame.211=Nowa wersja zosta\u0142a wydana\! LaTeXDrawFrame.212=Brak nowych wersji LaTeXDrawFrame.213=Brak mo\u017Cliwo\u015Bci sprawdzenia aktualizacji\! LaTeXDrawFrame.215=Pomoc LaTeXDraw LaTeXDrawFrame.218=Generator kodu PSTricks dla systemu LaTeX\! LaTeXDrawFrame.219=Wersja LaTeXDrawFrame.220=, build LaTeXDrawFrame.221=\ jest rozpowszechniany na licencji GNU General Public License LaTeXDrawFrame.222=\ jako publikowany przez Free Software Foundation (wersja 2) LaTeXDrawFrame.229=Importuj... LaTeXDrawFrame.230=Z pliku TeX LFrame2.0=Okre\u015Bl rozmiar punktu. LFrame2.1=Dopasuj wybrane figury. LFrame2.10=Rozmie\u015B\u0107 pionowo wybrane figury z zachowaniem r\u00F3wnych odst\u0119p\u00F3w pomi\u0119dzy nimi. LFrame2.11=Rozmie\u015B\u0107 pionowo wybrane figury z zachowaniem r\u00F3wnych odst\u0119p\u00F3w pomi\u0119dzy ich \u015Brodkami. LFrame2.12=Rozmie\u015B\u0107 pionowo wybrane figury z zachowaniem r\u00F3wnych odst\u0119p\u00F3w pomi\u0119dzy ich g\u00F3rnymi kraw\u0119dziami. LFrame2.13=Rozmie\u015B\u0107 poziomo wybrane figury z zachowaniem r\u00F3wnych odst\u0119p\u00F3w pomi\u0119dzy ich lewymi kraw\u0119dziami. LFrame2.14=Rozmie\u015B\u0107 poziomo wybrane figury z zachowaniem r\u00F3wnych odst\u0119p\u00F3w pomi\u0119dzy nimi. LFrame2.15=Rozmie\u015B\u0107 poziomo wybrane figury z zachowaniem r\u00F3wnych odst\u0119p\u00F3w pomi\u0119dzy ich \u015Brodkami. LFrame2.16=Rozmie\u015B\u0107 poziomo wybrane figury z zachowaniem r\u00F3wnych odst\u0119p\u00F3w pomi\u0119dzy ich prawymi kraw\u0119dziami. LFrame2.17=Kolory LFrame2.18=Otworzenie pliku niemo\u017Cliwe. LFrame2.19=Szablonu nie znaleziono LFrame2.2=Wyr\u00F3wnaj do lewej wybrane figury. LFrame2.20=Prosz\u0119, uaktualnij menu szablon\u00F3w LFrame2.21=Szablonu nie znaleziono LFrame2.22=Dokument nie mo\u017Ce zosta\u0107 wydrukowany. LFrame2.23=Brak drukarki. LFrame2.25=Biblioteka GPL jlibeps jest u\u017Cywana do tworzenie obraz\u00F3w EPS. LFrame2.3=Wyr\u00F3wnaj do prawej wybrane figury. LFrame2.4=Wyr\u00F3wnaj do g\u00F3ry wybrane figury. LFrame2.5=Wyr\u00F3wnaj do do\u0142u wybrane figury. LFrame2.6=Wyr\u00F3wnaj poziomo w \u015Brodku wybranych figur. LFrame2.7=Wyr\u00F3wnaj pionowo w \u015Brodku wybranych figur. LFrame2.8=Rozmie\u015B\u0107 figury zachowuj\u0105c r\u00F3wny odst\u0119p mi\u0119dzy nimi. LFrame2.9=Rozmie\u015B\u0107 pionowo wybrane figury z zachowaniem r\u00F3wnych odst\u0119p\u00F3w pomi\u0119dzy ich dolnymi kraw\u0119dziami. LFrame2.26=Nowy projekt z zaznaczenia latexdraw-2.0.8+1.orig/lang/pl/1_6.properties0000644000000000000000000000702411347255510015542 0ustar BatchConvertFrame.1=Dodaj podfoldery BatchConvertFrame.2=Dodaj pliki BatchConvertFrame.4=Usu\u0144 wszystko BatchConvertFrame.5=Nadpisz BatchConvertFrame.6=Wybierz \u015Bcie\u017Ck\u0119 BatchConvertFrame.7=Wybierz format BatchConvertFrame.8=Konwertuj BatchConvertFrame.9=Zatrzymaj BatchConvertFrame.11=Lista Batch BatchConvertFrame.12=Wybierz katalog BatchConvertFrame.13=Wybierz obrazy BatchConvertFrame.14=Konwertuj na: LaTeXDrawFrame.0=Wstaw kod PSTricks LaTeXDrawFrame.1=Wstaw obraz LaTeXDrawFrame.2=Konwertuj obrazy LaTeXDrawFrame.3=zatrzymaj LaTeXDrawFrame.4=Rysuj \u0142aman\u0105 LaTeXDrawFrame.5=Obraz PPM LaTeXDrawFrame.6=Obraz BMP LaTeXDrawFrame.7=Obraz PNG LaTeXDrawFrame.9=Zatrzymaj parsowanie\! LaTeXDrawFrame.10=Wstaw LaTeXDrawFrame.11=Wstaw figury z kodu PSTricks LaTeXDrawFrame.14=Rysuj \u0142aman\u0105 LaTeXDrawFrame.15=Importowanie pliku PSTricks... LaTeXDrawFrame.16=Aktualny parser PSTricks parser przetwarza tylko wybrane polecenia.
Mo\u017Cesz importowa\u0107 tylko polecenia obs\u0142ugiwane przez LaTeXDraw. LaTeXDrawFrame.17=Importuj kod PSTricks LaTeXDrawFrame.18=Ten program wykorzystuje JIU (Java Imaging Utilities) - rozpowszechnione LaTeXDrawFrame.19=na licencji GNU General Public License. http://schmidt.devlib.org/jiu/ LaTeXDrawFrame.23=Ostrze\u017Cenia:
  • PSTricks nie obs\u0142uguje plik\u00F3w JPG, BMP,... ; dlatego plik EPS zostanie utworzony z podanego obrazu,
    w tym samym folderze. Obraz zostanie do\u0142\u0105czony, je\u015Bli masz prawa zapisu w danym folderze;
  • TeX nie obs\u0142uguje spacji w \u015Bcie\u017Cce, dlatego nie u\u017Cywaj ich w nazwach plik\u00F3w i folder\u00F3w.
LaTeXDrawFrame.25=Wczytywanie obrazu... LaTeXDrawFrame.26=Obraz jest niepoprawny\! LaTeXDrawFrame.27=Wczytanie obrazu niemo\u017Cliwe\! LaTeXDrawFrame.28=Obraz zosta\u0142 wstawiony\! LaTeXDrawFrame.30=Brak figury do importu\!
Sprawd\u017A czy opisy figur s\u0105 zawarte pomi\u0119dzy begin{pspicture} ...end{pspicture}.
Mo\u017Cesz wys\u0142a\u0107 plik do LaTeXDrawFrame.31=\ je\u015Bli uwa\u017Casz, \u017Ce w parserze PSTricks znajduje si\u0119 b\u0142\u0105d. LaTeXDrawFrame.32=Nie znaleziono figury\! LaTeXDrawFrame.33=Nie znaleziono figury do importu\! LaTeXDrawFrame.34=Import pliku PSTricks niemo\u017Cliwy\! LaTeXDrawFrame.35=Importowanie anulowane\! LaTeXDrawFrame.36=Kod skonwertowany na figury\! InsertPSTricksCodeFrame.0=Wstaw figury z kodu PSTricks FatalErrorParsingException.0=
Je\u015Bli plik jest poprawny, mo\u017Cesz go wys\u0142a\u0107 do: arno_b@users.sourceforge.net Picture.0=% Ostrze\u017Cenie: \u015Bcie\u017Cka do obrazu zawiera spacje i nie zostanie przetworzona przez tex\! ParserCmdMessage.0=Linia ParserCmdMessage.1=Polecenie: ParserCmdMessage.2=Wyj\u0105tek: ParserMessagesFrame.0=Polecenie ParserMessagesFrame.1=Linia ParserMessagesFrame.2=Wyj\u0105tek ParserMessagesFrame.3=Jedno lub wi\u0119cej ostrze\u017Ce\u0144 wyst\u0105pi\u0142o podczas parsowania ParserMessagesFrame.4=Parser TeX: ostrze\u017Cenie(a) ParametersGridFrame.0=Przestaw jednostki wzgl\u0119dem pionowych linii siatki ParametersGridFrame.1=Przestaw jednostki wzgl\u0119dem poziomych linii siatki PSTricksParser.0=B\u0142\u0105d podczas otwierania pliku: niepoprawny plik\! PSTricksParser.1=Przyrostowa definicja pspicture nie jest jeszcze obs\u0142ugiwana:
PSTricksParser.2=begin{pspicture}...begin{pspicture} ... end{pspicture}... PSTricksParser.3=B\u0142\u0105d podczas parsowania pliku\! latexdraw-2.0.8+1.orig/lang/pl/dialogFrames.properties0000644000000000000000000001271311347255510017553 0ustar PreferencesFrame.Pref=Ustawienia... PreferencesFrame.grid=Siatka PreferencesFrame.codePanel=Kod PreferencesFrame.antiAl=Wyg\u0142adzanie kraw\u0119dzi PreferencesFrame.rendQ=Jako\u015B\u0107 renderingu PreferencesFrame.colRendQ=Jako\u015B\u0107 koloru renderingu PreferencesFrame.AlphaQ=Jako\u015B\u0107 interpolacji Alpha PreferencesFrame.bordersDraw=Granice rysunku PreferencesFrame.codeAuto=Automatyczna aktualizacja kodu (wolniejsze) PreferencesFrame.newVers=Sprawd\u017A czy jest nowa wersja przy starcie PreferencesFrame.lge=J\u0119zyk (wymagany restart) PreferencesFrame.general=Og\u00F3lne PreferencesFrame.folders=Foldery PreferencesFrame.quality=Jako\u015B\u0107 PreferencesFrame.selectFolder=Wybierz katalog PreferencesFrame.defOpenSave=Domy\u015Blny folder dla operacji otw\u00F3rz/zapisz PreferencesFrame.defFold=Domy\u015Blny folder dla operacji importuj/eksportuj PreferencesFrame.errorReadPref=B\u0142\u0105d podczas otwierania pliku z ustawieniami\! PreferencesFrame.prefSaved=Ustawienia zapisane\! DrawPropertiesFrame.0=Etykieta rysunku DrawPropertiesFrame.1=Nag\u0142\u00F3wek rysunku DrawPropertiesFrame.2=W\u0142a\u015Bciwo\u015Bci rysunku DrawPropertiesFrame.3=pikseli na DrawPropertiesFrame.5=Po stronie figur, tabel, ... DrawPropertiesFrame.6=Na g\u00F3rze strony DrawPropertiesFrame.7=Na dole strony DrawPropertiesFrame.8=Tutaj DrawPropertiesFrame.9=TUTAJ\! DrawPropertiesFrame.10=W \u015Brodku strony DrawPropertiesFrame.11=Pozioma pozycja rysunku DrawPropertiesFrame.12=Pozioma pozycja rysunku DrawPropertiesFrame.13=Zmie\u0144 liczb\u0119 pikseli na jednostk\u0119 d\u0142ugo\u015Bci ExceptionFrameDialog.0=Wy\u015Blij raport ExceptionFrameDialog.1=Wyst\u0105pi\u0142 b\u0142\u0105d\!
ExceptionFrameDialog.2=
Mo\u017Cesz wys\u0142a\u0107 raport do tw\u00F3rcy LaTeXDraw ExceptionFrameDialog.3=B\u0142\u0105d LaTeXDraw: wyst\u0105pi\u0142 wyj\u0105tek ExceptionFrameDialog.4=Wyst\u0105pi\u0142 b\u0142\u0105d:
ExceptionFrameDialog.5=Utworzenie ExceptionFrameDialog niemo\u017Cliwe AbstractParametersFrame.0=Podw\u00F3jne kraw\u0119dzie AbstractParametersFrame.2=Separator: AbstractParametersFrame.3=Og\u00F3lne parametry AbstractParametersFrame.4=Ok AbstractParametersFrame.5=Domy\u015Blne AbstractParametersFrame.6=Anuluj AbstractParametersFrame.7=K\u0105t obrotu: AbstractParametersFrame.8=Grubo\u015B\u0107: AbstractParametersFrame.10=Rodzaj linii: AbstractParametersFrame.11=Szeroko\u015B\u0107 kreskowania: AbstractParametersFrame.12=Lewa strza\u0142ka: AbstractParametersFrame.13=Prawa strza\u0142ka: AbstractParametersFrame.14=Parametry strza\u0142ek AbstractParametersFrame.15=Poka\u017C regulatory AbstractParametersFrame.16=Zaokr\u0105glony AbstractParametersFrame.17=Wsp\u00F3\u0142rz\u0119dna X \u015Brodka: AbstractParametersFrame.18=Wsp\u00F3\u0142rz\u0119dna Y \u015Brodka: AbstractParametersFrame.19=Promie\u0144: AbstractParametersFrame.20=\u015Arednica punktu = AbstractParametersFrame.21=Szeroko\u015B\u0107 paska = AbstractParametersFrame.22=D\u0142ugo\u015B\u0107 klamer = AbstractParametersFrame.23=D\u0142. zaokr\u0105glonych klamer = AbstractParametersFrame.24=x grubo\u015B\u0107 + AbstractParametersFrame.25=x szeroko\u015B\u0107 AbstractParametersFrame.26=D\u0142ugo\u015B\u0107 strza\u0142ki AbstractParametersFrame.27=Wstawki strza\u0142ki AbstractParametersFrame.28=Szeroko\u015B\u0107 strza\u0142ki AbstractParametersFrame.29=Wsp\u00F3\u0142rz\u0119dna X AbstractParametersFrame.30=Wsp\u00F3\u0142rz\u0119dna Y AbstractParametersFrame.31=Szeroko\u015B\u0107: AbstractParametersFrame.32=Wysoko\u015B\u0107: AbstractParametersFrame.33=Opcje kszta\u0142tu AbstractParametersFrame.34=Wybierz kolor kreskowania AbstractParametersFrame.35=Wybierz color podw\u00F3jnych kraw\u0119dzi AbstractParametersFrame.36=Wybierz kolor kraw\u0119dzi AbstractParametersFrame.37=Wybierz kolor wn\u0119trza AbstractParametersFrame.38=Strza\u0142ki ParametersArcFrame.0=k\u0105t pocz\u0105tkowy: ParametersArcFrame.1=k\u0105t ko\u0144cowy: ParametersArcFrame.2=Typ \u0142uku: ParametersDotFrame.0=Typ punktu: ParametersDrawFrame.0=Lewy g\u00F3rny X ParametersDrawFrame.1=Lewy g\u00F3rny Y ParametersDrawFrame.2=Prawy dolny X ParametersDrawFrame.3=Prawy dolny Y ParametersGridFrame.0=Y Pocz\u0105tek ParametersGridFrame.1=X Pocz\u0105tek ParametersGridFrame.2=Jednostki: ParametersGridFrame.3=Jednostka: ParametersGridFrame.4=Punkty mniejszych siatek: ParametersGridFrame.5=Punkty siatki: ParametersGridFrame.6=Szeroko\u015B\u0107 siatki: ParametersGridFrame.7=Szeroko\u015B\u0107 mniejszych siatek: ParametersGridFrame.8=Podzia\u0142 mniejszych siatek: ParametersGridFrame.9=Wielko\u015B\u0107 czcionki jednostki: ParametersLineFrame.0=Lewy X ParametersLineFrame.1=Lewy Y ParametersLineFrame.2=Prawy X ParametersLineFrame.3=Prawy Y ParametersTextFrame.0=Pogrubienie ParametersTextFrame.1=Kursywa ParametersTextFrame.2=Czcionka: ParametersTextFrame.3=Rozmiar: ParametersTextFrame.4=Tekst ParametersGridFrame.10=Mniejsza siatka: ParametersGridFrame.11=X max: ParametersGridFrame.12=X min: ParametersGridFrame.13=Y max: ParametersGridFrame.14=Y min: ParametersGridFrame.15=Poka\u017C jednostki ParametersGridFrame.17=Wybierz kolor jednostek ParametersGridFrame.18=Wyb\u00F3r koloru mniejszej siatki ParametersPolygonFrame.1=Punkt nr ParametersTriangleFrame.0=\u015Arodkowy X ParametersTriangleFrame.1=\u015Arodkowy Y ParamsBC.0=Przesuwaj wszystko ParamsBC.1=Je\u015Bli nie wybrane, gdy przesuwasz punktu ich regulatory s\u0105 tak\u017Ce przesuwane. ExportDialog.0=Kompresja latexdraw-2.0.8+1.orig/lang/pl/1_8.properties0000644000000000000000000000527511347255510015552 0ustar UndoRedoManager.0=Transformacja AbstractParametersFrame.0=odst\u0119p: ParametersAxeFrame.0=Figura: ParametersAxeFrame.1=Poka\u017C pocz\u0105tek ParametersAxeFrame.2=Osie ParametersAxeFrame.3=Poka\u017C skal\u0119 na osi X ParametersAxeFrame.4=Poka\u017C skal\u0119 na osi Y ParametersAxeFrame.5=Okre\u015Bl d\u0142ugo\u015B\u0107 jednostki skali ParametersAxeFrame.6=D\u0142ugo\u015B\u0107 jednostki osi X: ParametersAxeFrame.7=D\u0142ugo\u015B\u0107 jednostki osi Y: ParametersAxeFrame.8=Zwi\u0119kszaj jednostk\u0119 na osi X co: ParametersAxeFrame.9=Zwi\u0119kszaj jednostk\u0119 na osi Y co: ParametersAxeFrame.10=Pocz\u0105tek skali na osi X: ParametersAxeFrame.11=Pocz\u0105tek skali na osi Y: ParametersAxeFrame.12=Skala i jednostki ParametersAxeFrame.13=Wielko\u015B\u0107: ParametersAxeFrame.14=Styl: ParametersAxeFrame.15=Poka\u017C kreski na osi X: ParametersAxeFrame.16=Poka\u017C kreski na osi Y: ParametersAxeFrame.17=Zaznaczenie jednostek PreferencesFrame.3=\u015Acie\u017Cka do edytora LaTeX'a: PreferencesFrame.4=Standardowa siatka PreferencesFrame.5=W\u0142asna siatka PreferencesFrame.6=Magnetyczna siatka PreferencesFrame.7=Odst\u0119p: LaTeXDrawFrame.0=Rysuj osie LaTeXDrawFrame.2=Obr\u00F3\u0107 wybran\u0105(e) figur\u0119(y) LaTeXDrawFrame.3=Obr\u00F3\u0107 wybran\u0105(e) figur\u0119(y) o 90\u00B0 LaTeXDrawFrame.4=Obr\u00F3\u0107 wybran\u0105(e) figur\u0119(y) o 180\u00B0 LaTeXDrawFrame.5=Obr\u00F3\u0107 wybran\u0105(e) figur\u0119(y) o 270\u00B0 LaTeXDrawFrame.6=Odbij figury symetrycznie LaTeXDrawFrame.7=Odbij w poziomie wybran\u0105 figur\u0119 LaTeXDrawFrame.8=Odbij w pionie LaTeXDrawFrame.10=Wy\u015Bwietl standardow\u0105 siatk\u0119 (w cm lub calach) LaTeXDrawFrame.11=Wy\u015Bwietl siatk\u0119 dla kt\u00F3rej mo\u017Cesz modyfikowa\u0107 odst\u0119py pomi\u0119dzy jej liniami LaTeXDrawFrame.12=Zawiera parametry (przyci\u0105gaj\u0105cej) siatki LaTeXDrawFrame.13=przyci\u0105gaj\u0105cy LaTeXDrawFrame.14=Je\u015Bli wybrane, figury b\u0119d\u0105 przyci\u0105gane do siatki LaTeXDrawFrame.15=Okre\u015Bl odst\u0119p pomi\u0119dzy liniami w\u0142asnej siatki (w pikselach) LaTeXDrawFrame.16=Rysuj siatki i osie. LaTeXDrawFrame.17=Rysuj osie. LaTeXDrawFrame.18=Uruchom edytor LaTeX'a LaTeXDrawFrame.19=Uruchamianie edytora LaTeX'a... LaTeXDrawFrame.20=Musisz okre\u015Bli\u0107 \u015Bcie\u017Ck\u0119 edytora LaTeX'a w Ustawieniach LaTeXDrawFrame.21=Wybrany plik jest niepoprawny. LaTeXDrawFrame.22=Okre\u015Bl ponownie \u015Bcie\u017Ck\u0119 w Ustawieniach LaTeXDrawFrame.23=Zamknij LaTeXDrawFrame.25=Biblioteki LaTeXDrawFrame.26=T\u0142umacze LaTeXDrawFrame.27=Informacja o wydaniu LaTeXDrawFrame.28=Licencja Axe.0=\u017Baden Axe.1=O\u015B Axe.2=Ramka Axe.3=Pe\u0142ny Axe.4=G\u00F3ra Axe.5=D\u00F3\u0142 latexdraw-2.0.8+1.orig/lang/pl/others.properties0000644000000000000000000000435211347255510016462 0ustar XScale.cm=cm XScale.inch=cal LaTeXDrawException.valueInc=Niepoprawna warto\u015B\u0107 LaTeXDrawException.invFile=To nie jest plik LaTeXDraw\! LaTeXDrawException.invLaTeXDrawVer=Ta wersja LaTeXDraw nie jest wspierana\! LaTeXDrawException.invException=Nieznany b\u0142\u0105d Arc.arc=\u0141uk Arc.wedge=Wycinek ko\u0142a Arc.chord=Odcinek ko\u0142a Arc.arcType=Rodzaj \u0142uku Figure.boundPos=Pozycja granicy DrawContainer.nameTemplate=Podaj nazw\u0119 szablonu DrawContainer.overwriteTemplate=Szablon istnieje, nadpisa\u0107? CloseButton.closePanel=Zamknij panel UndoRedoManager.changeParams=Zmie\u0144 opcje UndoRedoManager.changeDispo=Zmie\u0144 dyspozycje UndoRedoManager.move=Przesu\u0144 UndoRedoManager.delete=Usu\u0144 UndoRedoManager.create=Utw\u00F3rz UndoRedoManager.join=Po\u0142\u0105cz UndoRedoManager.seperate=Rozdziel UndoRedoManager.filled=Zmie\u0144 styl wn\u0119trza UndoRedoManager.intCol=Zmie\u0144 kolor wn\u0119trza UndoRedoManager.bordCol=Zmie\u0144 kolor granic UndoRedoManager.thick=Zmie\u0144 grubo\u015B\u0107 UndoRedoManager.style=Zmie\u0144 styl UndoRedoManager.lArrow=Zmie\u0144 styl lewej strza\u0142ki UndoRedoManager.rArrow=Zmie\u0144 styl prawej strza\u0142ki UndoRedoManager.dotStyle=Zmie\u0144 styl punktu UndoRedoManager.noRedo=Powt\u00F3rzenie niemo\u017Cliwe UndoRedoManager.noUndo=Cofni\u0119cie niemo\u017Cliwe UndoRedoManager.align=wyr\u00F3wnanie UndoRedoManager.distrib=dystrybucja CodePanel.reload=Od\u015Bwie\u017C CodePanel.autoUpdate=Aktualizuj kod CodePanel.copySel=Kopiuj zaznaczony kod CodePanel.copyAll=Kopiuj ca\u0142y kod CodePanel.tip=
Je\u015Bli zaznaczone, kod b\u0119dzie aktualizowany na bie\u017C\u0105co
Rada : wy\u0142\u0105cz automatyczne aktualizowanie kodu
albo nie wy\u015Bwietlaj panelu z kodem, gdy rysunek jest z\u0142o\u017Cony
lub podczas przesuwania du\u017Cego obiektu
CodePanel.updateCode=Aktualizuj kod CodePanel.addComment=Dodaj komentarze do kodu CodePanel.reloadText=Kod PSTricks zosta\u0142 zaktualizowany\! CodePanel.copiedText=Kod PSTricks zosta\u0142 skopiowany do schowka\! CodePanel.copiedSelText=Kod PSTricks zosta\u0142 skopiowany do schowka\! SVGManager.0=Niemo\u017Cliwe utworzenie kszta\u0142t\u00F3w z pliku SVG latexdraw-2.0.8+1.orig/lang/pl/1_7.properties0000644000000000000000000000550311347255510015543 0ustar LaTeXDrawException.0=Niepoprawny obraz. LaTeXDrawFrame.0=Cie\u0144 LaTeXDrawFrame.9=Wybierz kolor cienia LaTeXDrawFrame.1=Gradient 1 LaTeXDrawFrame.2=Gradient 2 LaTeXDrawFrame.4=Dodaj cie\u0144 do figury LaTeXDrawFrame.5=Wybierz kolor cienia LaTeXDrawFrame.6=Pozycje figur na rysunku LaTeXDrawFrame.7=Wybierz pierwszy kolor gradientu LaTeXDrawFrame.8=Wybierz drugi kolor gradientu ParametersTextFrame.0=Nieprzezroczysto\u015B\u0107 ParametersTextFrame.1=Lista obramowa\u0144 ParametersTextFrame.2=Nieprzezroczyste t\u0142o ParametersTextFrame.3=Okr\u0105g ParametersTextFrame.4=Prostok\u0105t ParametersTextFrame.5=Tr\u00F3jk\u0105t ParametersTextFrame.6=Romb ParametersTextFrame.7=Elipsa ParametersTextFrame.8=Prosta ramka ParametersTextFrame.9=Wiele obramowa\u0144 ParametersGridFrame.0=Parametry siatki ParametersTextFrame.10=W\u0142\u0105cz ramki ParametersTextFrame.11=Dodaj ParametersTextFrame.12=Zmie\u0144 ParametersTextFrame.13=Usu\u0144 ParametersTextFrame.14=Separator: ParametersTextFrame.15=Edytuj ParametersTextFrame.16=Dopasuj rozmiar ramki ParametersTextFrame.17=Je\u015Bli wybrane, t\u0142o b\u0119dzie nieprzezroczyste. ParametersTextFrame.18=Ramki ParametersTextFrame.20=Tworzy jedn\u0105 lub wi\u0119cej ramek wok\u00F3\u0142 tekstu. ParametersTextFrame.21=Ramka b\u0119dzie prostok\u0105tem. ParametersTextFrame.22=Ramka b\u0119dzie tr\u00F3jk\u0105tem. ParametersTextFrame.23=Tworzy pojedyncz\u0105 ramk\u0119 wok\u00F3\u0142 ca\u0142ego tekstu. ParametersTextFrame.24=Ramka b\u0119dzie elips\u0105. ParametersTextFrame.25=Ramka b\u0119dzie rombem. ParametersTextFrame.26=Tworzy wiele ramek wok\u00F3\u0142 r\u00F3\u017Cnych cz\u0119\u015Bci tekstu. ParametersTextFrame.27=Ramka b\u0119dzie okr\u0119giem. ParametersTextFrame.28=Dodaje now\u0105 ramk\u0119. ParametersTextFrame.29=Edytuje wybran\u0105 ramk\u0119. ParametersTextFrame.30=Usuwa wybran\u0105 ramk\u0119. ParametersTextFrame.31=Zmienia odst\u0119p mi\u0119dzy tekstem a ramk\u0105. ParametersTextFrame.32=Je\u015Bli wybrane, ramka nie b\u0119dzie nak\u0142ada\u0107 si\u0119 na inne litery tekstu. ParametersTextFrame.33=Otw\u00F3rz panel z parametrami ramki, aby edytowa\u0107. ParametersTextFrame.34=Wyb\u00F3r tekstu. ParametersTextFrame.35=Wybierz tekst do ramki: ParametersTextFrame.36=Wyb\u00F3r tekstu ParametersTextFrame.37=Niepoprawna ramka; nak\u0142ada si\u0119 na inn\u0105 ramk\u0119. AbstractParametersFrame.0=Wymiary/Pozycja AbstractParametersFrame.1=K\u0105t cienia AbstractParametersFrame.2=Rozmiar cienia AbstractParametersFrame.3=K\u0105t gradientu AbstractParametersFrame.4=Punkt \u015Brodkowy AbstractParametersFrame.6=Inne AbstractParametersFrame.7=Zaokr\u0105glenie: AbstractParametersFrame.8=Kreskowanie AbstractParametersFrame.9=Podw\u00F3jna linia AbstractParametersFrame.11=Wype\u0142nienie AbstractParametersFrame.12=Gradient BatchConvertFrame.0=W tych samych folderach latexdraw-2.0.8+1.orig/lang/en-US/0000755000000000000000000000000011347255510013350 5ustar latexdraw-2.0.8+1.orig/lang/en-US/1_9.properties0000644000000000000000000000777711347255510016100 0ustar LaTeXDrawFrame.0=Recent files LaTeXDrawFrame.1=Draw Closed B\u00E9zier Curve LaTeXDrawFrame.2=Clear all LaTeXDrawFrame.3=Shortcuts LaTeXDrawFrame.4=Check update LaTeXDrawFrame.5=Shapes LaTeXDrawFrame.6=Set visible all the figures LaTeXDrawFrame.7=If a figure has its coordinates under (0,0), you cannot see it.
This button allows to replace all the figures in order to be visible. LaTeXDrawFrame.8=Define the properties of the handlers. LaTeXDrawFrame.9=Handlers opacity LaTeXDrawFrame.10=Define the transparency of the handlers. LaTeXDrawFrame.11=Draw a closed B\u00E9zier curve LaTeXDrawFrame.12=Check that the version of the Java Runtime Environment you used
to create this file is the same of this JRE you currently use. LaTeXDrawFrame.13=The help directory is unreachable, the help page cannot be loaded. LaTeXDrawFrame.14=Not able to create the help page. PSTricksParser.0=\\begin{center} must be out of \\begin{pspicture}...\\end{pspicture} PSTricksParser.1=\\end{center} must be out of \\begin{pspicture}...\\end{pspicture} PSTricksParser.2=\\end{figure} must be out of \\begin{pspicture}...\\end{pspicture} PSTricksParser.3=\\end{pspicture} or \\pspicture not found. DrawPanel.0=Update figures to the grid ParametersAkinPointsFrame.0=Points interval: ParametersAkinPointsFrame.1=Open ParametersAkinPointsFrame.2=type: ParametersAkinPointsFrame.3=Free hand parameters ParametersBezierCurveFrame.2=Equilibrate ParametersBezierCurveFrame.3=Equilibrate the control points in respect of the position of the points. ParametersBezierCurveFrame.4=Distance: ParametersBezierCurveFrame.5=Define the space between the control point and the point when equilibrating the curve. ParametersBezierCurveFrame.6=X 1st ctrl pt ParametersBezierCurveFrame.7=Y 1st ctrl pt ParametersBezierCurveFrame.8=X 2nd ctrl pt ParametersBezierCurveFrame.9=Y 2nd ctrl pt PreferencesFrame.0=Number of recent files: PreferencesFrame.1=Theme (need restart): ShortcutsFrame.1=Sequence ShortcutsFrame.3=Category ShortcutsFrame.4=Navigation ShortcutsFrame.5=Transformation ShortcutsFrame.6=Drawing ShortcutsFrame.7=\ (big move) ShortcutsFrame.8=left click ShortcutsFrame.9=Move the horizontal scrollbar to the right ShortcutsFrame.10=Move the horizontal scrollbar to the left ShortcutsFrame.11=Move the vertical scrollbar to the top ShortcutsFrame.12=Move the vertical scrollbar to the bottom ShortcutsFrame.14=Go to the end of the horizontal scrollbar ShortcutsFrame.15=Go to the beginning of the horizontal scrollbar ShortcutsFrame.16=Go to the top of the vertical scrollbar ShortcutsFrame.17=Go to the bottom of the vertical scrollbar ShortcutsFrame.18=Move the selected figures to the right ShortcutsFrame.19=Move the selected figures to the left ShortcutsFrame.20=Move the selected figures to the top ShortcutsFrame.21=Move the selected figures to the bottom ShortcutsFrame.23=Update the selected figures to the displayed grid ShortcutsFrame.25=Select all the figures of the drawing ShortcutsFrame.26=Add the clicked figure to the selection ShortcutsFrame.27=Remove the clicked figure from the selection ShortcutsFrame.28=Select the next or the first figure (in selection mode only) ShortcutsFrame.29=Mouse wheel ShortcutsFrame.30=Zoom in/out MenusListener.0=Press the left button and drag the mouse to place the second point. Release the button to finish the creation. MenusListener.1=A left-click to add a point, a right-click or a double left-click to place the last point and to finish the creation. MenusListener.4=Press the left button and drag the mouse to place the last point. Release the button to finish the creation. MenusListener.5=A left-click adds text. MenusListener.6=A left-click adds a grid. MenusListener.7=A left-click adds axes. MenusListener.8=Press the left button and drag the mouse to draw the shape. Release the button to finish the creation. MenusListener.9=A left-click adds a dot. RecentFilesListener.0=It is impossible to access to this file. RecentFilesListener.1=Cannot open the file latexdraw-2.0.8+1.orig/lang/en-US/LaTeXDrawFrame.properties0000644000000000000000000002127011347255510020236 0ustar LaTeXDrawFrame.0=\ help LaTeXDrawFrame.1=About LaTeXDrawFrame.2=Draw line LaTeXDrawFrame.3=Draw rectangle LaTeXDrawFrame.4=Draw dot LaTeXDrawFrame.5=Draw square LaTeXDrawFrame.6=Draw rhombus LaTeXDrawFrame.7=Freehand LaTeXDrawFrame.8=Draw triangle LaTeXDrawFrame.9=Draw circle LaTeXDrawFrame.10=Draw grid LaTeXDrawFrame.11=Draw ellipse LaTeXDrawFrame.12=Draw polygon LaTeXDrawFrame.13=Select figure(s) LaTeXDrawFrame.14=Display borders LaTeXDrawFrame.15=Auto borders adjustment LaTeXDrawFrame.16=Export as... LaTeXDrawFrame.17=Delete Figure LaTeXDrawFrame.18=Quit LaTeXDrawFrame.19=PSTricks code LaTeXDrawFrame.20=JPEG picture LaTeXDrawFrame.21=EPS picture LaTeXDrawFrame.22=Redo LaTeXDrawFrame.23=Undo LaTeXDrawFrame.25=Save project LaTeXDrawFrame.26=Save as project LaTeXDrawFrame.27=Open project LaTeXDrawFrame.28=New project LaTeXDrawFrame.29=Print code LaTeXDrawFrame.30=Print drawing LaTeXDrawFrame.31=Behind a figure LaTeXDrawFrame.32=In front of a figure LaTeXDrawFrame.33=Group LaTeXDrawFrame.34=Separate LaTeXDrawFrame.35=Draw arc LaTeXDrawFrame.36=Draw wedge LaTeXDrawFrame.37=Draw chord LaTeXDrawFrame.38=X-Scale LaTeXDrawFrame.39=Y-Scale LaTeXDrawFrame.40=Copy LaTeXDrawFrame.41=Update templates LaTeXDrawFrame.42=Export as template LaTeXDrawFrame.43=Paste LaTeXDrawFrame.44=Cut LaTeXDrawFrame.45=Standard Grid LaTeXDrawFrame.46=Code Panel LaTeXDrawFrame.47=Borders LaTeXDrawFrame.48=Interior LaTeXDrawFrame.49=Hatchings LaTeXDrawFrame.51=filled LaTeXDrawFrame.53=Figure Properties LaTeXDrawFrame.55=Add comments LaTeXDrawFrame.56=Preferences LaTeXDrawFrame.57=Zoom in LaTeXDrawFrame.58=Zoom out LaTeXDrawFrame.60=Add text LaTeXDrawFrame.61=Foreground LaTeXDrawFrame.62=Background LaTeXDrawFrame.63=Draw B\u00E9zier curve LaTeXDrawFrame.64=Rotate the figure LaTeXDrawFrame.65=Change the thickness of the figure LaTeXDrawFrame.66=Change the color of the borders of the figure LaTeXDrawFrame.67=If selected, the figure will be filled LaTeXDrawFrame.68=Change the color of the interior of the figure LaTeXDrawFrame.69=Change the color of the hatchings LaTeXDrawFrame.70=Put the figure in the foreground LaTeXDrawFrame.71=Put the figure in the background LaTeXDrawFrame.72=Select the figure which will be behind the selected figure LaTeXDrawFrame.73=Select the figure which will be in front of the selected figure LaTeXDrawFrame.74=If activated, you can rotate a figure with the mouse using handlers LaTeXDrawFrame.75=Group several figures LaTeXDrawFrame.76=Separate several figures LaTeXDrawFrame.77=Define the position of the borders of the figure LaTeXDrawFrame.78=If selected, the figure will have double borders LaTeXDrawFrame.79=Change to color of the space between the double borders LaTeXDrawFrame.80=\ Thickness LaTeXDrawFrame.82=An error occurred during the launch of LaTeXDraw:
LaTeXDrawFrame.83=LaTeXDraw is not able to start LaTeXDrawFrame.86=LaTeXDraw Error LaTeXDrawFrame.88=File LaTeXDrawFrame.89=Edit LaTeXDrawFrame.90=Display LaTeXDrawFrame.91=Draw LaTeXDrawFrame.92=Code LaTeXDrawFrame.93=Help LaTeXDrawFrame.94=Zoom in the drawing LaTeXDrawFrame.95=Zoom out the drawing LaTeXDrawFrame.96=Zoom 100% LaTeXDrawFrame.103=Templates LaTeXDrawFrame.105=Not able to create the templates menu\! LaTeXDrawFrame.107=Toolbar LaTeXDrawFrame.108=Create a new project LaTeXDrawFrame.109=Open a project LaTeXDrawFrame.110=Save the project LaTeXDrawFrame.113=100% LaTeXDrawFrame.114=Undo an action LaTeXDrawFrame.115=Redo an action LaTeXDrawFrame.116=Draw a line LaTeXDrawFrame.117=Draw a dot LaTeXDrawFrame.118=Draw a rectangular shape LaTeXDrawFrame.119=Draw a rectangle LaTeXDrawFrame.120=Draw a square LaTeXDrawFrame.121=Draw a polygon LaTeXDrawFrame.123=Draw a rhombus LaTeXDrawFrame.124=Draw a triangle LaTeXDrawFrame.125=Draw an ellipse LaTeXDrawFrame.127=Draw a circle LaTeXDrawFrame.128=Draw an arc LaTeXDrawFrame.130=Draw a wedge LaTeXDrawFrame.131=Draw a chord LaTeXDrawFrame.132=Draw a B\u00E9zier curve LaTeXDrawFrame.133=Draw a grid LaTeXDrawFrame.136=Select one or several figures
LaTeXDrawFrame.137=Piece of advice : to select several LaTeXDrawFrame.138=figures, click and
drag the mouse on the figures you want LaTeXDrawFrame.139=Delete the selected figure(s) LaTeXDrawFrame.140=Change the figure properties LaTeXDrawFrame.141=Display the borders of the drawing
LaTeXDrawFrame.142=Piece of advice : if you display the borders of the
LaTeXDrawFrame.143=drawing, disable the borders autoupdate to be able to
LaTeXDrawFrame.144=change the dimensions of the drawing LaTeXDrawFrame.146=Copied... LaTeXDrawFrame.147=Pasted... LaTeXDrawFrame.148=Cut... LaTeXDrawFrame.149=Deleted... LaTeXDrawFrame.151=Select double borders color LaTeXDrawFrame.154=Grouped... LaTeXDrawFrame.155=Separated... LaTeXDrawFrame.156=Do you want to save the project? LaTeXDrawFrame.158=Redo... LaTeXDrawFrame.159=Undo... LaTeXDrawFrame.160=Templates updated... LaTeXDrawFrame.161=Error for file LaTeXDrawFrame.162=Printing the drawing... LaTeXDrawFrame.163=Drawing printed\! LaTeXDrawFrame.164=Not able to print the drawing\! LaTeXDrawFrame.165=Printing code... LaTeXDrawFrame.166=Code printed\! LaTeXDrawFrame.167=Not able to print the code\! LaTeXDrawFrame.168=Exporting as template... LaTeXDrawFrame.169=Template exported\! LaTeXDrawFrame.170=Exporting as PSTricks code... LaTeXDrawFrame.171=Select LaTeXDrawFrame.172=Export the PSTricks code as a TeX file LaTeXDrawFrame.173=Do you want to replace the file? LaTeXDrawFrame.174=Export as PSTricks LaTeXDrawFrame.175=PSTricks code exported\! LaTeXDrawFrame.176=Not able to export PSTricks code\! LaTeXDrawFrame.177=Exporting as picture... LaTeXDrawFrame.179=Export figures as LaTeXDrawFrame.182=Export as LaTeXDrawFrame.183=\ file LaTeXDrawFrame.184=Export as picture done\! LaTeXDrawFrame.185=Not able to export as picture\! LaTeXDrawFrame.186=Saving project... LaTeXDrawFrame.188=Save the drawing LaTeXDrawFrame.190=Export as JPEG file LaTeXDrawFrame.191=Project saved\! LaTeXDrawFrame.192=Not able to save the project\! LaTeXDrawFrame.193=An error occurred during the saving of a file:
LaTeXDrawFrame.197=Creation of a new project... LaTeXDrawFrame.198=New project created\! LaTeXDrawFrame.200=Open a drawing LaTeXDrawFrame.201=Opening a file... LaTeXDrawFrame.202=File opened\! LaTeXDrawFrame.203=Not able to open file\! LaTeXDrawFrame.204=An error occurred during the loading of a file:
LaTeXDrawFrame.208=
Version LaTeXDrawFrame.209=\ released\! LaTeXDrawFrame.210=New Version LaTeXDrawFrame.211=New version released\! LaTeXDrawFrame.212=No new version LaTeXDrawFrame.213=Unable to check if a new version exists\! LaTeXDrawFrame.215=LaTeXDraw help LaTeXDrawFrame.218=A PSTricks code generator for LaTeX\! LaTeXDrawFrame.219=Version LaTeXDrawFrame.220=, build LaTeXDrawFrame.221=\ is distributed under the terms of the GNU General Public License LaTeXDrawFrame.222=\ as published by the Free Software Foundation (version 2) LaTeXDrawFrame.229=Import... LaTeXDrawFrame.230=From TeX file LFrame2.0=Define the size of a dot. LFrame2.1=Align the selected figures. LFrame2.10=Distribute vertically, at equal distance between, the selected figures. LFrame2.11=Distribute vertically at equal distance between the middle of the selected figures. LFrame2.12=Distribute vertically at equal distance between the top sides of the selected figures. LFrame2.13=Distribute horizontally at equal distance between the left sides of the selected figures. LFrame2.14=Distribute horizontally, at equal distance between, the selected figures. LFrame2.15=Distribute horizontally at equal distance between the middle of the selected figures. LFrame2.16=Distribute horizontally at equal distance between the right sides of the selected figures. LFrame2.17=Colors LFrame2.18=Impossible to open the file. LFrame2.19=This template cannot be found LFrame2.2=Align on the left the selected figures. LFrame2.20=Please, update the templates menu LFrame2.21=Template not found LFrame2.22=The document cannot be printed. LFrame2.23=No printer found. LFrame2.25=The GPL library jlibeps is used to create EPS pictures. LFrame2.3=Align on the right the selected figures. LFrame2.4=Align on the top the selected figures. LFrame2.5=Align on the bottom the selected figures. LFrame2.6=Align horizontally in the middle the selected figures. LFrame2.7=Align vertically in the middle the selected figures. LFrame2.8=Distribute at equal distance the selected figures. LFrame2.9=Distribute vertically, at equal distance between the bottom sides of the selected figures. LFrame2.26=New project with selection latexdraw-2.0.8+1.orig/lang/en-US/1_6.properties0000644000000000000000000000637411347255510016065 0ustar BatchConvertFrame.1=Add sub folders BatchConvertFrame.2=Add files BatchConvertFrame.4=Remove All BatchConvertFrame.5=Overwrite BatchConvertFrame.6=Select path BatchConvertFrame.7=Select format BatchConvertFrame.8=Convert BatchConvertFrame.9=Stop BatchConvertFrame.11=Batch list BatchConvertFrame.12=Select directory BatchConvertFrame.13=Select pictures BatchConvertFrame.14=Convert as: LaTeXDrawFrame.0=Insert PSTricks code LaTeXDrawFrame.1=Insert a picture LaTeXDrawFrame.2=Convert pictures LaTeXDrawFrame.3=stop LaTeXDrawFrame.4=Draw joined lines LaTeXDrawFrame.5=PPM picture LaTeXDrawFrame.6=BMP picture LaTeXDrawFrame.7=PNG picture LaTeXDrawFrame.9=Stop the parsing\! LaTeXDrawFrame.10=Insert LaTeXDrawFrame.11=Insert several figures from PSTricks code LaTeXDrawFrame.14=Draw several joined lines LaTeXDrawFrame.15=Importing a PSTricks file... LaTeXDrawFrame.16=The current PSTricks parser only parses few commands.
You may import only commands managed by LaTeXDraw. LaTeXDrawFrame.17=Import PSTricks code LaTeXDrawFrame.18=This software uses JIU, the Java Imaging Utilities. Distributed under LaTeXDrawFrame.19=the terms of the GNU General Public License. http://schmidt.devlib.org/jiu/ LaTeXDrawFrame.23=Warnings:
  • PSTricks cannot include JPG, BMP,... files; so an EPS picture will be created from the selected picture,
    in the same directory. So the picture will be included only if you have rights to write in the directory;
  • TeX does not support spaces in the path, so try to do not have any.
LaTeXDrawFrame.25=Loading the picture... LaTeXDrawFrame.26=The picture is invalid\! LaTeXDrawFrame.27=Not able to load the picture\! LaTeXDrawFrame.28=Picture inserted\! LaTeXDrawFrame.30=There is no figure to import\!
If it is false, check that they are surrounded by \\begin{pspicture} ...\\end{pspicture}.
You can send the file to LaTeXDrawFrame.31=\ if you think there is a bug in the PSTricks parser. LaTeXDrawFrame.32=No figure found\! LaTeXDrawFrame.33=No figure found to import\! LaTeXDrawFrame.34=Not able to import the PSTricks file\! LaTeXDrawFrame.35=Importation canceled\! LaTeXDrawFrame.36=Code converted into figures\! InsertPSTricksCodeFrame.0=Insert figures from PSTricks code FatalErrorParsingException.0=
If the file is valid, you can send it to arno_b@users.sourceforge.net Picture.0=% Warning: the path of the following picture contains spaces and will not be compiled by tex\! ParserCmdMessage.0=Line ParserCmdMessage.1=Command: ParserCmdMessage.2=Exception: ParserMessagesFrame.0=Command ParserMessagesFrame.1=Line ParserMessagesFrame.2=Exception ParserMessagesFrame.3=One or several warnings occurred during the parsing ParserMessagesFrame.4=TeX parser: warning(s) ParametersGridFrame.0=Invert label position following X ParametersGridFrame.1=Invert label position following Y PSTricksParser.0=Error during the opening of the file: invalid file\! PSTricksParser.1=The incremental pspicture definition is not yet managed:
PSTricksParser.2=\\begin{pspicture}...\\begin{pspicture} ... \\end{pspicture}... PSTricksParser.3=Error during the parsing of the file\! latexdraw-2.0.8+1.orig/lang/en-US/dialogFrames.properties0000644000000000000000000001157211347255510020071 0ustar PreferencesFrame.Pref=Preferences... PreferencesFrame.grid=Grid PreferencesFrame.codePanel=Code panel PreferencesFrame.antiAl=Anti-aliasing PreferencesFrame.rendQ=Rendering quality PreferencesFrame.colRendQ=Color rendering quality PreferencesFrame.AlphaQ=Alpha interpolation quality PreferencesFrame.bordersDraw=Borders of the drawing PreferencesFrame.codeAuto=Code autoupdate (slower) PreferencesFrame.newVers=Check new version on start-up PreferencesFrame.lge=Language (need restart) PreferencesFrame.general=General PreferencesFrame.folders=Folders PreferencesFrame.quality=Quality PreferencesFrame.selectFolder=Select a folder PreferencesFrame.defOpenSave=Default folder for open/save actions: PreferencesFrame.defFold=Default folder for import/export actions: PreferencesFrame.errorReadPref=Error during the reading of the preferences file\! PreferencesFrame.prefSaved=Preferences saved\! DrawPropertiesFrame.0=The label of the drawing DrawPropertiesFrame.1=The caption of the drawing DrawPropertiesFrame.2=Drawing Properties DrawPropertiesFrame.3=pixels per DrawPropertiesFrame.5=In a page with only floats DrawPropertiesFrame.6=At the top of the page DrawPropertiesFrame.7=At the bottom of the page DrawPropertiesFrame.8=Here DrawPropertiesFrame.9=HERE\! DrawPropertiesFrame.10=In the center of the page DrawPropertiesFrame.11=Vertical position of the drawing DrawPropertiesFrame.12=Horizontal position of the drawing DrawPropertiesFrame.13=Change the number of pixels per unit of length ExceptionFrameDialog.0=Send Report ExceptionFrameDialog.1=An error occurred\!
ExceptionFrameDialog.2=
You can send the report to the LaTeXDraw developer ExceptionFrameDialog.3=LaTeXDraw error: an exception occurred ExceptionFrameDialog.4=An error occurred:
ExceptionFrameDialog.5=Not able to create a ExceptionFrameDialog AbstractParametersFrame.0=Double boundary AbstractParametersFrame.2=Separator: AbstractParametersFrame.3=Generals parameters AbstractParametersFrame.4=Ok AbstractParametersFrame.5=Default AbstractParametersFrame.6=Cancel AbstractParametersFrame.7=Angle of rotation: AbstractParametersFrame.8=Thickness: AbstractParametersFrame.10=Type of line: AbstractParametersFrame.11=Hatchings Width: AbstractParametersFrame.12=Left Arrow: AbstractParametersFrame.13=Right Arrow: AbstractParametersFrame.14=Arrows parameters AbstractParametersFrame.15=Show ctrl points AbstractParametersFrame.16=Rounded AbstractParametersFrame.17=X-center coordinate: AbstractParametersFrame.18=Y-center coordinate: AbstractParametersFrame.19=Radius: AbstractParametersFrame.20=Dot diameter = AbstractParametersFrame.21=Bar width = AbstractParametersFrame.22=Bracket length = AbstractParametersFrame.23=Rounded bracket lgth = AbstractParametersFrame.24=x thickness + AbstractParametersFrame.25=x width AbstractParametersFrame.26=Arrow length AbstractParametersFrame.27=Arrow inset AbstractParametersFrame.28=Arrow width AbstractParametersFrame.29=X-coordinate: AbstractParametersFrame.30=Y-coordinate: AbstractParametersFrame.31=Width: AbstractParametersFrame.32=Height: AbstractParametersFrame.33=Parameters of the shape AbstractParametersFrame.34=Select hatchings color AbstractParametersFrame.35=Select double boundary color AbstractParametersFrame.36=Select borders color AbstractParametersFrame.37=Select interior color AbstractParametersFrame.38=Arrows ParametersArcFrame.0=start angle: ParametersArcFrame.1=end angle: ParametersArcFrame.2=Type of arc: ParametersDotFrame.0=Type of dot: ParametersDrawFrame.0=North-West X ParametersDrawFrame.1=North-West Y ParametersDrawFrame.2=South-East X ParametersDrawFrame.3=South-East Y ParametersGridFrame.0=Y Origin: ParametersGridFrame.1=X Origin: ParametersGridFrame.2=Labels: ParametersGridFrame.3=Unit: ParametersGridFrame.4=Subgrid dots: ParametersGridFrame.5=Grid dots: ParametersGridFrame.6=Grid width: ParametersGridFrame.7=Subgrid width: ParametersGridFrame.8=Subgrid division: ParametersGridFrame.9=Label size: ParametersLineFrame.0=Left X-coordinate: ParametersLineFrame.1=Left Y-coordinate: ParametersLineFrame.2=Right X-coordinate: ParametersLineFrame.3=Right Y-coordinate: ParametersTextFrame.0=Bold ParametersTextFrame.1=Italic ParametersTextFrame.2=Font: ParametersTextFrame.3=Size: ParametersTextFrame.4=Text ParametersGridFrame.10=Subgrid: ParametersGridFrame.11=X max: ParametersGridFrame.12=X min: ParametersGridFrame.13=Y max: ParametersGridFrame.14=Y min: ParametersGridFrame.15=Draw labels ParametersGridFrame.17=Select labels color ParametersGridFrame.18=Select subgrid color ParametersPolygonFrame.1=Point n\u00B0 ParametersTriangleFrame.0=Base center X-coord: ParametersTriangleFrame.1=Base center Y-coord: ParamsBC.0=Move all ParamsBC.1=If not selected, when you move a point its control points are moved too. ExportDialog.0=Compression latexdraw-2.0.8+1.orig/lang/en-US/1_8.properties0000644000000000000000000000445111347255510016061 0ustar UndoRedoManager.0=Transformation AbstractParametersFrame.0=interval: ParametersAxeFrame.0=Shape: ParametersAxeFrame.1=Show origin ParametersAxeFrame.2=Axes ParametersAxeFrame.3=Display X-labels ParametersAxeFrame.4=Display Y-labels ParametersAxeFrame.5=Define distance between labels (cm) ParametersAxeFrame.6=X-labels distance: ParametersAxeFrame.7=Y-labels distance: ParametersAxeFrame.8=X-labels increment: ParametersAxeFrame.9=Y-labels increment: ParametersAxeFrame.10=X-labels origin: ParametersAxeFrame.11=Y-labels origin: ParametersAxeFrame.12=Labels ParametersAxeFrame.13=Size: ParametersAxeFrame.14=Style: ParametersAxeFrame.15=Display X-ticks ParametersAxeFrame.16=Display Y-ticks ParametersAxeFrame.17=Ticks PreferencesFrame.3=Path of your LaTeX editor: PreferencesFrame.4=Standard grid PreferencesFrame.5=Personal grid PreferencesFrame.6=Magnetic grid PreferencesFrame.7=Interval: LaTeXDrawFrame.0=Draw Axes LaTeXDrawFrame.2=Rotate the selected figure(s). LaTeXDrawFrame.3=Rotate the selected figure(s) of 90\u00B0. LaTeXDrawFrame.4=Rotate the selected figure(s) of 180\u00B0. LaTeXDrawFrame.5=Rotate the selected figure(s) of 270\u00B0. LaTeXDrawFrame.6=Reverse figures by symmetry. LaTeXDrawFrame.7=Reverse horizontally the selected figures. LaTeXDrawFrame.8=Reverse vertically the selected figures. LaTeXDrawFrame.10=Display a standard grid (in cm or inch). LaTeXDrawFrame.11=Display a grid you can modify the interval between its lines. LaTeXDrawFrame.12=Contains the parameters of the (magnetic) grid LaTeXDrawFrame.13=magnetic LaTeXDrawFrame.14=If selected, the figures will be magnetic to the grid. LaTeXDrawFrame.15=Define the interval between the lines of the personal grid (in pixels). LaTeXDrawFrame.16=Draw grids and axes. LaTeXDrawFrame.17=Draw axes. LaTeXDrawFrame.18=Launch your LaTeX editor. LaTeXDrawFrame.19=Launching of your LaTeX editor... LaTeXDrawFrame.20=You must define the path of your LaTeX editor in the panel of preferences. LaTeXDrawFrame.21=The file you selected is invalid. LaTeXDrawFrame.22=Redefine the path in the panel of preferences. LaTeXDrawFrame.23=Close LaTeXDrawFrame.25=Libraries LaTeXDrawFrame.26=Translators LaTeXDrawFrame.27=Release note LaTeXDrawFrame.28=License Axe.0=None Axe.1=Axe Axe.2=Frame Axe.3=Full Axe.4=Top Axe.5=Bottom latexdraw-2.0.8+1.orig/lang/en-US/others.properties0000644000000000000000000000401411347255510016771 0ustar XScale.cm=cm XScale.inch=inch LaTeXDrawException.valueInc=Value incorrect LaTeXDrawException.invFile=This file is not a LaTeXDraw file\! LaTeXDrawException.invLaTeXDrawVer=This version of LaTeXDraw is not managed\! LaTeXDrawException.invException=LaTeXDrawException: unknown error code Arc.arc=Arc Arc.wedge=Wedge Arc.chord=Chord Arc.arcType=Kind of arc Figure.boundPos=Boundary position DrawContainer.nameTemplate=Enter the name of the template DrawContainer.overwriteTemplate=This template already exists; overwrite it? CloseButton.closePanel=Close the panel UndoRedoManager.changeParams=Change parameters UndoRedoManager.changeDispo=Change disposition UndoRedoManager.move=Move UndoRedoManager.delete=Delete UndoRedoManager.create=Create UndoRedoManager.join=Join UndoRedoManager.seperate=Separate UndoRedoManager.filled=Change interior style UndoRedoManager.intCol=Change interior color UndoRedoManager.bordCol=Change borders color UndoRedoManager.thick=Change thickness UndoRedoManager.style=Change style UndoRedoManager.lArrow=Change left arrow style UndoRedoManager.rArrow=Change right arrow style UndoRedoManager.dotStyle=Change dot style UndoRedoManager.noRedo=No redo possible UndoRedoManager.noUndo=No undo possible UndoRedoManager.align=alignment UndoRedoManager.distrib=distribution CodePanel.reload=Reload CodePanel.autoUpdate=Auto update CodePanel.copySel=Copy the selected text CodePanel.copyAll=Copy all the code CodePanel.tip=
If selected, the code is updated in real time
Piece of advice : disable the autoupdate or do not
display the codepanel when the drawing is complex or
when you move a big figure.
CodePanel.updateCode=Update the code CodePanel.addComment=Add comments to the code CodePanel.reloadText=PSTricks code reloaded\! CodePanel.copiedText=PSTricks code copied in the clipboard\! CodePanel.copiedSelText=Selection copied in the clipboard\! SVGManager.0=Unable to generate the shapes from the SVG document. latexdraw-2.0.8+1.orig/lang/en-US/1_7.properties0000644000000000000000000000526511347255510016064 0ustar LaTeXDrawException.0=Invalid picture. LaTeXDrawFrame.0=Shadow LaTeXDrawFrame.9=Select shadow color LaTeXDrawFrame.1=Gradient 1 LaTeXDrawFrame.2=Gradient 2 LaTeXDrawFrame.4=Add a shadow to the figure. LaTeXDrawFrame.5=Choose the color of the shadow. LaTeXDrawFrame.6=Position figures into the drawing (in front of, behind,...). LaTeXDrawFrame.7=Choose the first color of the gradient. LaTeXDrawFrame.8=Choose the second color of the gradient. ParametersTextFrame.0=Opacity ParametersTextFrame.1=Boxes list ParametersTextFrame.2=Opaque ParametersTextFrame.3=Circle ParametersTextFrame.4=Rectangle ParametersTextFrame.5=Triangle ParametersTextFrame.6=Diamond ParametersTextFrame.7=Ellipse ParametersTextFrame.8=Simple box ParametersTextFrame.9=Several boxes ParametersGridFrame.0=Grid parameters ParametersTextFrame.10=Enable framed box(es) ParametersTextFrame.11=Add ParametersTextFrame.12=Modify ParametersTextFrame.13=Remove ParametersTextFrame.14=Separator: ParametersTextFrame.15=Edit box ParametersTextFrame.16=Consider box size ParametersTextFrame.17=If selected, the background of the text will be opaque. ParametersTextFrame.18=Framed box(es) ParametersTextFrame.20=Create a or several frames around the text. ParametersTextFrame.21=The box will be a rectangle. ParametersTextFrame.22=The box will be a triangle. ParametersTextFrame.23=Create a simple box around the whole text. ParametersTextFrame.24=The box will be an ellipse. ParametersTextFrame.25=The box will be a diamond. ParametersTextFrame.26=Create several boxes around different parts of the text. ParametersTextFrame.27=The box will be a circle. ParametersTextFrame.28=Add a new box. ParametersTextFrame.29=Edit the position of the selected box. ParametersTextFrame.30=Remove the selected box. ParametersTextFrame.31=Change the spacing between the text and the box. ParametersTextFrame.32=If selected, the box will not be drawn on the text at the start and the end of the framed text. ParametersTextFrame.33=Open the panel of parameters of the box to edit it. ParametersTextFrame.34=Text selection ParametersTextFrame.35=Select the text to frame: ParametersTextFrame.36=Text Selection ParametersTextFrame.37=Invalid box; it overlaps another box. AbstractParametersFrame.0=Dimensions/Position AbstractParametersFrame.1=Shadow angle AbstractParametersFrame.2=Shadow size AbstractParametersFrame.3=Gradient angle AbstractParametersFrame.4=Middle Pt AbstractParametersFrame.6=Other AbstractParametersFrame.7=Round corner: AbstractParametersFrame.8=Hatching AbstractParametersFrame.9=Double line AbstractParametersFrame.11=Replenishment AbstractParametersFrame.12=Gradient BatchConvertFrame.0=In the same directories latexdraw-2.0.8+1.orig/lang/tr/0000755000000000000000000000000011347255510013046 5ustar latexdraw-2.0.8+1.orig/lang/tr/1_9.properties0000644000000000000000000001205311347255510015555 0ustar LaTeXDrawFrame.0=Son dosyalar LaTeXDrawFrame.1=Kapal\u0131 B\u00E9zier E\u011Frisi \u00C7iz LaTeXDrawFrame.2=T\u00FCm\u00FCn\u00FC Temizle LaTeXDrawFrame.3=K\u0131sayollar LaTeXDrawFrame.4=G\u00FCncellemelere bak LaTeXDrawFrame.5=\u015Eekiller LaTeXDrawFrame.6=T\u00FCm nesneleri g\u00F6r\u00FCn\u00FCr yap LaTeXDrawFrame.7=E\u011Fer bir nesnenin s\u0131f\u0131r\u0131n alt\u0131nda ise g\u00F6remezsiniz.
Bu d\u00FC\u011Fme, nesneleri, t\u00FCm\u00FC g\u00F6r\u00FCnecek \u015Fekilde yeniden yerle\u015Ftirir. LaTeXDrawFrame.8=Tutma Noktalar\u0131n\u0131n \u00F6zeliklerini belirler. LaTeXDrawFrame.9=Tutma noktalar\u0131n\u0131n belirginli\u011Fi LaTeXDrawFrame.10=Tutma noktalar\u0131n\u0131n saydaml\u0131\u011F\u0131n\u0131 belirle LaTeXDrawFrame.11=Kapal\u0131 B\u00E9zier e\u011Frisi \u00E7iz LaTeXDrawFrame.12=Bu dosyay\u0131 olu\u015Ftururken kullan\u0131lan Java Runtime Environment
ile \u015Fu anki JRE s\u00FCr\u00FCm\u00FCn\u00FCn ayn\u0131 oldu\u011Funa emin olun. LaTeXDrawFrame.13=Yard\u0131m dizinine eri\u015Filemiyor. Yard\u0131m sayfas\u0131 y\u00FCklenemedi. LaTeXDrawFrame.14=Yard\u0131m sayfas\u0131 olu\u015Fturulamad\u0131. PSTricksParser.0=begin{center} kal\u0131b\u0131, begin{pspicture}...end{pspicture} kal\u0131b\u0131 d\u0131\u015F\u0131nda olmal\u0131 PSTricksParser.1=end{center} kal\u0131b\u0131, begin{pspicture}...end{pspicture} kal\u0131b\u0131 d\u0131\u015F\u0131nda olmal\u0131 PSTricksParser.2=end{figure} kal\u0131b\u0131, begin{pspicture}...end{pspicture} kal\u0131b\u0131 d\u0131\u015F\u0131nda olmal\u0131 PSTricksParser.3=end{pspicture} veya pspicture bulunamad\u0131. DrawPanel.0=Nesneleri \u0131zgaraya g\u00F6re g\u00FCncelle ParametersAkinPointsFrame.0=Nokta aral\u0131\u011F\u0131: ParametersAkinPointsFrame.1=A\u00E7\u0131k U\u00E7 ParametersAkinPointsFrame.2=K\u00F6\u015Fe tipi: ParametersAkinPointsFrame.3=Elle \u00E7izme parametreleri ParametersBezierCurveFrame.2=E\u015Fitle ParametersBezierCurveFrame.3=\u00C7izim noktalar\u0131ndaki te\u011Fetlerin boylar\u0131n\u0131 verilen uzakl\u0131\u011Fa e\u015Fitler. ParametersBezierCurveFrame.4=Uzakl\u0131k: ParametersBezierCurveFrame.5=Te\u011Fetler ile \u00E7izim noktalar\u0131 aras\u0131ndaki uzakl\u0131\u011F\u0131 girin ParametersBezierCurveFrame.6=X 1. Te\u011Fet Noktas\u0131 ParametersBezierCurveFrame.7=Y 1. Te\u011Fet Noktas\u0131 ParametersBezierCurveFrame.8=X 2. Te\u011Fet Noktas\u0131 ParametersBezierCurveFrame.9=Y 2. Te\u011Fet Noktas\u0131 PreferencesFrame.0=G\u00F6sterilecek Son dosyalar\u0131n say\u0131s\u0131: PreferencesFrame.1=Tema (Bir Sonraki A\u00E7\u0131l\u0131\u015Fta) ShortcutsFrame.1=K\u0131sayol ShortcutsFrame.3=S\u0131n\u0131f ShortcutsFrame.4=Gezinme ShortcutsFrame.5=D\u00F6n\u00FC\u015F\u00FCm ShortcutsFrame.6=\u00C7izim ShortcutsFrame.7=\ (b\u00FCy\u00FCk ad\u0131m) ShortcutsFrame.8=sol t\u0131k ShortcutsFrame.9=Yatay kayd\u0131rma \u00E7ubu\u011Funu sa\u011Fa kayd\u0131r ShortcutsFrame.10=Yatay kayd\u0131rma \u00E7ubu\u011Funu sola kayd\u0131r ShortcutsFrame.11=D\u00FC\u015Fey kayd\u0131rma \u00E7ubu\u011Funu yukar\u0131 kayd\u0131r ShortcutsFrame.12=D\u00FC\u015Fey kayd\u0131rma \u00E7ubu\u011Funu a\u015Fa\u011F\u0131 kayd\u0131r ShortcutsFrame.14=Yatay kayd\u0131rma \u00E7ubu\u011Funun sonuna git ShortcutsFrame.15=Yatay kayd\u0131rma \u00E7ubu\u011Funun ba\u015F\u0131na git ShortcutsFrame.16=D\u00FC\u015Fey kayd\u0131rma \u00E7ubu\u011Funun ba\u015F\u0131na git ShortcutsFrame.17=D\u00FC\u015Fey kayd\u0131rma \u00E7ubu\u011Funun sonuna git ShortcutsFrame.18=Se\u00E7ili nesneleri sa\u011Fa kayd\u0131r ShortcutsFrame.19=Se\u00E7ili nesneleri sola kayd\u0131r ShortcutsFrame.20=Se\u00E7ili nesneleri yukar\u0131 kayd\u0131r ShortcutsFrame.21=Se\u00E7ili nesneleri a\u015Fa\u011F\u0131 kayd\u0131r ShortcutsFrame.23=Se\u00E7ili nesneleri g\u00F6sterilen \u0131zgaraya ayarla ShortcutsFrame.25=T\u00FCm nesneleri se\u00E7 ShortcutsFrame.26=T\u0131klanan nesneyi se\u00E7ime ekle ShortcutsFrame.27=T\u0131klanan nesneyi se\u00E7imden \u00E7\u0131kar ShortcutsFrame.28=\u0130lk veya s\u0131radaki nesneyi se\u00E7 (sadece se\u00E7im kipinde) ShortcutsFrame.29=Fare tekeri ShortcutsFrame.30=Yakla\u015F/Uzakla\u015F MenusListener.0=\u0130kinci noktay\u0131 belirlemek i\u00E7in, sol t\u0131klayarak fareyi s\u00FCr\u00FCkleyin. Tamamlamak i\u00E7in sol d\u00FC\u011Fmeyi b\u0131rak\u0131n. MenusListener.1=Nokta eklemek i\u00E7in sol, son noktay\u0131 koymak ve tamamlamak i\u00E7in sa\u011F veya \u00E7ift sol t\u0131klay\u0131n. MenusListener.4=Son noktay\u0131 belirlemek i\u00E7in, sol t\u0131klayarak fareyi s\u00FCr\u00FCkleyin. Tamamlamak i\u00E7in sol d\u00FC\u011Fmeyi b\u0131rak\u0131n. MenusListener.5=Sol t\u0131klama metin ekler. MenusListener.6=Sol t\u0131klama \u0131zgara ekler. MenusListener.7=Sol t\u0131klama eksen tak\u0131m\u0131 ekler. MenusListener.8=\u015Eekli belirlemek i\u00E7in, sol t\u0131klayarak fareyi s\u00FCr\u00FCkleyin. Tamamlamak i\u00E7in sol d\u00FC\u011Fmeyi b\u0131rak\u0131n. MenusListener.9=Sol t\u0131klama nokta ekler. RecentFilesListener.0=Bu dosyaya eri\u015Filemiyor. RecentFilesListener.1=Dosya a\u00E7\u0131lam\u0131yor latexdraw-2.0.8+1.orig/lang/tr/LaTeXDrawFrame.properties0000644000000000000000000002512011347255510017732 0ustar LaTeXDrawFrame.0=\ Yard\u0131m LaTeXDrawFrame.1=Hakk\u0131nda LaTeXDrawFrame.2=\u00C7izgi \u00E7iz LaTeXDrawFrame.3=Dikd\u00F6rtgen \u00E7iz LaTeXDrawFrame.4=Nokta \u00E7iz LaTeXDrawFrame.5=Kare \u00C7iz LaTeXDrawFrame.6=E\u015Fkenar d\u00F6rtgen \u00E7iz LaTeXDrawFrame.7=Serbest \u00C7izim LaTeXDrawFrame.8=\u00DC\u00E7gen \u00E7iz LaTeXDrawFrame.9=Daire \u00E7iz LaTeXDrawFrame.10=Izgara \u00C7iz LaTeXDrawFrame.11=Elips \u00E7iz LaTeXDrawFrame.12=\u00C7okgen \u00E7iz LaTeXDrawFrame.13=Nesne Se\u00E7 LaTeXDrawFrame.14=Kenarl\u0131klar\u0131 g\u00F6ster LaTeXDrawFrame.15=Kenarl\u0131klar\u0131 otumatik ayarla LaTeXDrawFrame.16=D\u0131\u015Fa aktar... LaTeXDrawFrame.17=Nesne sil LaTeXDrawFrame.18=\u00C7\u0131k\u0131\u015F LaTeXDrawFrame.19=PSTricks Kodu LaTeXDrawFrame.20=JPEG resim LaTeXDrawFrame.21=EPS resim LaTeXDrawFrame.22=Tekrar Yap LaTeXDrawFrame.23=Geri al LaTeXDrawFrame.25=Projeyi kaydet LaTeXDrawFrame.26=Projeyi yeni adla kaydet LaTeXDrawFrame.27=Proje a\u00E7 LaTeXDrawFrame.28=Yeni proje LaTeXDrawFrame.29=Kodu yazd\u0131r LaTeXDrawFrame.30=\u00C7izimi yazd\u0131r LaTeXDrawFrame.31=Arkas\u0131nda LaTeXDrawFrame.32=\u00D6n\u00FCnde LaTeXDrawFrame.33=Grupla LaTeXDrawFrame.34=Ay\u0131r LaTeXDrawFrame.35=Yay \u00E7iz LaTeXDrawFrame.36=Dilim \u00C7iz LaTeXDrawFrame.37=Kiri\u015F \u00E7iz LaTeXDrawFrame.38=X-Esnetme LaTeXDrawFrame.39=Y-Esnetme LaTeXDrawFrame.40=Kopyala LaTeXDrawFrame.41=Kal\u0131p listesini g\u00FCncelle LaTeXDrawFrame.42=Kal\u0131p olarak belirle LaTeXDrawFrame.43=Yap\u0131\u015Ft\u0131r LaTeXDrawFrame.44=Kes LaTeXDrawFrame.45=Standart Izgara LaTeXDrawFrame.46=Komut Paneli LaTeXDrawFrame.47=Kenarl\u0131klar LaTeXDrawFrame.48=\u0130\u00E7 LaTeXDrawFrame.49=Taramalar LaTeXDrawFrame.51=dolgulu LaTeXDrawFrame.53=Nesne \u00F6zellikeri LaTeXDrawFrame.55=Yorum ekle LaTeXDrawFrame.56=Tercihler LaTeXDrawFrame.57=Yak\u0131nla\u015F LaTeXDrawFrame.58=Uzakla\u015F LaTeXDrawFrame.60=Metin ekle LaTeXDrawFrame.61=\u00D6nalan LaTeXDrawFrame.62=Artalan LaTeXDrawFrame.63=B\u00E9zier e\u011Frisi \u00E7iz LaTeXDrawFrame.64=Nesneyi D\u00F6nd\u00FCr LaTeXDrawFrame.65=Nesnenin kal\u0131nl\u0131\u011F\u0131n\u0131 de\u011Fi\u015Ftir LaTeXDrawFrame.66=Nesnenin kenarl\u0131klar\u0131n\u0131n rengini de\u011Fi\u015Ftir LaTeXDrawFrame.67=Se\u00E7ili ise nesnenin i\u00E7ine dolgu eklenir LaTeXDrawFrame.68=Dolgu rengini de\u011Fi\u015Ftir LaTeXDrawFrame.69=Tarama rengini de\u011Fi\u015Ftir LaTeXDrawFrame.70=Nesneyi \u00F6nalana getir LaTeXDrawFrame.71=Nesneyi arkaalana g\u00F6t\u00FCr LaTeXDrawFrame.72=Se\u00E7ili nesnenin arkas\u0131na gelecek nesneyi se\u00E7 LaTeXDrawFrame.73=Se\u00E7ili nesnenin \u00F6n\u00FCne ge\u00E7ecek nesneyi se\u00E7 LaTeXDrawFrame.74=Etkinle\u015Ftirildi\u011Finde, nesneyi tutacaklar\u0131ndan tutup d\u00F6nd\u00FCrebilirsin LaTeXDrawFrame.75=Birka\u00E7 nesneyi grupla LaTeXDrawFrame.76=Nesneleri birbirinden ay\u0131r LaTeXDrawFrame.77=Nesnenin kenarl\u0131klar\u0131n\u0131n konumunu belirle LaTeXDrawFrame.78=Se\u00E7iliyse nesnenin \u00E7ift kenarl\u0131klar\u0131 olur LaTeXDrawFrame.79=\u00C7ift kenarl\u0131klar\u0131n aras\u0131n\u0131n rengini de\u011Fi\u015Ftir LaTeXDrawFrame.80=\ Kal\u0131nl\u0131\u011F\u0131 LaTeXDrawFrame.82=LaTeXDraw \u00E7al\u0131\u015Ft\u0131rl\u0131rken bir hata olu\u015Ftu:
LaTeXDrawFrame.83=LaTeXDraw ba\u015Flat\u0131lam\u0131yor. LaTeXDrawFrame.86=LaTeXDraw Hatas\u0131 LaTeXDrawFrame.88=Dosya LaTeXDrawFrame.89=D\u00FCzenle LaTeXDrawFrame.90=G\u00F6r\u00FCn\u00FCm LaTeXDrawFrame.91=\u00C7izim LaTeXDrawFrame.92=Komut LaTeXDrawFrame.93=Yard\u0131m LaTeXDrawFrame.94=\u00C7izimi yak\u0131nla\u015Ft\u0131r LaTeXDrawFrame.95=\u00C7izimi uzakla\u015Ft\u0131r LaTeXDrawFrame.96=%100 yak\u0131nla\u015Ft\u0131r LaTeXDrawFrame.103=Kal\u0131plar LaTeXDrawFrame.105=Kal\u0131plar men\u00FCs\u00FC olu\u015Fturulamad\u0131\! LaTeXDrawFrame.107=Ara\u00E7 \u00C7ubu\u011Fu LaTeXDrawFrame.108=Yeni proje olu\u015Ftur LaTeXDrawFrame.109=Bir proje a\u00E7 LaTeXDrawFrame.110=Projeyi kaydet LaTeXDrawFrame.113=%100 LaTeXDrawFrame.114=\u0130\u015Flemi geri al LaTeXDrawFrame.115=\u0130\u015Flemi tekrar yap LaTeXDrawFrame.116=\u00C7izgi \u00C7iz LaTeXDrawFrame.117=Nokta \u00E7iz LaTeXDrawFrame.118=Dikd\u00F6rgen/Kare \u00E7iz LaTeXDrawFrame.119=Dikd\u00F6rtgen \u00E7iz LaTeXDrawFrame.120=Kare \u00C7iz LaTeXDrawFrame.121=Poligon \u00E7iz LaTeXDrawFrame.123=E\u015Fkenar D\u00F6rtgen \u00C7iz LaTeXDrawFrame.124=\u00DC\u00E7gen \u00C7iz LaTeXDrawFrame.125=Elips \u00C7iz LaTeXDrawFrame.127=\u00C7ember \u00C7iz LaTeXDrawFrame.128=Yay \u00C7iz LaTeXDrawFrame.130=Dilim \u00C7iz LaTeXDrawFrame.131=Kiri\u015F \u00C7iz LaTeXDrawFrame.132=B\u00E9zier E\u011Frisi \u00C7iz LaTeXDrawFrame.133=Izgara Yerle\u015Ftir LaTeXDrawFrame.136=Bir veya daha fazla nesne se\u00E7
LaTeXDrawFrame.137=Tavsiye : Birden \u00E7ok nesne se\u00E7mek i\u00E7in LaTeXDrawFrame.138=
t\u0131klay\u0131p, fareyi se\u00E7ilmek istenen nesnelere do\u011Fru s\u00FCr\u00FCkle LaTeXDrawFrame.139=Se\u00E7ili nesneleri sil LaTeXDrawFrame.140=Nesnenin \u00F6zelliklerini de\u011Fi\u015Ftir LaTeXDrawFrame.141=T\u00FCm \u00E7izimin s\u0131n\u0131rlar\u0131n\u0131 g\u00F6ster
LaTeXDrawFrame.142=Tavsiye : \u00C7izim s\u0131n\u0131rlar\u0131 g\u00F6r\u00FCn\u00FCr haldeyken \u00E7izimin
LaTeXDrawFrame.143=boyutlar\u0131n\u0131 de\u011Fi\u015Ftirebilmek i\u00E7in, otomatik s\u0131n\u0131r
LaTeXDrawFrame.144=g\u00FCncellemeyi kapat\u0131n. LaTeXDrawFrame.146=Kopyaland\u0131... LaTeXDrawFrame.147=Yap\u0131\u015Ft\u0131r\u0131ld\u0131... LaTeXDrawFrame.148=Kesildi... LaTeXDrawFrame.149=Silindi... LaTeXDrawFrame.151=\u00C7ift kenarl\u0131k rengi se\u00E7 LaTeXDrawFrame.154=Birle\u015Ftirildi... LaTeXDrawFrame.155=Ayr\u0131ld\u0131... LaTeXDrawFrame.156=Projeyi kaydetmek ister misin? LaTeXDrawFrame.158=Tekrar yap... LaTeXDrawFrame.159=Geri al... LaTeXDrawFrame.160=Kal\u0131plar g\u00FCncellendi... LaTeXDrawFrame.161=Dosyada Hata LaTeXDrawFrame.162=\u00C7izim Yazd\u0131r\u0131l\u0131yor... LaTeXDrawFrame.163=\u00C7izim yazd\u0131r\u0131ld\u0131\! LaTeXDrawFrame.164=\u00C7izim yazd\u0131r\u0131lamad\u0131\! LaTeXDrawFrame.165=Komutlar yazd\u0131r\u0131l\u0131yor... LaTeXDrawFrame.166=Komutlar yazd\u0131r\u0131ld\u0131\! LaTeXDrawFrame.167=Komutlar yazd\u0131r\u0131lamad\u0131\! LaTeXDrawFrame.168=Kal\u0131p olarak d\u0131\u015Fa aktar\u0131l\u0131yor... LaTeXDrawFrame.169=Kal\u0131p d\u0131\u015Fa aktar\u0131ld\u0131\! LaTeXDrawFrame.170=PSTricks komutlar\u0131 olarak d\u0131\u015Fa aktar\u0131l\u0131yor... LaTeXDrawFrame.171=Se\u00E7 LaTeXDrawFrame.172=Komutlar\u0131 bir TeX dosyas\u0131 olarak d\u0131\u015Fa aktar LaTeXDrawFrame.173=Dosyan\u0131n \u00FCzerine kaydetmek istiyor musun? LaTeXDrawFrame.174=PSTricks olarak d\u0131\u015Fa aktar LaTeXDrawFrame.175=PStricks komutlar\u0131 d\u0131\u015Fa aktar\u0131ld\u0131\! LaTeXDrawFrame.176=PStricks komutlar\u0131 d\u0131\u015Fa aktar\u0131lamad\u0131\! LaTeXDrawFrame.177=Resim olarak d\u0131\u015Fa aktar\u0131l\u0131yor... LaTeXDrawFrame.179=Nesneleri d\u0131\u015Fa aktarma y\u00F6ntemi LaTeXDrawFrame.182=D\u0131\u015Fa Aktarma y\u00F6ntemi LaTeXDrawFrame.183=\ dosya LaTeXDrawFrame.184=Resim olarak d\u0131\u015Fa aktar\u0131ld\u0131\! LaTeXDrawFrame.185=Resim olarak d\u0131\u015Fa aktar\u0131lamad\u0131\! LaTeXDrawFrame.186=Proje kaydediliyor... LaTeXDrawFrame.188=\u00C7izimi kaydet LaTeXDrawFrame.190=JPEG dosyas\u0131 olarak d\u0131\u015Fa aktar LaTeXDrawFrame.191=Proje kaydedildi\! LaTeXDrawFrame.192=Proje kaydedilemedi\! LaTeXDrawFrame.193=Dosya kaydedilirken bir hata olu\u015Ftu:
LaTeXDrawFrame.197=Yeni proje yarat\u0131l\u0131yor... LaTeXDrawFrame.198=Yeni proje yarat\u0131ld\u0131... LaTeXDrawFrame.200=Bir \u00E7izimi a\u00E7... LaTeXDrawFrame.201=Dosya okunuyor... LaTeXDrawFrame.202=Dosya a\u00E7\u0131ld\u0131\! LaTeXDrawFrame.203=Dosya a\u00E7\u0131lamad\u0131\! LaTeXDrawFrame.204=Dosya a\u00E7\u0131l\u0131rken b\u0131r hata olu\u015Ftu:
LaTeXDrawFrame.208=
S\u00FCr\u00FCm LaTeXDrawFrame.209=\ \u00E7\u0131kt\u0131\! LaTeXDrawFrame.210=Yeni S\u00FCr\u00FCm LaTeXDrawFrame.211=Yeni s\u00FCr\u00FCm \u00E7\u0131kt\u0131\! LaTeXDrawFrame.212=Yeni s\u00FCr\u00FCm yok\! LaTeXDrawFrame.213=Yeni s\u00FCr\u00FCm bilgisine eri\u015Filemiyor\! LaTeXDrawFrame.215=LaTeXDraw yard\u0131m LaTeXDrawFrame.218=LaTeX i\u00E7in PSTricks komutlar\u0131 \u00FCreteci\! LaTeXDrawFrame.219=S\u00FCr\u00FCm LaTeXDrawFrame.220=, alts\u00FCr\u00FCm LaTeXDrawFrame.221=\ GNU General Public License \u015Fartnamesi y\u00FCr\u00FCrl\u00FC\u011F\u00FCnce kullan\u0131ma sunulmu\u015Ftur. LaTeXDrawFrame.222=\ (Free Software Foundation (version 2) taraf\u0131ndan yay\u0131mland\u0131\u011F\u0131 gibi) LaTeXDrawFrame.229=\u0130\u00E7e aktar... LaTeXDrawFrame.230=TeX dosyas\u0131ndan... LFrame2.0=Noktan\u0131n b\u00FCy\u00FCkl\u00FC\u011F\u00FCn\u00FC belirle. LFrame2.1=Se\u00E7ili nesneleri hizala. LFrame2.10=Se\u00E7ili nesneleri aralar\u0131 e\u015Fit mesafede olacak \u015Fekilde dikey olarak yay. LFrame2.11=Se\u00E7ili nesneleri orta noktalar\u0131 aras\u0131ndaki mesafe e\u015Fit olacak \u015Fekilde dikey olarak yay. LFrame2.12=Se\u00E7ili nesneleri tepe noktalar\u0131 aras\u0131ndaki mesafe e\u015Fit olacak \u015Fekilde dikey olarak yay. LFrame2.13=Se\u00E7ili nesneleri sol kenarlar\u0131 aras\u0131ndaki mesafe e\u015Fit olacak \u015Fekilde yatay olarak yay. LFrame2.14=Se\u00E7ili nesneleri aralar\u0131ndaki mesafe e\u015Fit olacak \u015Fekilde yatay olarak yay. LFrame2.15=Se\u00E7ili nesneleri orta noktalar\u0131 aras\u0131ndaki mesafe e\u015Fit olacak \u015Fekilde yatay olarak yay. LFrame2.16=Se\u00E7ili nesneleri sa\u011F kenarlar\u0131 aras\u0131ndaki mesafe e\u015Fit olacak \u015Fekilde yatay olarak yay. LFrame2.17=Renkler LFrame2.18=Dosyay\u0131 a\u00E7mak m\u00FCmk\u00FCn de\u011Fil\! LFrame2.19=Kal\u0131p bulunam\u0131yor LFrame2.2=Se\u00E7ilenleri sol tarafa hizala LFrame2.20=Kal\u0131plar men\u00FCs\u00FCn\u00FC g\u00FCncelle LFrame2.21=Kal\u0131p bulunamad\u0131 LFrame2.22=Bu dosya yazd\u0131r\u0131lam\u0131yor. LFrame2.23=Yaz\u0131c\u0131 bulunamad\u0131. LFrame2.25=EPS resimleri yaratmak i\u00E7in The GPL library jlibeps kullan\u0131lmaktad\u0131r. LFrame2.3=Se\u00E7ilenleri sa\u011Fa hizala LFrame2.4=Se\u00E7ilenlerin tepe noktalar\u0131n\u0131 hizala LFrame2.5=Se\u00E7ilenlerin alt noktalar\u0131n\u0131 hizala LFrame2.6=Se\u00E7ilenlerin orta noktalar\u0131n\u0131 yatay olarak hizala LFrame2.7=Se\u00E7ilenlerin orta noktalar\u0131n\u0131 dikey olarak hizala LFrame2.8=Se\u00E7ilenleri e\u015Fit aral\u0131klarla yay. LFrame2.9=Se\u00E7ilen nesneleri, alt noktalar\u0131 aras\u0131ndaki mesafe e\u015Fit olacak \u015Fekilde dikey olarak yay LFrame2.26=Se\u00E7ilenlerden yeni proje latexdraw-2.0.8+1.orig/lang/tr/1_6.properties0000644000000000000000000000772711347255510015566 0ustar BatchConvertFrame.1=Alt Dizin Ekle BatchConvertFrame.2=Dosya ekle BatchConvertFrame.4=T\u00FCm\u00FCn\u00FC Kald\u0131r BatchConvertFrame.5=\u00DCzerine Kaydet BatchConvertFrame.6=Dosya Yeri Se\u00E7 BatchConvertFrame.7=Bi\u00E7im Se\u00E7 BatchConvertFrame.8=D\u00F6n\u00FC\u015Ft\u00FCr BatchConvertFrame.9=Durdur BatchConvertFrame.11=Topluca D\u00F6n\u00FC\u015Ft\u00FCr\u00FClecekler Listesi BatchConvertFrame.12=Dizin Se\u00E7 BatchConvertFrame.13=Resimleri Se\u00E7 BatchConvertFrame.14=D\u00F6n\u00FC\u015Ft\u00FCrme Bi\u00E7imi LaTeXDrawFrame.0=PSTricks Komutu Ekle LaTeXDrawFrame.1=Resim Ekle LaTeXDrawFrame.2=Resimleri D\u00F6n\u00FC\u015Ft\u00FCr LaTeXDrawFrame.3=Durdur LaTeXDrawFrame.4=K\u00F6\u015Feli \u00C7izgi \u00C7iz LaTeXDrawFrame.5=PPM Resmi LaTeXDrawFrame.6=BMP Resmi LaTeXDrawFrame.7=PNG Resmi LaTeXDrawFrame.9=Derlemeyi Durdur\! LaTeXDrawFrame.10=Ekle LaTeXDrawFrame.11=PSTricks komutlar\u0131 ile nesneler ekle LaTeXDrawFrame.14=K\u00F6\u015Feli \u00C7izgiler Ekle LaTeXDrawFrame.15=PSTricks Dosyas\u0131 Al\u0131n\u0131yor... LaTeXDrawFrame.16=Mevcut PSTricks derleyicisi s\u0131n\u0131rl\u0131 say\u0131da komut alg\u0131layabilir.
Sadece LaTeXDraw taraf\u0131ndan desteklenen komutlar\u0131 \u00E7al\u0131\u015Ft\u0131rabilirsiniz. LaTeXDrawFrame.17=D\u0131\u015Far\u0131dan PSTricks Komutlar\u0131 Ekle LaTeXDrawFrame.18=Bu yaz\u0131l\u0131m JIU , the Java Imaging Utilities kullanmaktad\u0131r. Kullan\u0131m\u0131 LaTeXDrawFrame.19=GNU General Public License http://schmidt.devlib.org/jiu/ \u015Eartnamesi maddeleri uyar\u0131nca ger\u00E7ekle\u015Ftirilmi\u015Ftir LaTeXDrawFrame.23=Uyar\u0131lar:
  • PSTricks, JPG, BMP,... dosyalar\u0131 i\u00E7eremez; bu y\u00FCzden, se\u00E7ilen resimden ayn\u0131 dizin i\u00E7erisinde
    bir EPS resmi \u00FCretilecektir. Bu ancak, hedef dizinde yazma yetkisi verilmi\u015Fse m\u00FCmk\u00FCn olabilir;
  • TeX dosya yeri isimlerinde bo\u015Fluk karakterini desteklememektedir, olmamas\u0131na dikkat edin.
LaTeXDrawFrame.25=Resmi Y\u00FCkl\u00FCyor... LaTeXDrawFrame.26=Resim Ge\u00E7ersiz\! LaTeXDrawFrame.27=Resim Y\u00FCklenemedi\! LaTeXDrawFrame.28=Resim Eklendi\! LaTeXDrawFrame.30=Eklenecek bir nesne yok \!
Nesnelerin, begin{pspicture} ...end{pspicture} ile ba\u015Flad\u0131\u011F\u0131na ve bitti\u011Fine emin olun.
E\u011Fer derleyicide bir bug oldu\u011Funu d\u00FC\u015F\u00FCn\u00FCyorsan\u0131z, dosyay\u0131 buraya LaTeXDrawFrame.31=\ g\u00F6nderebilirsiniz. LaTeXDrawFrame.32=Hi\u00E7 nesne bulunamad\u0131\! LaTeXDrawFrame.33=Eklenebilecek bir nesne bulunamad\u0131\! LaTeXDrawFrame.34=PSTricks dosyas\u0131 aktar\u0131lamad\u0131\! LaTeXDrawFrame.35=Aktarma Engellendi\! LaTeXDrawFrame.36=Komutlar, nesnelere d\u00F6n\u00FC\u015Ft\u00FCr\u00FCld\u00FC\! InsertPSTricksCodeFrame.0=PSTricks komutlar\u0131ndan nesne ekle FatalErrorParsingException.0=
Dosya ge\u00E7erli ise, arno_b@users.sourceforge.net adresine g\u00F6nderebilirsiniz Picture.0=% Uyar\u0131: \u015Eu dosyan\u0131n konum tan\u0131m\u0131nda bo\u015Fluk karakterleri var ve tex taraf\u0131ndan derlenemeyecek\! ParserCmdMessage.0=\u00C7izgi ParserCmdMessage.1=Komut: ParserCmdMessage.2=\u0130stisna: ParserMessagesFrame.0=Komut ParserMessagesFrame.1=\u00C7izgi ParserMessagesFrame.2=\u0130stisna ParserMessagesFrame.3=Derleme s\u0131ras\u0131nda en az bir uyar\u0131 al\u0131nd\u0131 ParserMessagesFrame.4=Tex Derleyicisi: Uyar\u0131(lar) ParametersGridFrame.0=X Belirte\u00E7lerinin y\u00F6n\u00FCn\u00FC ters \u00E7evir ParametersGridFrame.1=Y Belirte\u00E7lerinin y\u00F6n\u00FCn\u00FC ters \u00E7evir PSTricksParser.0=Dosya a\u00E7\u0131l\u0131rken hata olu\u015Ftu: ge\u00E7ersiz dosya PSTricksParser.1=Hen\u00FCz i\u00E7i\u00E7e pspicture tan\u0131mlama desteklenmiyor:
PSTricksParser.2=begin{pspicture}...begin{pspicture} ... end{pspicture}... PSTricksParser.3=Dosya derlenmesi s\u0131ras\u0131nda hata olu\u015Ftu\! latexdraw-2.0.8+1.orig/lang/tr/dialogFrames.properties0000644000000000000000000001326111347255510017564 0ustar PreferencesFrame.Pref=Tercihler PreferencesFrame.grid=Izgara PreferencesFrame.codePanel=Komut alan\u0131 PreferencesFrame.antiAl=Anti-aliasing PreferencesFrame.rendQ=Render kalitesi PreferencesFrame.colRendQ=Renk render kalitesi PreferencesFrame.AlphaQ=Alpha interpolation kalitesi PreferencesFrame.bordersDraw=Resmin S\u0131n\u0131rlar\u0131 PreferencesFrame.codeAuto=Komutlar\u0131 otomatik g\u00FCncelle (yava\u015Flat\u0131r) PreferencesFrame.newVers=Ba\u015Flang\u0131\u00E7ta yeni s\u00FCr\u00FCmleri sor PreferencesFrame.lge=Dil (Bir sonraki a\u00E7\u0131l\u0131\u015Fta) PreferencesFrame.general=Genel PreferencesFrame.folders=Dizinler PreferencesFrame.quality=G\u00F6r\u00FCnt\u00FC Kalitesi PreferencesFrame.selectFolder=Bir dizin se\u00E7 PreferencesFrame.defOpenSave=A\u00E7/Kaydet i\u00E7in varsay\u0131lan dizin PreferencesFrame.defFold=\u0130\u00E7e/D\u0131\u015Fa aktarmalar i\u00E7in varsay\u0131lan dizin PreferencesFrame.errorReadPref=Tercihler dosyas\u0131 okunurken hata olu\u015Ftu\! PreferencesFrame.prefSaved=Tercihler Kaydedildi\! DrawPropertiesFrame.0=Resim i\u00E7in Label Belirteci DrawPropertiesFrame.1=Resim i\u00E7in Caption Belirteci DrawPropertiesFrame.2=\u00C7izim \u00D6zellikleri DrawPropertiesFrame.3=piksel / DrawPropertiesFrame.5=Sadece resimlerin oldu\u011Fu bir sayfaya DrawPropertiesFrame.6=Sayfa Ba\u015F\u0131na DrawPropertiesFrame.7=Sayfa Sonuna DrawPropertiesFrame.8=Buraya DrawPropertiesFrame.9=BURAYA\! DrawPropertiesFrame.10=Sayfan\u0131n ortas\u0131na DrawPropertiesFrame.11=\u00C7izimin s\u00FC\u015Fey konumu DrawPropertiesFrame.12=\u00C7izimin yatay konumu DrawPropertiesFrame.13=Birim uzunluk ba\u015F\u0131na d\u00FC\u015Fen piksel miktar\u0131n\u0131 de\u011Fi\u015Ftir ExceptionFrameDialog.0=Rapor g\u00F6nder ExceptionFrameDialog.1=Bir hata olu\u015Ftu\!
ExceptionFrameDialog.2=
LaTeXDraw yazar\u0131na raporu g\u00F6nderebilirsiniz ExceptionFrameDialog.3=LaTeXDraw hatas\u0131: Bir istisna olu\u015Ftu ExceptionFrameDialog.4=Bir hata olu\u015Ftu:
ExceptionFrameDialog.5=ExceptionFrameDialog Olu\u015Fturulamad\u0131 AbstractParametersFrame.0=\u00C7ift S\u0131n\u0131r AbstractParametersFrame.2=Ayra\u00E7: AbstractParametersFrame.3=Genel Parametreler AbstractParametersFrame.4=Tamam AbstractParametersFrame.5=Varsay\u0131lan AbstractParametersFrame.6=\u0130ptal AbstractParametersFrame.7=D\u00F6nd\u00FCrme A\u00E7\u0131s\u0131 AbstractParametersFrame.8=Kal\u0131nl\u0131k: AbstractParametersFrame.10=\u00C7izgi Tipi AbstractParametersFrame.11=Tarama Kal\u0131nl\u0131\u011F\u0131 AbstractParametersFrame.12=Sol Ok: AbstractParametersFrame.13=Sa\u011F Ok: AbstractParametersFrame.14=Ok parametreleri AbstractParametersFrame.15=Te\u011Fet Noktalar\u0131n\u0131 G\u00F6ster AbstractParametersFrame.16=Yuvarlat\u0131lm\u0131\u015F AbstractParametersFrame.17=X-merkez koordinatlar\u0131 AbstractParametersFrame.18=Y-merkez koordinatlar\u0131 AbstractParametersFrame.19=Yar\u0131\u00E7ap: AbstractParametersFrame.20=Nokta \u00E7ap\u0131 AbstractParametersFrame.21=\u00E7ubuk Geni\u015Fli\u011Fi AbstractParametersFrame.22=K\u00F6\u015Feli Parantez uzunlu\u011Fu AbstractParametersFrame.23=Parantez Uzunlu\u011Fu AbstractParametersFrame.24=x kal\u0131nl\u0131\u011F\u0131 AbstractParametersFrame.25=x geni\u015Fli\u011Fi AbstractParametersFrame.26=Ok uzunlu\u011Fu AbstractParametersFrame.27=Okun kuyruk sivrili\u011Fi AbstractParametersFrame.28=Ok geni\u015Fli\u011Fi AbstractParametersFrame.29=X-koordinat\u0131 AbstractParametersFrame.30=Y-koordinat\u0131 AbstractParametersFrame.31=Geni\u015Flik AbstractParametersFrame.32=Y\u00FCkseklik : AbstractParametersFrame.33=\u015Eekil Parametreleri AbstractParametersFrame.34=Tarama rengi se\u00E7 AbstractParametersFrame.35=\u00C7ift \u00E7izgi rengi se\u00E7 AbstractParametersFrame.36=Kenar rengi se\u00E7 AbstractParametersFrame.37=Dolgu rengi se\u00E7 AbstractParametersFrame.38=Oklar ParametersArcFrame.0=ba\u015Flang\u0131\u00E7 a\u00E7\u0131s\u0131: ParametersArcFrame.1=biti\u015F a\u00E7\u0131s\u0131: ParametersArcFrame.2=Yay tipi: ParametersDotFrame.0=Nokta tipi ParametersDrawFrame.0=Kuzey-Bat\u0131 X ParametersDrawFrame.1=Kuzey-Bat\u0131 Y ParametersDrawFrame.2=G\u00FCney-Do\u011Fu X ParametersDrawFrame.3=G\u00FCney-Do\u011Fu Y ParametersGridFrame.0=Y Merkez ParametersGridFrame.1=X Merkez ParametersGridFrame.2=Belirte\u00E7ler: ParametersGridFrame.3=Birim: ParametersGridFrame.4=Alt\u0131zgara noktalar\u0131: ParametersGridFrame.5=Izgara Noktalar\u0131: ParametersGridFrame.6=Izgara geni\u015Fli\u011Fi: ParametersGridFrame.7=Alt\u0131zgara geni\u015Fli\u011Fi: ParametersGridFrame.8=Birim aral\u0131ktaki nokta say\u0131s\u0131: ParametersGridFrame.9=Belirte\u00E7 Boyu: ParametersLineFrame.0=Sol X-koordinat\u0131 ParametersLineFrame.1=Sol Y-koordinat\u0131 ParametersLineFrame.2=Sa\u011F X-koordinat\u0131 ParametersLineFrame.3=Sa\u011F Y-koordinat\u0131 ParametersTextFrame.0=Kal\u0131n ParametersTextFrame.1=\u0130talik ParametersTextFrame.2=Yaz\u0131 tipi: ParametersTextFrame.3=Punto: ParametersTextFrame.4=Metin ParametersGridFrame.10=Alt\u0131zgara: ParametersGridFrame.11=Azami X: ParametersGridFrame.12=Asgari X: ParametersGridFrame.13=Azami Y: ParametersGridFrame.14=Asgari Y: ParametersGridFrame.15=Belirte\u00E7leri G\u00F6ster ParametersGridFrame.17=Belirte\u00E7 rengi se\u00E7 ParametersGridFrame.18=Alt\u0131zgara rengi se\u00E7 ParametersPolygonFrame.1=Nokta no: ParametersTriangleFrame.0=Alt kenar orta nokta X: ParametersTriangleFrame.1=Alt kenar orta nokta Y: ParamsBC.0=T\u00FCm\u00FCn\u00FC ta\u015F\u0131 ParamsBC.1=Se\u00E7ili de\u011Filse, nokta ta\u015F\u0131nd\u0131\u011F\u0131nda te\u011Fet noktalar\u0131 da beraber ta\u015F\u0131n\u0131r. ExportDialog.0=S\u0131k\u0131\u015Ft\u0131rma latexdraw-2.0.8+1.orig/lang/tr/1_8.properties0000644000000000000000000000556711347255510015570 0ustar UndoRedoManager.0=D\u00F6n\u00FC\u015F\u00FCm AbstractParametersFrame.0=aral\u0131k: ParametersAxeFrame.0=\u015Eekil: ParametersAxeFrame.1=Merkezi g\u00F6ster ParametersAxeFrame.2=Eksenler ParametersAxeFrame.3=X-Eksen belirte\u00E7lerini g\u00F6ster ParametersAxeFrame.4=X-Eksen belirte\u00E7lerini g\u00F6ster ParametersAxeFrame.5=Belirte\u00E7ler aras\u0131 mesafe (cm) ParametersAxeFrame.6=X-belirte\u00E7leri aras\u0131 ParametersAxeFrame.7=Y-belirte\u00E7leri aras\u0131 ParametersAxeFrame.8=X-belirte\u00E7 art\u0131\u015F\u0131 ParametersAxeFrame.9=Y-belirte\u00E7 art\u0131\u015F\u0131 ParametersAxeFrame.10=X-s\u0131f\u0131r belirteci ParametersAxeFrame.11=Y-s\u0131f\u0131r belirteci ParametersAxeFrame.12=Belirte\u00E7ler ParametersAxeFrame.13=Boy ParametersAxeFrame.14=Tarz ParametersAxeFrame.15=X-\u00E7entikleri g\u00F6ster ParametersAxeFrame.16=Y-\u00E7entikleri g\u00F6ster ParametersAxeFrame.17=\u00C7entikler PreferencesFrame.3=Latex Editor Konumu PreferencesFrame.4=Standart Izgara PreferencesFrame.5=De\u011Fi\u015Ftirilmi\u015F Izgara PreferencesFrame.6=Yap\u0131\u015Fkan Izgara PreferencesFrame.7=Aral\u0131k: LaTeXDrawFrame.0=Eksen Tak\u0131m\u0131 \u00C7iz LaTeXDrawFrame.2=Se\u00E7ili nesneleri d\u00F6nd\u00FCr LaTeXDrawFrame.3=Se\u00E7ili nesneleri 90\u00B0 d\u00F6nd\u00FCr. LaTeXDrawFrame.4=Se\u00E7ili nesneleri 180\u00B0 d\u00F6nd\u00FCr. LaTeXDrawFrame.5=Se\u00E7ili nesneleri 270\u00B0 d\u00F6nd\u00FCr. LaTeXDrawFrame.6=Nesneleri simetrik olarak ters \u00E7evir LaTeXDrawFrame.7=Nesneleri yatay simetrik olarak ters \u00E7evir LaTeXDrawFrame.8=Nesneleri d\u00FC\u015Fey simetrik olarak ters \u00E7evir LaTeXDrawFrame.10=Standart bir \u0131zgara g\u00F6ster (cm veya in) LaTeXDrawFrame.11=\u00C7izgileri aras\u0131 uzakl\u0131\u011F\u0131 de\u011Fi\u015Ftirilebilen bir \u0131zgara g\u00F6ster. LaTeXDrawFrame.12=(Yap\u0131\u015Fkan) Izgara parametrelerini i\u00E7erir. LaTeXDrawFrame.13=yap\u0131\u015Fkan LaTeXDrawFrame.14=Se\u00E7ilirse, nesneler \u0131zgara noktalar\u0131na yap\u0131\u015F\u0131r. LaTeXDrawFrame.15=De\u011Fi\u015Ftirilmi\u015F \u0131zgara i\u00E7in \u00E7izgi aral\u0131\u011F\u0131 (piksel olarak) LaTeXDrawFrame.16=Izgaralar ve eksen tak\u0131mlar\u0131 \u00E7iz LaTeXDrawFrame.17=Eksen Tak\u0131m\u0131 \u00C7iz LaTeXDrawFrame.18=LaTeX Edit\u00F6r\u00FCn\u00FC \u00E7al\u0131\u015Ft\u0131r\u0131r. LaTeXDrawFrame.19=LaTeX edit\u00F6r\u00FCn\u00FC \u00E7al\u0131\u015Ft\u0131r\u0131yor... LaTeXDrawFrame.20=LaTeX Edit\u00F6r\u00FC konumu, se\u00E7enekler panelinde belirtilmi\u015F olmal\u0131. LaTeXDrawFrame.21=Se\u00E7ilen dosya ge\u00E7ersiz. LaTeXDrawFrame.22=Konumu, se\u00E7enekler panelinde tekrar tan\u0131mla LaTeXDrawFrame.23=Kapat LaTeXDrawFrame.25=K\u00FCt\u00FCphaneler LaTeXDrawFrame.26=\u00C7evirmenler LaTeXDrawFrame.27=S\u00FCr\u00FCm Bilgisi LaTeXDrawFrame.28=Lisans Axe.0=Hi\u00E7 Axe.1=Eksen Axe.2=\u00C7er\u00E7eve Axe.3=Tam Axe.4=\u00DCstte Axe.5=Altta latexdraw-2.0.8+1.orig/lang/tr/others.properties0000644000000000000000000000465511347255510016502 0ustar XScale.cm=cm XScale.inch=in\u00E7 LaTeXDrawException.valueInc=Yanl\u0131\u015F de\u011Fer LaTeXDrawException.invFile=Bu bir LaTeXDraw dosyas\u0131 de\u011Fil\! LaTeXDrawException.invLaTeXDrawVer=Bu LaTeXDraw s\u00FCr\u00FCm\u00FC desteklenmiyor\! LaTeXDrawException.invException=LaTeXDrawException: bilinmeyen hata kodu Arc.arc=Yay Arc.wedge=Dilim Arc.chord=Kiri\u015F Arc.arcType=Yay \u00E7e\u015Fidi Figure.boundPos=S\u0131n\u0131r konumu DrawContainer.nameTemplate=Kal\u0131p ad\u0131 gir DrawContainer.overwriteTemplate=Bu kal\u0131p zaten var; \u00FCzerine kaydedilsin mi? CloseButton.closePanel=Paneli kapat UndoRedoManager.changeParams=Parametreleri de\u011Fi\u015Ftir UndoRedoManager.changeDispo=E\u011Fimi de\u011Fi\u015Ftir UndoRedoManager.move=Ta\u015F\u0131 UndoRedoManager.delete=Sil UndoRedoManager.create=Olu\u015Ftur UndoRedoManager.join=Birle\u015Ftir UndoRedoManager.seperate=Ay\u0131r UndoRedoManager.filled=\u0130\u00E7inin tarz\u0131n\u0131 de\u011Fi\u015Ftir UndoRedoManager.intCol=\u0130\u00E7inin rengini de\u011Fi\u015Ftir UndoRedoManager.bordCol=Kenarlar\u0131n rengini de\u011Fi\u015Ftir UndoRedoManager.thick=Kal\u0131nl\u0131\u011F\u0131 de\u011Fi\u015Ftir UndoRedoManager.style=Tarz\u0131n\u0131 de\u011Fi\u015Ftir UndoRedoManager.lArrow=Sola ok tarz\u0131n\u0131 de\u011Fi\u015Ftir UndoRedoManager.rArrow=Sa\u011Fa ok tarz\u0131n\u0131 de\u011Fi\u015Ftir UndoRedoManager.dotStyle=Nokta tarz\u0131n\u0131 de\u011Fi\u015Ftir UndoRedoManager.noRedo=Tekrarlanacak bir\u015Fey yok UndoRedoManager.noUndo=Ger\u0131 al\u0131nacak bir\u015Fey yok UndoRedoManager.align=hizalama UndoRedoManager.distrib=da\u011F\u0131l\u0131m CodePanel.reload=Yeniden y\u00FCkle CodePanel.autoUpdate=Otomatik G\u00FCncelle CodePanel.copySel=Se\u00E7ili metni kopyala CodePanel.copyAll=T\u00FCm\u00FCn\u00FC kopyala CodePanel.tip=
Se\u00E7ili ise komutlar, s\u00FCrekli g\u00FCncellenir
Tavsiye : B\u00FCy\u00FCk bir resim \u00E7izerken
ya komut panelini kapat\u0131n ya da
otomatik g\u00FCncellemeyi kullanmay\u0131n.
CodePanel.updateCode=Komutlar\u0131 G\u00FCncelle CodePanel.addComment=Komutlara yorum ekle CodePanel.reloadText=PSTricks komutlar\u0131 tekrar y\u00FCklendi\! CodePanel.copiedText=PSTricks komutlar\u0131 panoya y\u00FCklendi\! CodePanel.copiedSelText=Se\u00E7ilen k\u0131s\u0131m panoya y\u00FCklendi\! SVGManager.0=SVG dosyas\u0131ndan \u015Fekil olu\u015Fturulam\u0131yor. latexdraw-2.0.8+1.orig/lang/tr/1_7.properties0000644000000000000000000000627611347255510015565 0ustar LaTeXDrawException.0=Ge\u00E7ersiz Resim LaTeXDrawFrame.0=G\u00F6lge LaTeXDrawFrame.9=G\u00F6lge rengi se\u00E7 LaTeXDrawFrame.1=Renk Ge\u00E7i\u015Fi 1 LaTeXDrawFrame.2=Renk Ge\u00E7i\u015Fi 2 LaTeXDrawFrame.4=Resime g\u00F6lge ekle LaTeXDrawFrame.5=G\u00F6lgenin rengini se\u00E7 LaTeXDrawFrame.6=Resimleri g\u00F6rece konumland\u0131r (\u00F6n\u00FCnde, arkas\u0131nda,...) LaTeXDrawFrame.7=Renk ge\u00E7i\u015Finin ilk rengini se\u00E7 LaTeXDrawFrame.8=Renk ge\u00E7i\u015Finin ikinci rengini se\u00E7 ParametersTextFrame.0=Belirginlik ParametersTextFrame.1=Kutu Listesi ParametersTextFrame.2=Belirgin ParametersTextFrame.3=\u00C7ember ParametersTextFrame.4=Dikd\u00F6rtgen ParametersTextFrame.5=\u00DC\u00E7gen ParametersTextFrame.6=Baklava ParametersTextFrame.7=Elips ParametersTextFrame.8=Basit kutu ParametersTextFrame.9=Bir\u00E7ok kutu ParametersGridFrame.0=Izgara de\u011Ferleri ParametersTextFrame.10=\u00C7er\u00E7eveli kutular\u0131 etkinle\u015Ftir ParametersTextFrame.11=Ekle ParametersTextFrame.12=De\u011Fi\u015Ftir ParametersTextFrame.13=Kald\u0131r ParametersTextFrame.14=Ayra\u00E7: ParametersTextFrame.15=D\u00FCzenleme Kutusu ParametersTextFrame.16=Kutu boyutunu g\u00F6z \u00F6n\u00FCne al ParametersTextFrame.17=Se\u00E7ilirse, arka plan rengi \u015Feffaf olmayacak. ParametersTextFrame.18=\u00C7er\u00E7eveli Kutu(lar) ParametersTextFrame.20=Yaz\u0131 etraf\u0131nda bir veya daha fazla \u00E7er\u00E7eve olu\u015Ftur. ParametersTextFrame.21=Kutu bir dikd\u00F6rtgen olacak. ParametersTextFrame.22=Kutu bir \u00FC\u00E7gen olacak. ParametersTextFrame.23=T\u00FCm yaz\u0131 etraf\u0131na basit bir kutu koy. ParametersTextFrame.24=Kutu bir elips olacak. ParametersTextFrame.25=Kutu bir baklava dilimi \u015Feklinde olacak ParametersTextFrame.26=Yaz\u0131n\u0131n farkl\u0131 yerlerini birka\u00E7 kutu ile \u00E7evrele ParametersTextFrame.27=Kutu bir \u00E7ember olacak. ParametersTextFrame.28=Yeni kutu ekle. ParametersTextFrame.29=Se\u00E7ili kutunun konumunu de\u011Fi\u015Ftir. ParametersTextFrame.30=Se\u00E7ili kutuyu kald\u0131r. ParametersTextFrame.31=Kutu ile yaz\u0131 aras\u0131ndaki bo\u015Fluk miktar\u0131n\u0131 de\u011Fi\u015Ftir. ParametersTextFrame.32=Se\u00E7ilirse, kutunun \u00E7izgileri \u00E7er\u00E7eve i\u00E7ine al\u0131nm\u0131\u015F yaz\u0131n\u0131n ba\u015F\u0131ndaki ve sonundaki harfler \u00FCzerine yaz\u0131lmaz. ParametersTextFrame.33=Kutunun \u00F6zeliklerini de\u011Fi\u015Ftirme panelini a\u00E7ar. ParametersTextFrame.34=Metin se\u00E7me ParametersTextFrame.35=Kutu i\u00E7ine al\u0131nacak metni se\u00E7 ParametersTextFrame.36=Metin Se\u00E7imi ParametersTextFrame.37=Ge\u00E7ersiz kutu: Ba\u015Fka kutu ile \u00E7ak\u0131\u015Ft\u0131. AbstractParametersFrame.0=Ebat/Konum AbstractParametersFrame.1=G\u00F6lge A\u00E7\u0131s\u0131 AbstractParametersFrame.2=G\u00F6lge Boyu AbstractParametersFrame.3=Renk Ge\u00E7i\u015F A\u00E7\u0131s\u0131 AbstractParametersFrame.4=Orta Nokta AbstractParametersFrame.6=Di\u011Fer AbstractParametersFrame.7=Yuvarlat\u0131lm\u0131\u015F k\u00F6\u015Fe AbstractParametersFrame.8=Tarama AbstractParametersFrame.9=\u00C7ift \u00C7izgi AbstractParametersFrame.11=Dolgu AbstractParametersFrame.12=Renk Ge\u00E7i\u015Fi BatchConvertFrame.0=Dosya ile ayn\u0131 dizine latexdraw-2.0.8+1.orig/compile0000644000000000000000000000144211347255510013054 0ustar #! /bin/sh cp -r src\ lib/net/ . cp -r src\ lib/org/ . javac net/sourceforge/WmfView/*.java org/jibble/epsgraphics/*.java net/sourceforge/jiu/codecs/*.java net/sourceforge/jiu/codecs/jpeg/*.java net/sourceforge/jiu/codecs/tiff/*.java net/sourceforge/jiu/color/*.java net/sourceforge/jiu/color/conversion/*.java net/sourceforge/jiu/data/*.java net/sourceforge/jiu/gui/awt/*.java net/sourceforge/jiu/ops/*.java net/sourceforge/jiu/util/*.java javac latexDraw/exceptions/*.java latexDraw/figures/*.java latexDraw/figures/properties/*.java latexDraw/filters/*.java latexDraw/lang/*.java latexDraw/parsers/*.java latexDraw/parsers/pstricks/*.java latexDraw/psTricks/*.java latexDraw/ui/*.java latexDraw/ui/components/*.java latexDraw/ui/dialog/*.java latexDraw/ui/listeners/*.java latexDraw/util/*.java latexdraw-2.0.8+1.orig/install_debian_ubuntu0000644000000000000000000000005411347255510015774 0ustar #!/bin/sh gksudo 'java -jar installer.jar' latexdraw-2.0.8+1.orig/readme.txt0000644000000000000000000000330511347255510013477 0ustar This installer will install LaTeXDraw in the selected directory and create a directory for shared templates. This last action can require administrator privileges. *** Windows Vista *** For Windows Vista you must use the install_vista.vbs to install LaTeXDraw; this script activates the "run as administrator" feature in order to install files in protected directories such as "Program Files". It will ask you your password. However, it seems to have some problem while using the installer on Vista Ultimate. For the moment, a workaround is to install latexdraw manually (see at the bottom of this page). *** Debian/Ubuntu *** The script install_debian_ubuntu will ask administrator privileges before launching the installer. *** Running the installer *** If you want to launch the installer in a console, the command is "java -jar installer.jar". The shared templates is: - for Unix, /usr/share/latexdraw - for Mac OS X, /Users/Shared/latexdraw - for Vista, ProgramData\latexdraw - for other Windows, All Users\Application Data\latexdraw For Linux, a script will be created in /usr/bin to launch LaTeXDraw (needs to be root). No shortcut is created for Windows. The first execution of LaTeXDraw will create the profile of the current user in: - for Unix, ~/.latexdraw - for Max OS X, /Library/Preferences/latexdraw - for Vista, \AppData\Local\latexdraw - for other Windows, \Application Data\latexdraw This profile contains the preferences of the user and its templates. *** HOW TO INSTALL LATEXDRAW MANUALLY *** If you want to install LaTeXDraw without using the installer you must place "LaTeXDraw.jar", "release_notes.txt", "licence.txt", "help/" and "lib/" in the same directory/ latexdraw-2.0.8+1.orig/count0000644000000000000000000000021211347255510012546 0ustar #tar -c latexDraw/ --exclude=*.class --exclude=CVS | grep -ac [\ -\~] find latexDraw/ -name "*.java" -exec cat {} \; | grep -ac [\ -\~] latexdraw-2.0.8+1.orig/templates/0000755000000000000000000000000011347255510013476 5ustar latexdraw-2.0.8+1.orig/templates/Condenser.svg0000644000000000000000000000222411347255510016137 0ustar C latexdraw-2.0.8+1.orig/templates/embrace.svg0000644000000000000000000000145411347255510015621 0ustar latexdraw-2.0.8+1.orig/templates/man.svg0000644000000000000000000000542611347255510015001 0ustar latexdraw-2.0.8+1.orig/templates/Classic grid.svg0000644000000000000000000134067711347255510016530 0ustar 0 1 2 3 4 5 5 4 3 2 1 0 latexdraw-2.0.8+1.orig/templates/question.svg0000644000000000000000000000536511347255510016077 0ustar latexdraw-2.0.8+1.orig/.project0000644000000000000000000000103611347255510013147 0ustar LaTeXDraw2 fr.irisa.triskell.kermeta.kpm.kpmBuilder org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature net.sourceforge.metrics.nature latexdraw-2.0.8+1.orig/license.txt0000644000000000000000000004365711347255510013702 0ustar GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. latexdraw-2.0.8+1.orig/help/0000755000000000000000000000000011347255510012430 5ustar latexdraw-2.0.8+1.orig/help/start.html0000644000000000000000000000545611347255510014465 0ustar The LaTeXDraw Project Manual

How to start



The following code allows to create a simple drawing :


\documentclass[a4paper,11pt]{article}

\usepackage[usenames,dvipsnames]{pstricks}
\usepackage{epsfig}
\begin{document}

\begin{pspicture}(0,-1.91)(6.3,1.91)
\psframe[linewidth=0.04](3.44,0.77)(0.92,-0.77)
\psframe[linewidth=0.04](4.24,1.07)(2.4,0.09)
\psline[linewidth=0.04cm](2.76,1.53)(4.06,-0.09)
\psline[linewidth=0.04cm](6.28,1.19)(0.02,-1.89)
\psline[linewidth=0.04cm](5.42,1.89)(5.28,-0.07)
\end{pspicture}

\end{document}

If this code does not compile, install the pstricks package or reinstall your TeX distribution (TeXLive or MikTex).



latexdraw-2.0.8+1.orig/help/graphFeat.html0000644000000000000000000002232011347255510015216 0ustar The LaTeXDraw Project Manual

Graphicals Features




In this part, we are going to talk about the graphicals features of LaTeXDraw. But before that, we must explain what is a delimitor : it is a purple, green, red, ... square delimiting a selected figure, like show in the following picture :
rectangle
You can move these delimitors to change the shape of the figures like explained in these following paragraphes.







Select figures

You can select a figure by :
  • Clicking on the borders of a figure
  • Clicking in the interior of a filled figure
  • Pressing the left button and drag the mouse to the wanted figures
To select a grid you must use the third case. Indeed, it will be annoying if you have a grid in the backgroud of your drawing and a rectangle, for example, placed on the grid ; if you want to selected the rectangle, the grid will be selected to ...

To unselect figures, click in an empty place in the draw panel.





Move figures

To move select figures, you must :
  • Pressing the left button on the borders, or in the interior of a filled figure, or on the delimitors and drag the figure ;
  • Pressing the right button anywhere in the draw panel and drag the figure. Beware, if you do a rigth click, a popup menu will appear.




Rescale figures

You can rescale a figure by dragging one of the delimitors. If you have selected several figures, you can rescale all of them by dragging the delimitors which framing all the selected shapes.



Put a figure in front, behind, ... an other figure

toolbar
With the toolbar you can place a figure :
  • In the background of the drawing with the button : background
  • In the foreground of the drawing with the button : foreground
  • Behind an other figure with the button : behind. After have clicked on this button, you must click on the figure you to be in front of the selected figures.
  • In front an other figure with the button : inFrontOf
  • . After have clicked on this button, you must click on the figure you to be behind the selected figures.




Rotate figures

rotation

This mini-toolbar allow to rotate figures:
  • The button without arrow allows to rotate a or several figures with the mouse; to do that, you just have to drag one of the delimitors (by clicking of this button all the delimitors become green). To come back to the normal mode, you must click again on this button (the delimitors will take their original colour);
  • The buttons with an arrow allow to rotate immediately a or several figures or 90, 180 and 270.




Join/separate several selected figures

LaTeXDraw can join several selected figures ; for that, select several figures and click on the following button join in the toolbar. All these figures will be joined in order to create only one figure.

By the same way, you can separate joined figures using this button separate.



Change the dimensions of the drawing

By default, the dimensions of the drawing are framed by all the figures. You can display the borders of the drawing with the following button in the "Draw" menu borders. For example, it can be :

borders
Where the borders of the drawing is the rectangle framing all the figures.

You can change the dimensions of the drawing by :
  • Clicking of the button borders to display the borders
  • Desactivate the auto update of the borders of the drawing using this button in the menu "Draw" : autoBorders
  • Clicking on the "selection" button in order to select the borders select
Then, the delimitors of the borders of the sketch must be displayed like in this picture :

borders
Now, You can change the dimensions of the sketch by dragging these delimitors.

In a LaTeX document a change of the dimensions of the drawing change the disposition of the document like show in the following picture :

example





The mirrors

Mirror

There is two mirrors: vertical an horizontal. It works with an axial symmetry by using the gravity center of the selected figure or of the group of selected figures.

For the moment, when a picture, a grid or axes are transformed with this feature, their coordinates are moved but the shape is not realy changed; in a future release, an option will allow the user to do that (there is the same problem for gradient: when you apply a mirror, the gradient is not changed).



The magnetic grids

Magnet

This feature is very usefull when you want to place figures.
To have a magnetic grid, selected the checkbox; but to display the grid you have to select it in the menu "Display"->"Grid"->"Standard grid" or "Personal grid".

  • The standard grid: this grid is define in centimeter or in inch (you can choose it);
  • The personal grid: this grid allows you to define the interval between the lines of the grid; to do that, you can use to field near the "Magnetic checkbox" checkbox. This field is enable only when the personal grid is displayed.






latexdraw-2.0.8+1.orig/help/check.html0000644000000000000000000000475311347255510014404 0ustar The LaTeXDraw Project Manual

Check New Version



LaTeXDraw is able to check new version of the software at the start-up. If there is a new version, a frame, must appeared in order to keep you informed of this new version.
You can disable this feature in the preferences frame you can display with the menu item "Preferences" in the menu "File".














latexdraw-2.0.8+1.orig/help/license.html0000644000000000000000000000343411347255510014744 0ustar The LaTeXDraw Project Manual

License



The LaTeXDraw project is distributed under the GNU GPL. To learn more informations about this license, you can read the file license.txt in the root of the LaTeXDraw project folder.

















latexdraw-2.0.8+1.orig/help/style.css0000644000000000000000000000256511347255510014312 0ustar body { color: black; background-color: white; font-family: Verdana, Arial, Helvetica; font-size: 1em } .right { text-align:right; } TH { font-size: 100% } TD { font-size: 100% } H1 { text-align: center; font-size: 140% ; font-family: Verdana, Arial, Helvetica;} H2 { text-align: center; font-size: 120% ; font-family: Verdana, Arial, Helvetica;} H4 { font-size: 100% ; font-family: Verdana, Arial, Helvetica;} a.SubMenu1 { background: inherit; font-family: inherit; text-align: left; font-weight: bold; color: green; font-size: 80%; text-decoration: none } a.MenuLink { background: inherit; font-family: inherit; text-align: left; font-weight: bold; color: blue; text-decoration: none } a:hover { background: #ccc; font-family: inherit; color: red; } .MenuCurrent { text-align: left; font-weight: bold } .SubMenu1Current { text-align: left; font-weight: bold; font-size: 80%; } TD.MenuColumn { background-color: #E0E0E0; width: 120px ; font-size: 100%} TD.Layout { background-color: white ; font-size: 100%} TH.Title { background-color: #B6C8F6 ; font-size: 100%} TD.Item { background-color: #E8E8E8 ; font-size: 100%} TD.SubItem { background-color: #FFFFFF ; font-size: 100%} span.date { display: none; } span.summary { display: none; } latexdraw-2.0.8+1.orig/help/template.html0000644000000000000000000000505011347255510015131 0ustar The LaTeXDraw Project Manual

Template



With LaTeXDraw, you can create templates ; it is figures you have created and you want to save in order to insert them in a future drawing. For example, if you use a lot condensors in your drawings, you do not want to draw at each time the condensor ; so with LaTeXDraw you can create your condensor, save it in a template and then, insert it in your futures sketches.














latexdraw-2.0.8+1.orig/help/drawProp.html0000644000000000000000000000517011347255510015117 0ustar The LaTeXDraw Project Manual

Draw properties



You can change some parameters of your drawing by lauching the parameters frame of the draw with the menu item "Draw Properties" in the menu "Draw".

DrawProperties

With this frame, you can add a label, a caption to your drawing. You can also place the figure in your LaTeX document and define the resolution of your sketch in ppm or in ppm (Pixels Per Cm/Inch).














latexdraw-2.0.8+1.orig/help/shapes.html0000644000000000000000000003554311347255510014613 0ustar The LaTeXDraw Project Manual

Shapes



The Shapes



The Parameters of the Shapes


You can modify a shape by using the parameters frame that you can display by double clicking on the shape or by clicking on this button :paramsIcon.

Then, the following frame must be displayed :


paramsFrame


You can also modify a figure with the toolbar of LaTeXDraw :


toolbar


You can especially modify :




Rectangle & Square

rectangle

To create a rectangle or a square use these button : rectButton. Press the left button and drag the mouse to enlarge the rectangle.



Line

line

To create a line, press the left button and drag the mouse to enlarge the line.



Ellipse & Circle

ellipse

To create an ellipse/circle, press the left button and drag the mouse to enlarge the shape.



Bézier Curve

Bézier curve

To draw a Bézier Curve, a left click creates a point and a double left click or a right click stops the creation.

You can move the points of references by selecting the figure and move the delimitors.

You can equilibrate a Bzier curve with the button "equilibrate" in its parameters frame; all control points are recomputed in order to form a round shape. The "distance" field define the distance of the control points when they are equilibrate.

A Bzier can be closed or open; when closed, a curve or a line joins the two extremities of the curve.

Polygon

polygon

To create an polygon, click with the rigth button and drag the mouse then click to create an other point, etc.



Triangle & Rhombus

triangle

To create a triangle/Rhombus, press the left button and drag the mouse to enlarge the shape.



Grid

grid

To create a grid, do a right click in the draw panel; a frame of the parameters of the grid must appeared. A grid has a lots of parameters that you can change in this frame.

A grid can not be resized with its delimitors, but you can change the parameters "unit" to enlarge each box of the grid.

Arc

arc

To create an arc, press the left button and drag the mouse to enlarge the shape.

There is three kind of arcs :

Point

point

To create a point, do a right click in the draw panel. It exists a lots of kind of point (crossed dot, square, bar, ...) that you can change in the list "dot style".

  • Some kind of points can be filled like pentagon.
  • Like most of the shapes, you can change the size and the colors.


Free hand

Free hand

To use free hand, press the left button and drag the mouse to create points.

Shape, created with free hand, can be either a curve or joined-lines; you can change that in the frame of parameters.
Only few points are drawn compare to the number of created points; you can define the interval between each points with the field "interval".
It can be closed or open; when closed a line joins the two extremities.

Text

text

To create a text, do a right click in the draw panel; a frame of the parameters of the text must appeared. You can enter the text in the field. The text can be bold, in italic and can use severals fonts and size.

A text can not be resized with its delimitors.
A text can be opaque and you can define the colour of the opacity.

A text can be boxed by one or several boxes; a box can be a rectangle, an oval, an circle, an diamond or a triangle.

FramedBox
The frameSep parameter define the separation between the figure and the box.
A box can be edited like every shape with the button "edit".
The boxSep parameter is used for several boxes; it define if the size of the current box must be considered during the definition of the position and the size of the boxes.
For several boxes:
  • you can add a box by clicking on the button "add" and by selecting the part of the text you want to box. If the message "Invalid box, ..." occurred, it means that the box can be created because the box you want to create overlap another box.
  • you can remove or modify a the boxed text by selecting the box in the list; then you can delete or modify the selected box;
text2

Joined Lines

joinedLines

To create joined lines, go to the polygon section.
  • Joined lines can have arrows
  • They have the same properties of polygons

Axes

Axes

Axe is one of the most complex figure of LaTeXDraw; its parameters are fully explain is the PSTricks documentation you can found on the LaTeXDraw page.

All its features are no yet implemented; in LaTeXDraw 1.9, you will be able to customize the labels and to choose which package (definition of psaxes) you want to use (pst-plot or pstricks-add).



The position of the borders

You can change the position of the borders of some figures :
  • outer
  • middle
  • inner
Like show in this picture :

text


The colors

You can change the color of the borders, the interior of the figure, the hatching or of the double seperation with the parametres frame or with the toolbar :

text


Filled/hatched

Some shapes can be filled or hatched, like rectangle, rhombus, ... To fill a shape, selected the checkbox "filled", the button to change the color of the interior of the shape must appeared.

To hatch a figure, select a kind of hatching in the list in the toolbar or in the parameters frame. LaTeXDraw do not manage to angle of the hatching so, by default, the angle is 0.

text


The Arrows

Lines ans arcs can have arrows ; there are a lots of kind of arrows listed is the field like shown in the following pictures :

text


The thickness

You can change the thickness of a figure with the field "thickness :" of the toolbar or of the parameters frame. However, points do not have thickness but size which can be changed in the same field.

The kind of the borders

There is 3 kind of borders :
  • Full
  • Dotted
  • Dashed

Like show in the following picture :

text


The double borders

Some figures can have double borders like rectangle, circle, ... For that, select the checkbox "dle bound.". The double borders are, in general, movable (inner, outer, middle).

text

Shadow

Now, a shape can have a shadow; a shape is defined by:
  • its color;
  • its size;
  • its angle.
Shadow

Colours shifting

Two colours can be used to fill a shape; the shifting is defined by:
  • its angle;
  • its position.
Shifting



latexdraw-2.0.8+1.orig/help/convert.html0000644000000000000000000000543511347255510015005 0ustar The LaTeXDraw Project Manual

Convert Pictures



LaTeXDraw can now convert pictures from a given format (jpeg|png|wmf|bmp|ppm) to an other one (eps|jpeg|png|ppm) with this frame in "file->Convert Pictures":


line

You can add and delete pictures the the buttons "add" and "remove", choose to ouput format, choose of the output picture can overwrite an existing file and choose the destination.
To launch the convertion, click on the button "Convert: a green icon means that the picture has been successfully converted; in the other case, a red icon will appeared.














latexdraw-2.0.8+1.orig/help/index.html0000644000000000000000000000447411347255510014436 0ustar The LaTeXDraw Project Manual

The LaTeXDraw Project Manual



LaTeXDraw is a free PSTricks code generator or PSTricks editor for LateX distributed under the GNU GPL. LaTeXDraw is developped in java, so it's independent of the OS. It's available in English and in French.

You can make a donation to the LaTeXDraw project here:
http://sourceforge.net/donate/index.php?group_id=156523 if you want to support its development. For each donation, 5% is given to the sourceforge.net project in order to support the hosting of the LaTeXDraw project.

For any suggestion, mistake in the orthograph, you can send a mail to the LaTeXDraw Project Developper:
arno_b 'at' users.sourceforge.net











latexdraw-2.0.8+1.orig/help/import.html0000644000000000000000000001011311347255510014624 0ustar The LaTeXDraw Project Manual

Import/Insert



Import


LaTeXDraw can import a PSTricks file : PSTricks commands are translated in figures in a drawing.
To insert a PSTricks drawing, the PSTricks code must be tagged by :

\begin{pspicture}(..)(..)
..
\end{pspicture}

If there is no pspicture tag, the code will not be imported.

This is the first release of the PSTricks parser, so only a few commands are managed : psframe, psellipse, psarc, pswedge, pscircle, psdot, psdots, psgrid, rput, degrees, radians, psline, pspolygon, psbezier, psdoamond, pstriangle and several latex commands.

Important PSTricks commands like uput, specialCoor, ... are yet not managed.

When you want to parse a text or a framed box, it must be boxed by the command rput; for instance:
\psframebox{coucou} mus be inserted as rput(0,0){\psframebox{coucou}}
Because a text or a framed box has not coordinate and when you insert a text without rput, the drawing is badly drawn. So you must use the command rput which define a coordinate for these shapes.


Insert a picture


To insert a picture in a drawing, select the picture with the "Insert->Picture" frame.

line
A picture can be rotated.
An eps picture cannot be import but pstricks works only with eps files; so, when you include a jpeg picture, an eps picture is created in order to make the pstricks compilable.
When you load a latexdraw file with a picture inside, the path of the jpeg, bmp, ... picture is used to load the picture NOT THE PATH OF THE EPS PICTURE.



Insert PSTricks code


Instead of import PSTricks code, you can insert PSTricks code in a drawing : no new drawing is created, the PSTricks figures are included in the current drawing.

line







latexdraw-2.0.8+1.orig/help/1.9.html0000644000000000000000000000761611347255510013637 0ustar The LaTeXDraw Project Manual

LaTeXDraw 1.9 New and Noteworthy



Here are some of the more noteworthy things available in LaTeXDraw 1.9. See the release note for details about bugs fixed and other changes.




Bzier curves




A Bzier curve can, have more than two points, be open or closed, be equilibrated.

Bzier curve


Free hand




To smooth this shape, a point is drawn according to an interval (it means that not all the points are drawn but only some of them). Now, this shape can be formed of curves or of lines.

free hand




Shortcuts




A panel containing all the shortcuts has been added (in the menu "help"). Moreover, a lot of useful shortcut have been defined.





Recent files manager




You can easly reuse your lastest drawings. You can define yourself the number of file you want to see in the historic.






Minor improvements



  • can update the selected figures to the displayed grid
  • when the code panel is closed, a button, copying the all the generated code, is visible in the toolbar
  • a menu item to set visible all the hidden figures
  • can choose the look and feel
  • can change the transparency of the delimitors
  • a menu to check update
  • more cursors



latexdraw-2.0.8+1.orig/help/sysReq.html0000644000000000000000000000365111347255510014611 0ustar The LaTeXDraw Project Manual

System Requirements



To launch LaTeXDraw you need, at least, jre 1.5 and 50 Mo of RAM. To create templates, you must the rights to write in the folder where LaTeXDraw is installed.

On Ubuntu and Debian, you need to install a package of fonts to be able to change the font of a text; you can get this package in command line with: apt-get install msttcorefonts












latexdraw-2.0.8+1.orig/help/features.html0000644000000000000000000000477411347255510015150 0ustar The LaTeXDraw Project Manual

The LaTeXDraw Project Features




















latexdraw-2.0.8+1.orig/help/export.html0000644000000000000000000000731311347255510014643 0ustar The LaTeXDraw Project Manual

Exportation



LaTeXDraw can export the drawing in several formats with the menu "Export As ..." in the menu "File" :
  • PSTricks; of course, it is the main goal of the LaTeXDraw Project
  • JPG and PNG; thanks to Java
  • EPS; thanks to the jibble.org Project
  • BMP and PPM; thanks to the jiu Project
  • PDF and PS:
    Since latexdraw 2.0.3 you can export your drawings in pdf and ps using your latex distribution: a latex document, containing your drawing, is created and compiled into a pdf or a ps document. You can then insert it into your main latex document as a picture (pstricks packages are no more needed and the pdflatex command can be used).
    To carry out such a task, you may have to define the path where the binaries of your latex distribution are located (it is recommanded for Windows, but for linux the field can be let empty) in the preferences panel, as illustrated in the following screenshot:
    latexPref
    You can also add some latex packages you regulary use into the text field shown on the above figure. These packages are not directly used to compile your drawing but are saved in order to be easily included into your document, as shown in the following screenshot:
    latexPref
    In the drawing properties panel, you can copy/paste the packages saved in your preferences into the packages that will be used to compile the current drawing. You can also add extra packages.















latexdraw-2.0.8+1.orig/help/images/0000755000000000000000000000000011347255510013675 5ustar latexdraw-2.0.8+1.orig/help/images/triangle.jpg0000644000000000000000000000340711347255510016210 0ustar JFIFHHExifMM*1Created with The GIMP for the LaTeXDraw projectC    ' .)10.)-,3:J>36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO1t":!A1Qaq"2#BT$35CUbrs,!1A"Qq2Ba ?ȋRy_ i1eIJ9cI G3榯b+1 !vZU1=I%w`o)a=g8N|Mi߇tзX0[*F_{~Y7VAQmF2(\T乬x&+߼#nO~󿀏6]MpD2U6Xwۛ|B'UU1~ȟ0}ܵj2ҫYFð?BַQ-31Cnf- khE}71Ů IfU.U/t?DVo|YHlTEP""! x>C戋3latexdraw-2.0.8+1.orig/help/images/shifting.jpg0000644000000000000000000000205111347255510016210 0ustar JFIFHHExifMM*1Created with The GIMP for the LaTeXDraw projectC"9%""F25)9RHWUQHPN[fo[a|bNPrs|XmC""C%%C^P^B"/Ss145Rq!QBc#A12QR" ?7Ql{뒅H_{>GUvٞ|83q5uX^ 9؎;cqsDžYY˘z7\ ]Q, n/> Y.anp}Ff f730f}F6\n}F[rOkg~ޟa[xJ[m' a;<8ήx|3x|3ߋ&;ă.ˌ6\ l ' w:xq"w:xq#0]6f0]6gM6w6\ l .0p ?AO{tEtG;:aKlud!GuYԏv+X;̆uyԎ&N##̹c=v0;!2z쇞<e̹0X'k$QWq0Ξ}Ξ}gV=tMrn_]VD*ЋuUn|"phD@["\>EZȫB-VD*ЋuUn|"phD@["\>EZZjTVpKW_"latexdraw-2.0.8+1.orig/help/images/paramsFrame.jpg0000644000000000000000000004012511347255510016637 0ustar JFIFHHExifMM*1Created with The GIMP for the LaTeXDraw projectC    ' .)10.)-,3:J>36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO*"M  !1"3AQqr2RSTa5b#46BCsc$%&Dd.!12AQ3q"a#BR ?5:NK+ƞ5 uKj(֗ 2U`{Z\0Z ֧IK\iΕq ڭZ wJprR6t&6t+x"ѰD|20-g̶>FB v(1 ve@f^)'Gu)6yЛS~W1lwGŮ@k CbKby"KGpGyvjwgk>mWOGF*k#`:? XUe0C suv+ X"G/EFO3 ͳ vd4;ȴ}LB@p`vX8nX(-ʪ:|HІ62V і?;+y!Uul.R[ DQ>wiv BmNˈt) $ґ:2؃3 {,騩[7jk\XDF[WxJݩojw[/c)K}^};?cKR⬺u,S3=PQT%nfI1PGI%uDHeܜ8弢[&SmNlB^Ji@5/q}{ (+5XiGE؅#5Wa6gjuoq4>&9݋%%Z>y: #k^ Wx/#b BmGg4:.iM -oDdm% 妐̍sjw*m=KrK{{p)EI%4\{\oX}S3Eb0808$TXgmNڝ3 }D`◸-xB̯cdmڝ3 ;g09'hUN+))/w[;nV=ϡڶr0,uYqԖZ[ ؁##sAMGq^.\:C52"P"fRkJvNX4* @89Yˢa]*ri6̹_ICS`{|$ٱ7/3jRT]GR2|m3ia|=b!B5k'򬴹/@Z[W7Rw4b;IfLJ4&5d'B:Ov~ p!ԗ;?#YiGR84pҤ'¼GJtK8-}G*Q9:WˤS-+)=~v:7lto+9Jg>KJt x#o}e';?ltG)rt}=|-+)}|A>M#,%4sIž_.?t6:#,%;+{/<]%g𮅱}G)R|rOtI𮅱}G)Wr{=|--)=|B>M#+9:g=GKytI=~ж8<)AO3#'x#O}߅t-#>OD򔏀f 5MJgy)7&"srWySdG?Z9X-)=~KK=owt-7lpyxN|rw^%'ºlyx#Nx%'¼KKyO}߅t-#xԱG'K1p[KX"1ܶ i+[UE/ xRXՖXjiYx3Cp(H1KQ_XC>Er> ѿF$qwTut9H:N]izTb [uRi^Lnm!Q- hYvEq${B$p#q+~/d h7(rλ:[{GTpG~Vx^n#ޗɥ.XDYD@DDK@D """ ,%,2xJٮGzf9k6oXDr5LUE's ٥r?Wt^./,^ E*uyOh~~Wx\8z_%t"e")&V$c| 8G5,抄x cӚR9]TotX)Tku[RpwL.PQ4yv9.߄,6)J>Y_%[X+f{˹}t봜.xgv!ҵtszIRkC|%ꃄu2EOc<#|Sޔt[6+#8gV90IX%DZkۇZ؂=5*td=kM1tN,W\M9$XZd}GE5\⊸yGL,GE\5Ok X4ҵfJ t{es/ㆬaNSG=:SЮ}B(:;HDn#MUifQfz""XɓRK>1^9Ζ\F +NcrQ4\.^YGpyg8f)WsCzjo7^B,QfX""*u.vBLVgd@Ҽ%Ҙ\LfvU#tH^B\^:ZRe煢WV3 )ֆj_yxa̯?IS1y yфXYxe:e!vdLJ`7&rtT7&#ϒ'8U#~33$GP5֚9R͗_40`.,,2цI%sj֑l=־н];K,-ˍ~*s+Qf]k9 ko[?8 [O5lұFK7t5݇SA; Zxytr `5ލ/ub å#qTWj\x;fŅa]l:[uU7ji#F5PDf9uN&"(ˀe;GNc`+xh:v]tЎaI(ٖ|Nlk޺H_#i7EZ:ygSj.LLq*5c#DYD@XIɞNL"C,9Y+YRrVպ n^.7,]ңi{\ܳEvpͤV]q7Q=o>+KҗB,QfX"" ]N*i%{KTDw%;;QMA& V6vD١tM: \d)6s*%%֕wSJn:d6BS[>|bQN/qe[>/{]\-[{3>2#ܶ犎[;-ײ\v_}i!YG8sCA+dTX/IMۄIe;OIkX(iiJWzt57Ë^E$ƣ0g+TLJD*vq%FgzQ7e\riYra8IlVK-u2QW=EM>{ +l868+ @D;61cZ{-r˻) oR)+i -&{I>PX׌} ;.ʋ*gt%2A4uu,쯻Oa2KIm@+šAG Ɇ(`i]Ј""=K5D wn޳frܶRrVպ n^./,]ңi{\?W_ DVރڭ=8#YVx\8z_%t"e")GirT]!E4[S_RcknHifN9ĴhϘ,᧒J Z+ ,mZ]vb,.X53l!RY̎uq߉zٓ{u#ϿͳXf,0x#ّ9^K 11YHI]j}Lgw2F~2M MqKif}٠&6seV2V_r-(f-ؗC07ybu-S|l]C˺]Qy}Oqa$R\eY8x{Q+JVrvV1zfٞ qn2fـ,^RŰZdIau.Jzf}]k97vx6o9H489"W$سJv^K+4kMo2ϴׄ(Lei&7g~Itᮋis8 _KY%)6eu4}dѴxLkS/J:^5t|Ύvc7WJJPE0 g, #02:hѸ(RNQN7ͻQ<ł^K]GEKE=<`:U`ou4StDgMWxtޮ xMꯀ(}%ѭQ2Z# ͮ} !Jzhy7%:XLU1,WE .MS 8sHtF:x G*t8єDFX\nqɧ"VJ֨  YIO쓷ɍ\V9%pKEQ3! B8*ƣ\iɮ$YhM4dy z[O QSPmNW hCS,jۙ TƮ܏]Wh _'W $Xa7]nt09~0 2V)/䪎\`e}΋SƐ7*mAPڊ`=_H*%g~ISB2N WӅnRS#c|Vv &7g~IYԖ&7g~IY]Z(Lei&7g~It hm3y}Lei%%%Ʉmo2ϴ?%&sH԰_'肚JTsORJ$C~ K qS9{Z1[&+Ԕ\t+GpgK?+m":jj.ִ7 [/nji!mkV⸶%^޼;V4-J\X=fe子ni7: hH#ԱY#ab`To.a_qqj%t178I\lOF:2|#,WT81 9m6t}H{47cZn'b_hX27qx_V-єqpcENIz\ieמҴC7 CGRH}~h) ~\p} cCMk-NZ᧊=у$Ozڳtc{r_Uɋ{H&/SHɋ껹d1zN^^w&/Sɋ Xd1ӀCm/}wfEAAkl$n ƚ̅o.mn%|-kgEs߀" H97Y{:p[*{͆JRfhNa eݞ,![* ߭o k[°GcRHswr&SI#0<>ʁZ|^^+IHj68xrBK$0Fe~ni&U A+Մ<;!ffP" "" U<| hQwpyWf9u }MUڤe] W/iKhw>ꍤ,TRKZ0, 'k _xxXDƸ3;P% kX 6cnMu!DMK6ܾ9q4ɥ;؃⌈7FcsXtc"k.2J cye56hI]$PLHVobHfUT8XѾQOphG#8tp끖ZB:IvLd2pi9N 1ї0rWzphd~1u'[{ $k,ֲ7weSWjzm 5dEԂ/GS!-@[⪞]Q%\C-nh{cu@!r e%s"Y"Y 56AD@DD9;./*]ΣpͤsI/)ʻ\z_,җB4 ~tD9]"gm cT-7݇VFrs{o|92@|/8־p;`1e[ϮlT,a#6K<@MYW笵C[3`f$VU;;אW@;gamg;}c 4{*bxeó3BD@Z*5lŠX_ŝ'-/Z$3 i*.xFnSiEXK9+;~KB upK6q{O>j#x_ZFl9*Ti8]nkoXvU~`rQZcs;?rBAXf{=!=<>sεJKF]E3kyvBr͐DE""" QwpyWu| h[m#]e]N }MU{fDE^$x@p-p" 1lHH_#|v7ffd% ~\^N}9tht2kbX0a, Z"(-\ӷW6dm-w&@vMM|S[&  jDDc̑;H!XH5aTqmGrds:!}g2ժelMǸ*ci"\ٜC<2vJ{D0E:OftM,[nuz&c[ R;Iw ^5x% #"lQ+H~PH@À6ϭEvnnj 8܂r61d3ܾ}6jZs5 9Jf$='zZ"NGk^7,$f5hoJ3Hf2^9Gy7v!{lvZ\,28W=dl`-u:hd acH&WxtZFyuIbu|ֺ*LNfygH\כܛ/iҍ ͵[)ZFіk$\DD\D@DDy;./*]ΧpΙw:*RpK n+ޗ4Ђ", H:gM esˋoÕ{40Be,llL"j:b/1lҭt*(''5䅢N,zGK##O缀ѳY!4JŮ٪\Bi5 ~Ķ\_kYj&U1=;:f0ۆ5.Wo氊 cGZqPd{] 18ߢbf٠45 -7͎#氖/8A6ԌCK-5}L-HxL!~vi5Kkc`uأg) r""`x#QVN\D!YmnL$7:W>z]1D"pygedE$ؘgia$u -L"Xp"_*ڍZCLMiQ U9"C]`ےz/8FYe<{Z1 A?]ER>썚q+[SfbXMTjl,' z}jRѣͤ*ȺF*ͤ4pao>´h'Kt4n)kq ç2pHh`tdŭ#!cj'IPj+hd#NX,N!Et*ptko5ce;4N3D,-[vJOo؏ S-#dEl{n~uN6ρF٭]F{zZbմNtNvGe{~|L&ϗW3Z;WX2 6dLDaJ<KcIb"5Tv\2^UO!'a%_+,®]e]N }MU{fDE 3kH錬EIV.Ӷ8\{~BN,S7F݊OBļؤ*Ki+|%,S4 3*o%~Q4qԩkcYQj.)} lRzW~%L94XZy,sR=|8ďE;!awi"ޥ9v} GICQLe:EH [;-Gs"7kCZ0EDDxM= Sԁь@eo>e!@ܰM<\}b/QZu.wʷ2:~ I+uج'{~JjSd-sn9y:S{JctR2!1QY 5ydeu?QfOği2~%-ݑdDOTٓ'~2~%-3&ȉ:̟?GSٓ)hdeF) 񇗑lO6̕A)XSIwpyWu<| h[t]e]N }MU{fDE㛍PCbx n&l:kM4 D~MwRjh'~9C#]*zIo{2"@nzӀ5q.񀵈˯%!S5.sF{&Et7|fҕ0UTK482cduOQ:F˝ C1f,]|?EO;2ŭ-hcHEճ3i$5ֶ w]qލllDERB" xu f-ZiuAK=sϟ?%"X%Q-5>8LxsPyZܥ6{伒n0~JT2b3%47vjH;fݸHDřݫ*E/ t$H_m}iMխ[+船MB" """ 5T2v\2^UG#'a%_+29u }MUڤe] W/iKDX dVUMO=V Pt2L6 9X4TN5q)IoY^!Rb~@c=7}h 舀SwpyWu<| h[t竹x%7YWj_@Suv1^Y.$n`X v&t4Mٞ!#^ 0Tk:"Ό/.o 3|}-ϽOQ?1I(ᤘ); sTe$(TDc㑯 [aAdhp"5R$  oyj&J DAhMW>Л<ό#ovZaeiCtkDE+]19`ckbpXm12W_[;azy!Mh5+:mD1skCYv7DeL@٘xsZrrwdsV=g4=iCGaE"^&C17&}4:t|$ ȗPLMzkϡ{ۏ{%fDMzbo;=W>iCGG!17鉾PPu^}43"f&C17+k{Fs-ՆYmWs~irF&C17>/Uw7DUߚf$bo;|ޣWs~iK5]V317鉽!G& $f砪G2.zBM]IM]J2s17&&CG& $& $dH(w&CE5m$R YeK5^V317鉾PQ}4% c1#|ޘhjM_AoFV317鉽!G3zWs~i=bF&ސzWsmzWsec1#zBbo}o@oMo@oLf3 %n./*]ZL|r,.slD)/*^ ZH«u6Khm?Ot2in$ 6>rrBs)Nj1>c_ ca7,ZOƣO,Tr>@2˿/~=X- 1fuM.~KZ(~Cn^l|?fjV'LK<6>vrxl|?fjV'LK<6>vr9ٹO+Pz/ts?$+kiOANx{'Ú{osJ6B3>b_?]O)ZޤO.zvtM3M4 61 ٪i}^|z,mI0ǿV$8 _,j4d,m$nێ <9{ 7w9z^_7]OisI=Hk1;8>OsIT=HzAtls|$+aS$ +w4Sw}$ľ/ÊS_u$x'ԉ?J){$x|$DlYo4Ww<9'/S"Xť+ j+1ٌk{[-UN6Q$6!긷D;n?r<R'躉'K4|n3i~xsM{N^D\i|W4W$'/S"}7?ˈ?\]NPT8>i Da cu!8rJBPO22glatexdraw-2.0.8+1.orig/help/images/separate.png0000644000000000000000000000071711347255510016214 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<aIDAT8ҿkQo%`,Zl4TZXXD "B,-Ig!'67o/9nwq`y;÷N6Ylc=3{f2Sfp nx˖s'[`?Hv <̛i;炭`׫&`0.`O2^D+'GZu w``'vj7kl`3s)"*gpuB5|?N=؉*"9+8P3+.{c ;K#ƙãeX]ט0 _CЭeyT?84"nцIENDB`latexdraw-2.0.8+1.orig/help/images/joinedLines.jpg0000644000000000000000000000310411347255510016640 0ustar JFIFHHExifMM*C  $, !$4.763.22:ASF:=N>22HbINVX]^]8EfmeZlS[]YC**Y;2;YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY`X"-!1A"QRa2qb!1!A#2Q ?$2EHסAdJL2'bx V;s\twX^z'z}|U]{A k7c,'i`r*>~?=c0F=r 84}0#Gb:k]1G]"F7!’F䀎W#G]F9Z9gz`pʫS1Ȁ&app-46fGDuY+'S]s: #]u79?%gg`gZNY%r}t+.MBk9+NGUiõkRs5y(A]-k]zulOS- d;2]sSfa)> t[$XZP:$x;QJJU K#&O 8snpiҬux<˻Шôp朎\Ȼ(Jp'iHasƱN^&"og(I([P`?úK8+<NU"R緒R'AR q:>5($I7c ;cnqSWG۪O+x0N#X9il6Qm;v-PT5]>^'\j|G sYx8Lc{e\JiJ111kN۸yݣ$-V]m͙m&;, cB`y! $wdBTra'wWW"OWfΙz'۫+E$m{A ]$OhD`t%Tt\3$?V5?E~/UqcO9<[Sg.}C^uZ|qTgkSXz i[ A T!PDHSd :N*i!vhY6fcqoKvfKc-+ hǪN3N^8f~j_WU9ǙWBDe9VW41! 1:tB$Olatexdraw-2.0.8+1.orig/help/images/dbleBord.jpg0000644000000000000000000000162611347255510016121 0ustar JFIFHHExifMM*1Created with The GIMP for the LaTeXDraw projectC    ' .)10.)-,3:J>36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOe"8 1QTUV24qrt"56Ru ?aGđ.d3O@-©읻\{کh{dUv۹ǽ'n/J['n/+oDw RAy=W+A6Uv8jf~lS-EA@sl3F)LX2$ED V?\>?PehM"YO*yamD)¡@5i=;g])@i=;g]6O@NJP6O@N]Ēa Ԓo3Ҕ">0ovGۖèm*>TZT5)D%JPqufOmt꺳'ƺRufOmuoB$8J,Q6{9PeI)+' Rlatexdraw-2.0.8+1.orig/help/images/point.jpg0000644000000000000000000000137511347255510015536 0ustar JFIFHHExifMM*1Created with The GIMP for the LaTeXDraw projectC    ' .)10.)-,3:J>36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"*!1A"QaqB&!Q1Aaq"$ ?x>$iZy GU Sۗ[%fFFuU$dʡveoSЪ~ܷ>]WΟG|sM #ZRǖ jrۗ!B-]Fc FWm'񤁶Vv'a6_ Aգ%=#bnrzB09aY^p&T.ќ(=h>i+h07VK|SNl~&0)'n6eλڰ>ɖK0>(N@K Czw~A W/Lq(E $0^!x(B+1m2ÓSflatexdraw-2.0.8+1.orig/help/images/axes.jpg0000644000000000000000000000352011347255510015337 0ustar JFIFHHExifMM*Created with The GIMPC   ")$+*($''-2@7-0=0''8L9=CEHIH+6OUNFT@GHEC !!E.'.EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"@  1!QU6Aat"2q#c&34BDRT ?3HUr1kr؉֫"M̦2n&qKr5ȩún?UDEU]9r *iSkڽMoSuwSdInWoZ˲'ct?}_zܧ_!RZlJ/c9{oM[qڸ֢`t8-AikޥXގ+G$xqd9\5iڮf,oj9Svli֝]HwGWI|{+a} p#=b_JGXzŤ=B\j4&r`zv*bNN$MwinhBTTV)IW/ZcUU^i/wХ6B(^2UF٣ۉڛRilΞ]K~çdkwx~}ujxXeeVtDV'blmt/1>.--͸HXǻRi/wРW:-%$uZK(y|t]N+_iKfj?۾~인RH*#U=*9Gy-*T*̫q,HwsTKU$uZK)\MjFJC-unUd0tmx@6AQ,1Ԝ=H$ET36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOz"C !1"AQR2aq#BS3r$4bsCTU!1A2 ?->tnojM+LwX#,6ꃌoG=֣ovEgeLesxc{xV9%H9QcEGu#iRJ6V8k_I52}2yowu7j"fMy=Y+=#x3LcJٻ Ԝ7wMsQMw-CaB<h0yhDiM19ǷQ,HHl,7gI;gk{|`(>*qZ̿d3$̇ jce5ˎ Dr<{p=mM}֪^ARrEsx|H?Wۓݫ\H^@Qۢ/$ £lrqWN%sq77z;IeBP#*x'JU @чԺ63# dv:kp{ϝr⹼]ZF-Ǹ8'p9bxA$)J=Zţ)#O$ũ":߭^&7)]̲gݜb>tnlqRW:(M86qp.U s~3a6ncDH#Fϴ|// wzĜFFlz)ҏOՖyº.P3m>tno`nfU)deGUfӯk$aPW$T~>uZ[v1;[r֫PjZAnƛ1l~{1U0q, iDQ}tz<]) o1uʗ_H%L\|c1ni9= b{+"rcvʺO7Iu̹Lw[[!vq4 f̒:eEc^[\o޲x1J',ح/ޟ9K՘,vif&ԍK1'4fJxF&0N8*V7I%,%Hd8KP%E-H] JPer"[yb; Lj |\&q$2c$x5Ijb=as idcw "Au Sm51 Fs1=cTxz~D'ិuLџT?Gǟ.MPa+lڋ]8(G` zX$#>3SjSm;w=w k -ۏu^N:ai4ća\/t8F{$#H^">*9 E'AH=<}lG$f:N FxW{ˉ ,u^zuEPD=b#0S$g5 Y"^By($SV61#WTg+q<}M<}duusbΎfѹGΫ#6 7 rd ).Sع{9PٜEU(6xC=Y([wѽGθ\=Ć)I6HQχ`Q$# 8nߟ,|݌|&}5얌ޯnT;x% ^Kve !<$xswnosxWmuI즾 [.Wq'$c/M/znp%6aOww>$ғAibQoVOVd<9eNh7Sifqa͏TDG <'y6a)*3's/tƹe.vՉFr q,[|#U:` on>-GQB30rtc#F:{yq{БLr1N19-$cV4`3f(QEZM4"`>#PƭDL .㳙EV+*EѺ j.`?>t  [ #xq#߸s|9R 1 gd{T{ ʚxOÝoamo;b$O0oij0>BAEP0/(7cխ+KDWH. n%0:#EPCnbF\p\O [ђTIPyQ 0ǴPHR20 `I~3ǣZMdТeB(kFji^@8Ź|k:lpZT9 Q^g h2yyY_j9 NNM,:uel~1/aU%b6ڄ"D  p{ #17?ԚM'VoldOgksxc# SQIѤ-cSJģP/2;{Nk_j֖qMsĶ4?}K pP}a*RusS}i]۔ HaV%X!f5G0w[_abLpLn9/JjIENDB`latexdraw-2.0.8+1.orig/help/images/text2.jpg0000644000000000000000000002676011347255510015460 0ustar JFIFHHExifMM*1Created with The GIMP for the LaTeXDraw projectC    ' .)10.)-,3:J>36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOQ"L !1Q"ARS3Taqru246#BcsCU5b$%t*Q!12ABRq"3a ?*f0KCXmd󺲞WC({^Ôf)++Lpivk[)]\-$ sLr\@w2&vB#q $Np+ܖ"պϣACOsGCMF6Qؤf彋l::h$T2&8m%XYįsLl?)}{R+HJ4ʽBܷ;ه/obįsLl?)}{;ه/obįsLl?)}{R+hJ4ʝBܷ;ه/obįsLl?)}{R+hJ4ʝBܷ;ه/obįsLl?)}{R+hJ4ʝBܷ;ه/obįsLl?)}{R+hJ4ʝBܷ;ه/obįsLl?)}{R+hJ4ʝüBܷrY -/vXp44/Bu uJ.," ꘪ&}1C?4%N~ mk l na-OĖ[ŋI%$rM?na-\t$~ 9&702$~ 9&702$~ 9&702$~ 9&702$~ 9&702$~ 9&702$~ 9&702$~ 9&702$~ 9&702$~ 9&702$~ 9&ի̌t/2$~ 18$ @RR',\O.y'ಋ$"(Ľܸ;05]ʦV]W|؇&?zo^t)""Pń,RN{+d6Y6UGVOG VRw5zZh]jv<}Lec#;xy5.jyG$=x>9O4ث( @#kѫj]L>1suAGFUJ1 "l*SV]׺ j+`Ğ'_yGC| =a7/@|hD@DDD@DDD@DDD@DDD@DDS[U+K*OG;=6⪆!tͿqib$emSSQ5S9l:F*&kXWnΞFI-@h}Q8ߺZ|1lP&I77HMI6W=_zh̑8 k C \g+LW/ c<;>);F`^;7svvuU=c+8XM /?~; _hD@DDE]L4tTm$$8呌\6dL2Y6|hsIDʇ񾤙} mİ;+kK 5pp 7`SenmUz6IC'd1:ȸf{[4N!պ4hw@ENLb8 ~UMܠ(:ȹL|cq( ֋'@ b j!Uʺ9{t{U'V?_=6k*9hteiƪz)q#㑠>7KOuǂ%]-Tu'55cT436cdn2cc{i;צJl*-1. \Uvv+I.mA3?޺G~/C ݄r_5,wg,`=a7/@C| K}".Khe|NsKGNb*8!rX$jP^UqJ5qe|1Ub9ޕ(~ںh<1ƜS6`\ױo5Ys7Խ*! `Ix_-sN x't5SEF+am4wi$Y]׾ n#&$#ۦ8;`V**8i`nX`cG Xn"qls qׂm i MY*ƙ\) F4 g:Wd2F8l#'?{?䃛[Z$V"!@!龰R~;_ ÛvY." ""}XOl:쪎dPM gU!bDE#ZKvct|/7vG [v.i9+@wLqqqx*Z4[+Dn@#isynjT{¹Lk< z&c=E*Z Z,W[Sjm2{Z G_5\ROtrKqRs#M'2:E `NҸ.o9([Jp&9&t `MRa.o9([Jp&V|;e S3X74h+ژ4PbUc4uOt[Jp&:2@h;&7ħgl)L6AM X㍢k{[9([Jp&9&t `MRa.o9([Jp&9&t `MRa.o9([Jp&9(*, A_om:St',”18 }W8[JpU5Nd(:StS+Mެ-ro]Wl➰W8$E},#DČYvG>]ϢbFQc,#D.1#(]Ϣed~蘑X.2˲?yLH,ed~e&$er=ՃWH877KMެ}&F/=a/N ➰WL[?dl(C&#02<Ė܇h`gBյ;zjmOHƺnWH_`:XoZٕUL7m;rp͠_EtQ8wsSZK"ikm供_ViIe%24cOӢԯ"ɮ&:gv8[GBp\ hNв1:t, pm (-8[GB hNв1:t, pm (-8[GB hNв1:t,XoT̪ߞ?@|ʡMެ}"F/=a/7`¿gߒx, y]0KReG1n[J\Rjsycs3 u.ZrM37:[2ư0fIҹLiU av OoE@Ҙ\3; 2ۤw1C!V+qۍ>*GKS:q6f{4{I4ӱvKEAX,a-m9|HXƲ8 5[^YgI:df xZk@ƃp,-(B7<%W40qVh+[ ta8Dz>j؆08F۸ע%8HCR we"s `qprFJHP$ . .M*B \ZzBّ6Vc f6*7Asa (f0k8k.Frș{mÛ64Ӻ8 d\f^1Ť;.4h -mN 0ʼn:tlRAP"l^/ӡN6JܯYlud s31n- [\com$r$-is #Pne$i[4lLHq n9;eite&5mRX0К1K]KvEl!gT)=ՃU~)B۽X?uwE^_ z__3oP|.) ~A$Yo:lp g-ٜY<GlO vΠ!K$.-q+Q.mOk}պ|j1 SO,PDL/{Aob&;"6.i0#F>>(7Fflm~!ХKv\0ƑJ5 z!24s^Ioc4[Z bYI-`"" ""f800ֹabcC  V*A$k8 ƑYZM6 d!uƶ[Xy hщǵ2$/NʪiDOs`ׂM{p vV>7F86ՠhR`Դ1T4Dܭ. 6lXEG4AslַY*Eѹc|fX-VnME]׺2۳ZnWM,x Se#1>V|w$^ `t[JN3ȅ=̪$DNv#F1¦'$+ä*|Αn5qζ=;_$ ѵU5DDO̪ߞ?@|ʡMެ}"F/=a/7`¿gߒx, 5sAvNDy/"#-4[괫{ u9;9u7qTUuQq g{*|$^ճKN`iZh@-8tFp 4qk9,S((dӸ x9CKy" .泬-|>6;a~?Ht> " "" ^Ѵ-Yml &iY2eks-^inS"@YdS6`ض"ea=O>طLh}'IM2e- {p}'4ɖ'IM&Z"p}'7 {Lh}'IM2e- {G4q>B#!&<^&DDR,S*7z~?2S~{w}HѶ qOXK+R5ƋX *\S > ~I?dj8vL7v.[$SXH׻58/]\B.} tANր4X '$ZELEyR1V$szw^xVFu\r$g]|mSs:/W4m؟i_[ԝRԝRN+_/vOo_:&&vWi_ؾuMI)MI)'g~:=> ݿ|pSpSO1^Ϣ|t{'|Gb75'T75'TbEOoO/vnjNMnjNO'oy<{>ش,"h_u{KZ77i'W75'TiaULOH;VO"}%{D@DDO̪ߞ?@|ʡMެ}"F/=a/n&k:fx/=a/ 絢`dL+ {N 2'>wÉ4I xB .CUXRiQnu܊_x_ȥi0j(u_%/wV`MOXHlɉUunz䪒R""$QUoAY%!gT)=ՃU~)B۽X?uwE^_ z_Y_ `¿gߒx,ڒ,"F(\c1$ZIa}884i$X=\B.o{%lmk1B__;TPFO$s{ X=MK{ꈃI27VWigBh}S؆O3FQb'4]p"Fw??\&YQO iVDag|uo~~.U5Y4]p柟dMFw??\&YQO : ,M% $Ml""" >ePVWU on`ϻz6|.) tHiwY ȃ|*X/=a/1hqi1fO%a q*3{#84Ii3ζQ\U*bC{.ftKf>Zu)"h⫎6q6G蟾T9 sZk,U4Cs cCQj6i%4qG>fp ƓtV>FVs [N9oe;)i [[^2!lհyUL h9J7M|@eVcl%P3s[OF1kˣ&}A 0SEE ^@Ikۧڟ#Ct&g8pnG uV) G#X# [sruiE]UYU on`}>ePV]lW8L؋ˠ牱hЩ`:/>_u2:x,ڏ|3;S|3;T[ иgXvgXv2:+y#{qaڛqaڤHL䎄yujoyuj+y#2:GaaL䎄HAgXvgXv2:+y#{qaڛqaڤHL䎄yujoyuj+y#2:GaaL䎄HAgXvgXv2:+y#{qaڛqaڤHL䎄yujoyuj+y#2:GaaL䎄HAgXvgXv2:+y#9qk~2Ir㔺`nwʺhһZ9R9sTr|e|wj4xb"gΩxɕmL;i껱znڹUy'TULG7|wjo >gyvwb}ö.][W.ZIHDs7n$7FRzP}K 38'O)NEv{蹟vxkZ$,8.Yim=Wv'Mtn[S\wjm0im=Wv'Mtn=Lf#t`ү >gyzکY!G@,ysw}ö.5ӞA(|wjm0im=Wv,^uѻSOI`e>y%vF4 :O*8TyvᡷuƁn;.taSFcu[AUėL g8XJ0z|ۄm6pN{Ev{蹟aOU݉zN;Ev=H{+4{ zU0j|Oap7e; qY]6SMSTLrffcZ""" """ """ """ """ """ """ ""latexdraw-2.0.8+1.orig/help/images/Object.gif0000644000000000000000000000142311347255510015572 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8kQẑ1FDQ܈zQ"(no!oQ=/C\("2d:c\d:W;Ό1 XP>~hX`7Ng-_M@ \U)4T2M,Vl6q43R*ͪ.l'·i ͪV>B 5@8=8&wWg.C ?_ {ϧ[U@HΫFI36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO=p"7!1AQa"#STq23BR/ !1Qa"Aq2Br ?өR}Îs ¬֗l9+4۔}2SL$)[ڣ ֽ;ddFz,)#CIϫGoBNO[iL{sRܶ+SԸW+ 5! Pup?͗qP9(ա^#!l4XOn3)`=u\GNdv"YEtuIIӁb_|UYi"]Bl+PZrsm_yiMt9cAu/.1)+ZNuv.eM)J;:{vi 6(K8 !sZyM[L8Y[¨eh 4MtrcB%x|;Cf;ͺP'$Տ#8쬣.9(ES}!H|S#>dti=oqOuye}5 RAK@2T,wU룪GŃ3Z[ye_A @nYXQ5Jm}ʖ^QC@~sHqĘ,N{'ʑL#.~l*Tv|jϕ[sBT@"ʌBkI)hԆ^R+ݵ*Fb$a:mQK6X[A4CР!מn@9I!+ݵ*R:D%gqa }vMoWP&{VP?&v *q]p;ZfS3l%KPm!!K9'汶4FuҤ8fq02[kRBcʺLFh8n[&ȵ-lBփ En2Z[ a #O3OW7U8Gk9{smUF9Apy^-Lםm:HjLőSQ!I4IۊBCZ!n@)1ҚAd/_U,Y`uOs>5! kHxޖs}W%94-Yh J\\F(PFv?Zحft\͌k @VIۧl%tqRۄf36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOZd": !1"AQaq5rs#234F$R-!12Qq"ABaCb ?QEcj== +B8IzJv&Ur'QblHdpPH㶨xWYZµGߵf]T֟Rc)hFIާ~r@b,_~U]RChwUeKK[qV.}խ\®pVR )R9ÉGOR29viؔ} JT|m)_s9>^BZwX9z= 0Aq'tն(2IAхQBQEVaeP] V9Up1uFpʲm G90 2㤖.yxRn٢W)#d )+O)P_BFHEx>רSIZeZQjo{^/sD}>Y{~-b'' G?M5=bd'ijBs -} AW!g<9dž}:)bKqj;;;uN4tH;~דE7M$[U{2dpPN8R5ϭDX/S nI>u#bN[DN ^3µcuJ ( 嗫5ڮ2Ae+ˀ'Ui!IF W XNS']Q[R!̶Til#!R (e9)jS~EC|_Ƹ|OR| f/\>')cmz}Co{^/sD}>Y{~-b'' / ~kz'.rmr =_i1?M5=b^YP-ԥ RHߋn*8V{D'uquHKo;$ Ty]avjE-U+Ke‘KA*;'O&Jg"Ԧ^(%BIKl-$b$Mۭv~Ѓ/j͋P}+m>1 %\ΛüR{?bsLo;b)Z\(ݲp1*~+2N\'$3EO'} +hNrg5e<]V23T}9xwrJg~JV)$`2 s֧SXt $nڙ{$7餯GЗ X/^L[,}ͯP|Q\cmkN| }McMm>j*M;id;WW$WFTĝ_0؞4~V׌xOjOTT4;+$*t$ AZxeŸ Ԗd,Gmynnve8j+@I)=MϚG[\;Ҁ>4$J[͖!-HJHW*b@ҳpiꯣ*R.X:d|3_8'kjz ջԱ!: $`ޭ.uW-.)9E\km Z Zs<:i[g$Nϑ ddr3SWZC-RJyk1!B%LKAYZT(F<) bo ZmV);*~b}e%d$ =պjhhAa YV7vi[nnQE(@QETf+D/RT( 36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO>q";!1A"Qaq2#3B4CRSTb,!1AQ"a2q ?(׻xEK:6uQ ӧ*Pd)pDZ纔4t{Vbjd|s_ZnS+W$iԞ]-1#ӺR}czDmƫ.W]vRc1ZJ2;:$$IHy44~Sq3pTc#Z5gxEtD˽+-C?W:S΢kdhi !(Bt H_<kGbʈ?9bӭqI9 A*~֨*UahkEUD Ғۈ;y ZJ..!EP QEajJy #m2w{c^CGS ={tO cc`$},R'ߚgٰ/UՏ#VQO2/$\B: XpSjW8oI:, ):OP n!o)Y$&T~$>sW6mD5(i:%^ 67EGlʞo iCU%"{i$Zl>4%+ RP% dp&~h¤'\TT}Qnrh" 4r.OnHE*S4{噗'{#g[YBV(TL]V\ọ袊y+ćP~bGҕoh O LjSZmme<37[CIumT27թ7yԲp(IQ=XZmyчe(j᭚Kw[b A\o]97Vltssc/_z/#VXqG u8,>:4PTXWXQrDQ⪲?4hzO%-9}qշ_4x*UJRj4qo]0J]v=Oj<=ݔ8h( ymT{ּSFP}GaN-?j(FSVX|lڿ&E n5[;7N5ymF[TW+/_SvӮS܌W?_uv53%(V~F&Z#nM*(T$kp$y%_M~E%sa_7g\z}d'z{qtTw׎]f6g7my9$J&ih՞?^]P*(i٬ڌ`e5{AF$.mVv/.k]}v]t l=5"EBEI+W+J^{j14g/~+|a<-_k(i5QS.yt$?rW3ۇ>:==TUTzb]QJMvSu "._JKW,ܡl!L\ϴٸql9! MEH*晎=/U]~qr5Ryx<_f-܉Tz2 gumEɨ:anM-fq㻛7nZkwOD_e귄u-oR$"%[˥ K6WyYPYY6Vsz%ΉJH?<|Rh( jѽeuT?̉ܢ^HwJnHw oFEzPgpچ5Sѭ7JOᝤ5] I7nvq:k5=SZ77fD$ݺtYm{ޣVY{bHsx{vtlpOV 3:byuu‚5E6Z[7Fw!iZ$I vukJ-h˟qo>yЭ{'oϛƤw @yt_g.6lj J{^{MpFfD)S]f}yNC3}8ֿT atrsSQfXnNbnܨΘ6{);ƬkFD_?2 E]G?fZipDte疞Q ҭu[W*Z((!ӨuȨ{ZVU{\cumŚa5b˅X?7\9{7ݬ;[ETrڕn ,H;w4m[ry||uwP2D_%E;⡈DD7:ٰoegGf]:F)M]ƫs\*'jAn<KrDjPBݳ2m~6Us٬c?~vT.qiDQ/wiK#Gto5F֭^^s[<xD4R,1yBCD \ =by*im^|r-"_=oRmϗWjJp##$z5Z4Wpk]Zҵg~v~cJoHUXPymcuse7%xu{UiK3Wы1'Z -Pﶌi-vWۖ|px!"" ORIRTyQK+%кRR΢JQvmf[͌QHFA|}?oźiӿsInYj͍Ƞ;F0W  Fwq~׼!Wqv.$];ZN==IqS D!qMu2D\o܌2oO$ܣO*=6uoEf^ay?dy e/mn(ڵmGr;~iR9!C˾s ճVvңZWkh=g 2wUueAd rm_G{C7J.-Ҙ}uF .VrnAj4T]eb(Il=6^mpwǫmui1jgZ%VQ3'\[չ {?5wNRjݲIT,kdS'\9qRu^ADt˕RmCTeV*Qv#b2A=dX/wrִd$h_9n jW?soCl/gLɂ h>籀˗?ΜZ`6r>NSYѴ<4ƕSe\`LWoű>6 GN_~UT5&Wf&_L쁏 oIWeKU-YɇZV?J7JQGc̣Ն1knx+g͢ߵ5"zzhа^/bjjB %ܲwp-]}}$77j̓$*v,xe`Lvh >x蓽ٕDnD ) ۹e v֐'cL!0HZ}uw4e"Usכ+/>|k.L2=d_kW]]gEdϯ,_:[k![]g篪 I[W*:x{Z"tm"we76DH/yKq@!0ƘdѬaAnf:k:zjiZBSGO+ֈt,_0bh6. SfI#>SЫ'*TͿE=^]:mmN5w a݌ۋy{(5?jR7 6a-p^ܰшݚF +{RX)̹m*+2r#[KwuN/UW'ך=:uS_&=vA[ZPw狟/X@πrf=*T _PsZ;ַSv/3p?co"3[F\fׂ3qb5?>81~FDK~`}3O]\(3柰|/WySo'dTNT  &391͸cʑ,Y޳wlޱ=obj˳%KE[=q[Qq᯦f F#-Ƽ۷n[}39Y3wH"F>>,v$iZ@-om'G,p_b_%GjXԜc?x`bm{9gLOD3h!W6q'BC"K4ͣLy+7;%- {yyysέ"lgh~{>7&I[S(>ywKIIg5<ډ4ZV27> oxO}qkbd;9qK34jFh_gIf=ogh}Y,;HycIQfl4#w$;!oD5u=gIf=4kv~MuL ~ZPӶLOY׽U2k Z"Iz%{y<u~1)vڟ 16FO<ʇ7d:sx 194f-AԴehh{+8k'!ҨU$(n\fUp~o+75wIiI'Qc;b_rYhh |g(Im=;#b=A$qs6ytQDDc979("y9'nͰ=QײWѹwr24}5+A&N}5q>97Tyv:[pY:\O}Sce1؛gv"8$j?%?-\"./  4mMNE]ku.6jM:5wm(-y֣###׭jq/;|ۣޯf}z/.8}[m6xaQ3?hmleGR5Ȩfʓ&g$(b3q3r^K^6L{&1G}i{m$"26GN$շ Հm>kn2ij7?y\ܫFKx)d!2;< `uC2>lW~}?B׺ JjtDyaʤߍ9"6Gw8(5 vR>*8EٽĎy=QA;X`FXN-4st~ӡ=VYϙʆxe{}-_:K6D.D}̥|ͪ/Ѯq{NKւlmvy(w@'nk[⬅U]V2_u %ιplK\ \Ɖ3$KR^[ubI/ 4ډ4z ;ߜmE5UG;I8LgqmW{%ߑs.Ia%$VPh?*u9$Iޛu|^6[I:3鮑$3IF3mRMkࣨvg/']z#^/|ѓ>fk;g8qasvMnC@t/yNoѨӟV]8¤>63>Cv;ӟ3ju9Ѩ?gu1Jc@{hou>Bbug`倗뚈fZ`w&B LbOH9`&`↋M%hǃ=zgge<|7bGr2ȑ!W??%W"9,.0zYpƀ_[CS/}0x 60yܵn$l8e۩SHў$?/am]a`uq4:NJMNۘYcm1Î2)iАz&8fbM N?MʚO+'Y?681wOU7[~FGR@ñbO4m>n1g+2柰t3y/2}47-p$_L©w >6k¢Ɛ)r]X.l]ñhUPNIDAT~on?$fNbku̾QslkL|gю=O+kHxאK)))s3h8mSW y_X=Y lϙ2kH'at]Om¶ё]1GE)=y<ÓeBm옽f,vv4pl{a_]>0«}!~ u<2XKF#z>H h4ܝ@K%oef]).[˂h+.nP^vkѨ*$QDM Ƙ .n RԨs3BGMHT*DuvPNzNN#٧Ѣ)^7![piثǸժ+ GMAhR;**>VWU^_ S(Ɗy3}/VTԭ@TX"I"#>DC}R>4y4Q8m9/UP&oV%Q-Wv&+ӌI.5.,*:#jDN2KĻwޫ{;fH6VGuʤDJJJv|Un^cFA .]ZG s"ՇDQcIHQڥG=BMDD^jW]##G_,0FLߖq6mZC$"h4Խ>L`""fq1nݺ֥ ⒤m%qRY|Fo؟gu%ц:[yy#"]xC3F!"7Wנ{\JԳWXp(ga&h4تkuOΜc'o'r1]!UV7ȓ2OM u86ԣ۵oA")3/#bZ_~+hU!jDQ[h}ɽJ:Y\f6jF@]"Z:]n޺!j4W];7h7:Ik_lͽEV%wtNV.%y49 *_ee5gtU!rND%Ih{)^hb hW&5:u:ߩy[Jq#N1 m-D=^|}|N Q|Jqgk%8DDDg,haGT֭Zݼy3ڷo4IVȉxwZC+7(;~44|mGǍk׮ݸqk 91"Έ81hΉi4^ZEA@h4ءW͚{<ؽWOھ3h޼5 Dj͛5 ;\A!kwwBZ6,ҪU I{m}Y%h4!&Ȍ1{]7k29~hH yt}W}e5ZP(v{L8m!gϞ+^q4ͽO~ԾTIT#a&pi'᭪rb$7oa9W(d'²3T(n-;>@$ҢFUY)jԌo~к.+ |}HVgѨ4* Q(]c29~$uiY:ш>X B6^C?RKuXfDPy(ioRhXͣEm_v 3jtZoRZuWvQn,8F{wMH^Ӓb^*..^2!ݫQҙ;rmW׎l'ތEEբ\pČǷK60Ϟ#A>K,)..N1w6Twϻ y,0| 8O6=j gz07ژ䛔d܎ny G!cYkؚ~~I?9oTRefK=5(;Y;Q4FӀ3V,X;2&⢢;O䂵#}w/..* [a,>isQQQfoOKM+uF^ʋ1712הy=Rw$Zk1~5[U|t>][h伮PR)3Ɩ%';WGl3r%-aQ+:h :qކjр%zhڪ#W.;0g>`I#`ziLiе7VK7[عڸGyZmAނ ebL,N}}WeF7q(&[ _Zt5:pH$#{䎘ϋ;ohbT65%V0q}ˬ'N\le Y€3j =Br8l_=rGLʅ]qko{ ֎12anIhH?a"EEEũSgD-*ct^ ֎]k4qhsƺd <{-T92(ɗ̾+rmㅼ3^J @j4НXoix~z6rGq!ָΪ}o Ek٭Gظ<<K5m|@ڑfڸ<%u|}},@Ck4G%佤_6lI? M~ˣ&o ֶ ]M956=а ͷFK'F .[Scˣ `iP]]:I;!Z{\_׺y4XqC Xn-<{\_n^'&0\EaiJƿQ[A;іunMhPnkˍJx]VC[]ߏ&ԣF75eFruK `y=~[]&%X㿞=i9},@5wu8X 7/Tܧpy4@}jtX9ch@܅F أx!8F#h4h4@@@  hhhFF444]79ENAhmL$cAЮa dT)kvgig!ڱJC%wY¦xN34c1%)3yN;xATNĠ] 6MghCw/I$sww##i;[A7?0ouVsAfiQ՟zjs!tCCGd~g~cĩlK_>ju$!e_U~Qj?~Dċ% ?_>a.Ģ$<;c3CtD?f]lD%9h竜s[rakҋ Nb;~gx>//I$nTiRkqw.Zب95N\ 7M{'C9%×' 4mt¼yWo2Ghl䴮GUz灞N_ۦ\XJ:Qɛ#0u<_|]Fuo|Ng׵W"JXuL kX߹>Y?gCiN}9gqUĉ|&di0FD }2e%x~O('F~˩={Og,aՁ$^lҞ7 9Ch^>>s"2\{.b_?>|0dG{/^uә=zggedݺ~EU]UO./MIMY7f\G39[^Դ@NS\4 rFX)r G:dم1rơѨs59EN3i2x_+!)pktTTԚWI4?ʐ~gN} >AP )pZhASC%::&#GH:) 72:S)r <4ZPd--x J".0"R(<JW"BNS9yyy/Oy ?=3yo. R$"Z@ԾpqqJR\Gǎ.GEY  8s돿%UUUUUUy^8O`@=GD󓗸k׮ꪪ*JUUU~- ¢oVgeAIENDB`latexdraw-2.0.8+1.orig/help/images/rectangle.jpg0000644000000000000000000000546511347255510016355 0ustar JFIFHHExifMM*1Created with The GIMP for the LaTeXDraw projectC    ' .)10.)-,3:J>36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOFv"8!"Qa#1Aq2BRT$5b11!Q2ARqBa"b# ?ՂBDɪZn͖-쵫p`*/ltq6BzS>kKa"&R)FK}zF=]8ݑyd(:`$֘;ݡ7e答aarJ|PSNA?M ĮHk) )#zS>Zdu5tLkn[JC I=QıUTĀ?yįJT\S{DDV~sZZnJP}j#6uKhRkWuhbd4f3,wOc] +CظgU^R[i#Q?0%PJ:T="{4f7XܥkS=m&GƮճrYR]p"P;}W5GAo7vy%LgKhi?Qqۗ˫~$R =pWm@:5LGXs )nuiP, %PhMbKg6vs^3-nRجW2gju*RklޚnmdaRZE j !֖gUeQ]=u+͆FjM$y(g"6k_Cӛ'LHEtL{hݸLi0L|0vQZx;<G1GY}p4Zl(  sS/Z֝'m陓F]X| JӿZ΋iBZ B=m'}ZӢߢM"kCau`>)<٪جxi7o[}=ԇEj2v5$a9 /uQ*8 ̱tq%n|UӏZux+klq\rb‡U@mM)IP@8v"p'EB̀x))BLO}|Û>oڥN mN^LЬ.Ts\ VV+jzD/ܠ$}: [K.K Iz֝1r+c'R@ ܦ&Ė qqJi8PDSs"sAZI') N o1Bja.-*KW&*+y!^ WQD2 - ;ڙ#Ic~'$erT;rڤcכn{sN|" NFþI eNi;Tpw)W*)>ħڵP!?XxĖ"Jͥ4bzEIi7=k2`n>,Us>\8]Y6V7 4.IN ڱN2nA'>u98u( UJ[0c!׮oBGV++{ dڶm?4W>¡2yұ q:ڛq!HP$Uy XDZ(!գt(7iY[ٰiQ0!)pT{(qACx&7]]jQX)`JH4QVq[[-8뇮R*$TU04`֪a݂oxy[HD-$V|7͸Bġeyj1 }%| V%ɭY}*Mm&.ld=#$qN;QEErRQmnNrr)J{ EfyeK$9nQElatexdraw-2.0.8+1.orig/help/images/borderPos.jpg0000644000000000000000000001052011347255510016334 0ustar JFIFHHExifMM*1Created with The GIMP for the LaTeXDraw projectC    ' .)10.)-,3:J>36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOP"M 2a!"#BCQR$13Ar4qs5DS67TUbtV ?o8f*R_Ѷ9$/Hcu6[s2z=0!*o =("dnR@nY]$Sg*gG `vwZ=I7fc=lS%rgh6- Oԟ;>QIВ=D㼓do O%qfu_6@a$/Hcu6['R>wAT>b8[fܥ΀ -dn1s_6@b3C._72D8Sm@<[Rfh2i:Z#  t95 j6@,&ͷ &D L@&:<_)Z۬(HPUG;/>Q5!AfU>I?b\Wdsʑ6g  )奇&Rp;Ƌ\%O%{Eʊ+wxnx8I)Gp:4fPW)_(N1gE+"lVz;.x9R0Z:A0KʜrwJ ucr+&dia0(-.uN6mJq I{ŕ]J9Ƿւ;E=y*4u wd3[m%*uFr3bwH]R=:! s,¼drmGhI}S.TN\UdwDϭP5fO #̢FԙW>6Dc\C5ьcEtSdx_AeZ.v+ݫsst>Q"Jg#sB9]|);ŝ+tcd^ G[$qwe.wH Tىd224\Ҹ}4\wJ6@,ewtriύ-6\D\/$y9yTٌm'fipWsvSdbo>Q5!AfUs)3NxT,f7ߜPH ɘʜ7Q;%{c|Ux1cPs9L3+چ+`pꈤ`ɤpO&cu ^0֜'*$ɘʜ7Q;vL1Cu0 ~LcΟUK=m]QN,'`MrnBG)^sߧ}do^}ܚhQ&f7H'%ŽpvxϕPJUf1jv)U&c%{PElQ>54AIbΡTӞUݣ3TD3S'`qTɘ1n1}O=?SSWe\sCHIǷ$l^zoXBB/Jfcps_>ci< (.Uqbd$sLCu8WFnMsq(X0%Fq !E? !9U K IVي~4C%**sVDY:t+ 4Ew'T1[u )[u<=C~QHrlptRu?:xyZ^THr{V@K1{l**sVDYƭxyM k%I9Shͦ8bm/r/<]_HnfJABCsStb< 5ХMs F5@F /O;vF58!C#gct?'m-֗c9\'t*+<=:jۮwOjۨ쀗/zCܞcdK(0"Yշ]{l:Cܞ*Z^1sܞSd SS'xxS5m;lE M8KPǷS/=75z96S.s p{E=>R ^|,g m¶qa89O1.:Cܞ*)n0[lQl[u08}t*i:ᒗѕ9DVB\Sf'֜'}4\wJ6A*}+.TV\=+ݣ3TU{#W"YrJ6GTE'ύ~c_FT拕WYƋ\ȕ>?@hnjU]fOzHa95 j6B/Rp)^}ĢkB/& ٲ7H}EŽڸsߧ}do.c.W;r >*+tȕя WW+IF,]{s#"gƿ1/*sEʉ+ьcEtSdJZs{c|_EԮ.{}h#Sۉ7BGY?C\b|MML^Bn2l9Hh6l*'t**n.kGb>?@D1sW)Q5!AfUYww<0לqS%|}iٓV4An22,dsJd%o˥fTujYKi#DM@Xu(VNo6A(TԦq3Y/is[@ ] U]a<,\qiRFdxغJT" Gcs%Q7ՠ%t(v  ,Su)-^`$ ֛ r.P'tl{K/J I$d^RxYkjT/!`J9\[c0%6iwgѫI\~H"R.6Bh(M5%ТM`n'cOK}{o%TdmRH8iGtzM')[B4%7]d&cơ`r%Rf2W V }J ӄf';{ -fi I$a/?32i?5"ɘŝCuװ9.'>qOI"h"`19nv@왌c띁ap/u>Tpi_}6u>HiUIy .9!$|QOm/=7!!gF~%WaFQ>! ` عKh%   *ɱJiKFR9]<桺U ٮS|)njE# 2 P $g=1"@<OGOVz?%35 ;ljNeD2bs U!Z==tLyNTArtQIL,aq{- 8Q~Ξs%2f25 N1cPs9L-|j+S՞k# @Bz:z?Ҙ'`Ll'sdr}ܚhQ&f8%SޒBGQ9Ms|/RR :latexdraw-2.0.8+1.orig/help/images/arrowToolbar.jpg0000644000000000000000000000323711347255510017061 0ustar JFIFHHExifMM*1Created with The GIMP for the LaTeXDraw projectC    ' .)10.)-,3:J>36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"A !1AQa"RSTq#2Bc3brs!"1A ?6i{FXE(l}x5Vq .edVmOv\Kn]!hs88=UxNJm4)ӮJmK~>{-,|SK852۷kg9w.t;1%IZczbfa?֪l۽)puz}O-&ף5%)LMaI'G0"f9ov>H[;â\mR?xTO]:cWo}XIZI%;eenC[!,&aJ oW'IIz:%&X\ս^Inm[ss~tCv잯5H~nbXmoE[ʬ$Y阂(W5ēKfPRFy pj,x&ӌ'Vw+뷾nfQ.s3xYK[#xXmB}5h uEgs"5=ɷIǝa(ӯҒǜڗjZŴ5#$˯TaZ̗EMOZdI%!|wrS /c5 i#EU`FT1ENXbNѡkWsy'? {H+uEJ~QQk<7Ӊz#q8 QNIjKu@+{sI-&!QRQE`jQElatexdraw-2.0.8+1.orig/help/images/behindSelect.png0000644000000000000000000000145211347255510016776 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8MlTU3QBJh XaBLwhةİdB vna+>,`aB 0ja,{~А?qID0SOIL `Ċ Xx:fu>3]'!vJ)`uowSoI3U[ޤyh~{+Α=,aP orY;:u[Nv)*ef7z6N3}j0FOm S%= XMȫN]Iy`ٷ,Y'I(OÕh)Áb!74nS<|6C3P8x(mY}i|Ś~NMj(B^d2Yy2jwf ʆ%*6vo1VC8*_IkV_}+pn;L!iW S).u#,&7n$_P3{Jlfock 1o6&nu^C%g,dB_@g@A}ά }xmЏ[YʁGRbb 1Bw6ZÕX8fԧp O]f6 Xc񓤥Gnt,IENDB`latexdraw-2.0.8+1.orig/help/images/InFrontSelect.png0000644000000000000000000000154611347255510017130 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8ke-&%EAAKjj+ŅkJ/ЊKEEQiUZ".-BiJ'QK2iI︘K3I>p6<UN`CTGr_t*z׹dYx1Ƌ'b<"^$1 hbH8Q.j =0*K%Vwɿ{4\.7vra&p s4*#Nj 蜫68v2uW\`W'"3Ϫ:"Ɔd9_]n}Xu|rߍgq)GTD5Cg8|pCg:g3fCHm361i.| K,q#G9nO֣y`?ԁ0ьucllsOc?gq1˹>NݍMLC5d HkhMzBw#ofkZ@,F3!ı#jSُOI/ڛ_a& !PqEݻGyƯ=i *b`h&T_7a+BYIENDB`latexdraw-2.0.8+1.orig/help/images/Palette.gif0000644000000000000000000000071711347255510015767 0ustar GIF89a PPs%2211P>>>JJIPPIIII%sbb1nnnHs=IkŪ%øHkԎ!-Created with The GIMP for the TeXDraw project! ,@p$D*G`GPz8 9MfѨnj214jMAdFu z  qE zNPstR mnhnSSiþKFZFnˑOFhO~YJ;latexdraw-2.0.8+1.orig/help/images/convert.jpg0000644000000000000000000002205711347255510016065 0ustar JFIFHHExifMM*C    ' .)10.)-,3:J>36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"J !1RST"6AQac4Uqr#23Bs$Cb%t3Qq!123R"4Aa$B ?ʕ9RU.@:G{㩥K C$kA'%ɴ(6\ӹsv(>ees)i>Lv{aͽK\qTV04!iZ6-FvBs-R20ʈwvKcّ7L0,e}gu72K[}8>u}e$I`ՌUfi-l`< [StEZKҤ Xm8W6`QGbMInngDּ@d CQ?w^\S)zv0ս#;!4 3J(fѴӉu'_$KE4JX! I Me>#;!4 l9 KN09<:RF b秉Q=EuySDV9wj{M-Fvכ+[26o3Kff]F-Fvio3LKۥM-Fv՛))tUt Ze3e.n+;yZe3e.f+;4Y ^llTlg`&+;k͔͔*6b'1+ ib$8%^)yDP4Pyh9|v/,H . Ѐ1Ů٘]'PHb}$p,#uGRI'!P=_zzPʎ-2jq`ܧ͒2߻&}!<!D*X]sѯqt"X}c6[(k^|3+h_#cۨըhኂ`^$-]kE"U^߲pȝ{ex-=vL<4Mm+#[#/KUY֗\ܶ?0C [#,DyS6ź>+4|{-53MUCl_>YlHM&<-O#jy[M~^=Ev~e>cj]zN1&5c~wXT~Ev~dgݟ<dq~FG+gݟ4YxgO1u|.I8#*y[FTGv,{&?/6xI='eO?t|SʞEv~dgݟ< '⼌nyS̚,{'ںa$W<-O#*y[]~^=Ev~dWW<$2ź>)eO?t|Wkǻ?2h̞cj]q^FU}_hE>+gݟj3{nmb=#j_DI='eWnyU[$U;OWNeWnyU[$O3|!rpB'nPe0ujsE/]R*!h{[EZؑɻ+oX]aO<עy<4Ez/mfQJ\UGfn8p\t<8N9;Oa5znt.V yfJ֒t.W1jeYaUwqdڏݰV܍EUI3jݷ;-{~[?@k|XqjkCZy*#&L溵w)dhn7֢@j(U++߈ p\b zD[Ž*1:aQ潸">Bv0Pܴ>^s̸d͍ 7k}AD;M&^stc\9]iem+~J9J9(}Dm8. ݇`,o7ڮu heٴ˖؋[iElՕ2UaXgmVkwԯQl4{au\Z}$ޯ8l9^0կsf5 ٷٳaM~Swx:яpVڲtUSA\.]#͚嬑9 D@DDD@DDD@)ԩ]oT=VVR:8!H2*.S$T %伛Rm26]cr 7tem#{Dv#\֕+wu(:&2VD1I| 2]merSѴHXBdQd##{5abvem#n;NKVd(9;GZWSΗ %*ʮz'[Nz'[]ydetf )?,3G7r>eন3Du؍zϵ6U:އ|"p:އ|"hKϱ#w}wqTn*/9rl_-dȈ\""" """ ""MMPRphcp-l7UT\- ^e:'ޡoUJRe+ N YS#湍$[VW{h@[=W \vuXfuhQ9Xl6_bۜΰ|lslo^cְphk7?ÏDzÏDzy/>ǚo>\*n7Ksvȏ6k/DDT.DDD@DDD@PRS}uP٥eWSI$Fd;%5QR>e#nl\")i)bGgcԭZ%B&4ˉ+,rWc|YBJ2<ցk굿^f%KV_3%=̨sN*d {E?-UL2~J-|-F78\Ļ.koWrf1$BTaFGV݉y]EW2|dVEHLiWɓr%ǮڵB_k!0#.snW<bvVyz(Af)]0n,@LrpǺT]+8qoC8qoCuto%o>\*n7Ksvȏ6k/DDT.DDD@DDD@PRS}uPUCU%K!cLj #=ah?V(dISWf20OS1>уQ5=]h?LXFʱDB+c?)h?V(ؿ\Evc,}EY%T2G+a%k"îub$.";;cF^}&#/KUmTd쳕7}w->Pm/5E~+8ް3Fg<fH38ap>aoV2׶Vm"iE7&(ް1EHoh&(Uc|"HoXUzVMH\i E7*cԘjEHoXM"QaTc zR/D\zHoUN0.Hš|7ڙh^^sAo3&g^^`^^8:RӺq}Syd,%݆ahDDD@Pp:އ|"p:އ|"hKϱnt.VD-rFbx#/KUZ]'Ǜ6YF]0moBY_QFҼћϽ+z%FҚ3yYoXǞ68<8#^9Yy7zVbѣ7zW0gޕ? {A+4hgޔћϽ+~  ~@V1Diч+>h?ś󐕻? {A+aܴZ^? {AE" 0;KY='h%" 0;"i{k< Jv}Vlw ܬOLx؂&  ~@MB&  ~@]b? {A.P~@͙? nSZLmqZȷl(qoC8qoCvo%M7pGѺ^xJ<B !UGѺ^xidiV|yi\ "RV;/k  FkceW0ks"y&H6Ync׷^\u:I:Kܓ =a`hC!Bdصq;@:ԺIFT9x:re(kZbn]#O,cbf#:u@g d322]ΣfSdEd8.}(A9p׽u,(}lkH,u{U*#/Nޫ?6.k>sujc@pUȔ:ggO*X^g֧ hkZ65 DDD@DDD@DDi6qUh6hwyflLsťMooxJt͌=5pu);+KG )/yKÏDzÏDzy/>sxn*SpGѺ^xʵsJYXb `X,s$oƅlE8 :u(M־PWj :uM |ILmV9u3$ozeMw`o]2< $ogI X>$x6+ :u=Ca6)Mw8 :u=Ca6)Mw8BNqbKOPeMwRc2I,88BNҜ=!6*U[2YIg(nVU嬬(OF pX؛궢"vm!UcIg(nM%LTWԶHFTңsoh!.b5y{q\ZHW ԬQIg([as&f8#\x'RUm#wvyěz&޻iuuXd,s322F\UEo]>$xEX1&޻xc|x*2lxٷfF(Pp:އ|"p:އ|"Kϱnt.W*>\UoW?oj/m$;KHi.uԷ=MX$jYiIu,1H0{x&͗ &- e|Ώ7_cn/\f$|I;Jj)N]s)+C 1;?c;8AA ̈́I7?귵]$|I;IT i U;c!pVq&ΰ=`_~P9_7G5x /m\Yf$|I;IT *2D:yX3`Gg|[5R2=n#qH`kVs_Nf$TW8*%{5, :Gֿx)Y$H0 ԯs_Nf$.r@*jsφ ɚ^ p$X~-ůPvPVE &愮nFվkILē@1ePAd݀ݼQm$Qdw gs lq#9kDj.Z|I;IvǗ-&'C7 Nh0*}~1t&~D k۩'iE'8#TH{[S-8e9!8syrmx.ںmI2TKN$l":FһHY29MT#6jԵPfkuD2K/).,=TyZ^l`ݤzZ"8R꾋eGTmٟq'Nǖo>\n7KrV|yi\ @" """ ,^Hj D_.n)xDE:>R/ǚon0q{y]>6vB812~Mfvh6 sNO̼Vq4ZTPK1l&T>T;7NO̰L_|aT8&ZS`E{ %0 bnۭg_01ih?y5S0d_&L1lCNO̞T;75S0b8c XhtZ'yS-c.duUv\[ܧU3/C{X{$}MoyA>Ц7SUK-zK+`K`UPd)O(2G>/C*Gw5HuFcvͿ܌]Rb|o]#m%oQ/Cg`v6*ї@ JO(2GGq,=,=VA>Ц7<hSo⚨_% Lk%cֹ֋}YrA>Ц7Wŗh)&i0J^km*eL&L1lCNO̞T;7uS0b8c EdA9cAq_ݭTyS,$.L7G!ph5S0b8-TVSFYah!r57PׯaOhsRL\DZpEUKd4f`8v^h%栻]{{^U3/Éagd&6vB'ٿO*re2/É}>Mc ʜf?Hjh g&Y+l=1xPzrC5L x,jV٨zfkĹgxPC4^%;m/j.Y+l=1xP׉r[fmhKw5L^+l=3@5\5.NYjN z$36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO/"3 !A1Qat"56UVqB# ?ދxLY;h'iG._4\f}^4~'}|r#ʏG._4\*('}|r#ʹc5pmto^%LbCI{NN1;겧nY+MΓ-ǚ гa:S2+a-F TTxz_ֱJ\ܔZeU!X(0Xǔm ЅZXNqjanY Zơ(2VP[.IC8O\f -TF \$s[vuɥ8p}|v9BZJ\XJF.rB0]s18AZ5gIur;JC\JԠ Ð32\)^0Gu>4ÈHKG[㏭LZZH쓔r'Ttݭ=N=Wtݭ=*$K콧qË̸IV;7m&R8Y'3gZa:Î%¹: GPQ+R]$Nz )2!]TF'vHQ'fۤ#r*Pe)L Fj &M$Dq"+rª)^XJXĔ&"b(`Z񛔎+6p`ߘpi353e}Rq#RjTݑϱH8%F̪`%+c\8:ck-yk<_ul֦e[m%WM6.4b`IXẖ_dzTeEE=+sAF(-EUZ' G\>>"LҴ|+ЫmHHP$ٖQHUIR~H͌вSva.kUV9g [yq!Zgِhh&YDUP+nDȩVH12ǭ˵=-d}K:LN8+*ڸz=g,,' ѨTȱ ]KiIuDCQDALqO҃BSaVR\5DUEz&~zp`Sܜ!T-" 'v6I4oSdR-J#lJR`\+NznvΣ.Q6Ud40 O*JJ"*֫𪪬JI2r[DB5Yc=EYzU|0un KekmzJY]ujiTW j36?ad23K#R(DϞ6$ۮ<ܘUL2,(SK!Q̸I RuHPCnJ:)Yy EUB &s !xYcoj#RHLQϷGj>I$EUJpeꨜ+T,Xiq竹DGRV&ZLؕNLR@⊘ڈ**\2/rY&â_2ȏ3;/*/:6Fe"OMgkR~ۻɜDgdژna0}[UkH\"{7sS:"Q2VMŖdSBDJ5=a3T-JLLL+8HḆ6Z dJ\rj]bYhDȲ6̫(.V.L 7Z *gTǫM̺ >#AシRbz._Z>RL7F#: M8(BEȩꝣ6ɿ$64BXJZԱ/3ۅ>QO(HH*VZ/Š&.<̮2UjfAzZ9&XQD+R%eV\{8~?Ιm~Xx^JmyvA L-IUR(mGfjCV4datL h6^|hΙmxh%%@VUkUUUV'&rap )R"dHHДe,M#"7櫠 tkn gLf65B w13^vjBeԢdf'Z/WT__:g53[qC&i"E\#UxQQxS2x[+z'&g05ml@ mj̾α3ۅL2lE>N JŠR1qۿ73j+j6 Jqɑ}6`+XV6. +X &D(难&:b4|ʢhmœNysv\Ιm jUEWʆiB@Sq~(~;!H ec b$hZ/HA;V4ZZQ^)ii~~NaڍBLReHnnD Y"4ћE-;%-!O I˵.5;P4)L GD)ن!R$UD"Z#ZjTrg&p XuTTBiUJQpd(:*p*%S[" TЗ{Cx5iFU^r'>JԛI0 n(:A JVrviMԗEhjzf[*ɺ<-B *Vbzi iG/gQI7RVQ[\?=5oPVdܑ:[Kꃺv^ac%J+2TXdz\Mh+%_3S-{ˆZќ}¥j GrPR5rJ*=F fRϡ(J*^ɵR[sL R'tWl*R_%CKy6Rni!*Cn y*AXQF ?dI>%C'u(ZlD)`ş,I޴q=/t[Kꃺ)`Җsvgel-u\5%Z131&E+%ASm6jRsձ֮g]G.bDSjm#&AV\$ɣr̃v+j"VV 1f¥8 'ze%cw>{h ljDz 4K ͏XR ljDz 4K ͏XR ljDz 4K ͏XR NKȼgqKIy%¥E>{i|2r/aR^x qǯ{ I޴q?sasO{i| 5>цB YR<4K=/t`Җsï`w/*nbnytzܑW US"V{1E"݆~ddk;Y0ni9vYE m*EIU)_&xѐ= *m 0ҭ,.7Eec[0آ#"ʵh^htk6iVWy F"V{1VlQVZZy/Tϴd?f`5hL4n+< b~k=n+L6(HȭdZ<*g2Dgۥ#6E.gUď '햺ٍk11/.HH joZԕ< S>ѐ= 354JD 3|$XZf5 4n-#""[x}!{0 ,Ym]3KUO=drO=GbnK?r" UEI޴pV]؉7,3I޴p Jq65cNKnj,})fKJq65cNKnj,})fKJq65cNKnj,})fKJq65cNKnj,})fKKbX} 'ze^3Rآy`I޴pi`0)i/<Gc׽†Z_8G˟9J^' I޴p@՟hb!Kߌ,)gxuNP؈]egqKDװi;֗1tp'L(ݍnZQSU2_y*h\-ҧMG!fX 6_X҆G/;_JZ%I޴p}bJ 1})h<: 'z8y!fX.C;JZII޴p(uHlD Җsï`w/3`w&e>34KLXI`0=)i'<: 'z*U9>ĨIQsl$)h= t'R!RMXG= t'gV&U"-ŏ^ 9}{C7%>+aӎ8s !E[dEB`w/qƵg0؈Lwy8C']l{ 2wY}1rsC']7ƿӊø3kv6,5' y*9:b kDÀmW6"P[QZ&EU@kU 豸)wva2w97?7d?L(T(ʭ"5otXO;0FNc|2*VueVUPe7,n']L'y]ŎAO -c:2+cq>R@e;oqt?7d?L(TDȯEK dE]A^h +Ȅ2R*ۖ3kځB#ޜ%VfDFVE*>५ =|zfZlD&No|R@e;͍,rotTcV=\O;0FNc|.--a zf,܋|<Rآy`)wva2̝ȷ˸:K7mGs?\aFݨ,A =UidH;e`R ZjO(Y )wv` 5>цBd˸9ǚq>R@ce(lDyqtKq>R@x=پ5Tc][Aa)R@se~}k,EK<IUo¼>ttKM7e lwY7q>R@69ľQ_tKbhgZ!*-S΀TcV=\O;0FNc|.)Տd.&Q. @KJq65cK d67˸9Rآy`)wva2̝ȷ˸:K.--a zf,܋|<sv߬?Q3kځB#ޜ%VfDFVE*>५ =|zfZlD&No|R@e;͍,rotTcV=\O;0FNc|.--a zf,܋|<Rآy`)wva2̝ȷ˸:K7mGs?\aFݨ,A =UidH;e`R ZjO(Y )wv` 5>цB*,uk=/tᘺVD:cֵծݛc_NN5Qe:  d*GNjaU\^P؈]eXk_zk1Zj{/^Cb#1ucѮ}uǭk]g:$6"L|Xkzk1Zj; #1r*0='އZzֺڀ&qCCb$\ʵFIֳv P؉23!cѮ}uǭk]Rʧ5X)1.rZ~tWDYZVPV]؉63UYz5Cf=k]Z@se~}k,<-Q*O::Rcֵծ7՗d6"Mk^s|PYZVP g/Wヽ'k1Zj9(UD+*UJ΀TcV=Zzֺڄ Ǖk>s|PRMXAk1Zj(3UX5@KJq65cǭk]L^lyVc7.--a YZVPak~t@KKbX}cֵծ&Xf.EZ]%sv߬?Q3kڐ.$slE *m\W\Uǭk] jϴaboʵ?FCf=k]Z@ce(lDxf.Ub5/ukfqSwuvYnƎt0$>uQœ.fUr:@mW6"<3Y*1}އZzֺڀP؈]eXk_zk1Zj; #1r*0='އZzֺڀ&qCCb$\ʵFIֳv P؉23!cѮ}uǭk]g:$6"L|Xkzk1ZjTAV%D Lf>֪]*cֵծ7՗d6"Mk^s|PYZVPe__z:b9-)KeE+TJΎukM7e c1yZŗ\:cֵծchJA*ip QӶvUl̊<ي^ɂ:P^,k# cvn] Ejds|QU5ndڌEYmϧKqBLyƽ\R;P7a QG7^Y럦MYuqķ*dZ|P,k# cvn] Ejds|QU5ndڌEYmϧKqBLyƽ\R;PwaPz"\H%].xϷ\2mF n"ˀQdȪ\,k# gvl'R%ĎRU犯u&`, _N8LG +%fyi]EkUȫ6%5ndڏubK-K̃,nM*)Ta/Zzֺڂ.8֬F /],9S-rۀk}bJnz/e9h߆Lnn1tkfe1HI ¬L,&,fiWۗUZK9Ǐ׷l66FҠOTZTxdW?ԎQ ?NەLt?{xJpncdm*@UM.xgKsHE c魹ZTWO3׷l66"OV+ c^wq/Mk!*UO3׷l66"OV+ c^wq/Mk!*UO3׷l66"OV+ c^wq/Mk!*UO3׷l66"OV+ c^wq/Mk!*UO3׷g;LH2=ld)[#UjiC2X׫Gj(&nZQ2W%u%zp{xJpcnKՐ%loƽ\R;QD 4ˎ}:kh*U^?{xJpڛlr~] W *ZWEnXUL5aӍs2ߧ-7e M^W3/U̿,6?eN[pRMXBs[ nzfzc9f'¥8\Ln*S2\rOJq65c oӖ*Uњe깏〟 ljDzs2ߧ-Tsף5Ls7>--as2ߧ-Ts"f_Ӗ lQk)9m¥S2O={(.s[sb_/X_~s2ߧ- \qY6 6_X҆P S}bJ {/^C`S8y!AP T(uHl@*g:$6 "ʧ5X o˲ o˲ o˲*S l*S l*S l*S l*[Z,@6--a h,zPA* latexdraw-2.0.8+1.orig/help/images/background.png0000644000000000000000000000116011347255510016520 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8?kTQgn!BV~яb7K66FH!A0R$q{7vсapfμ'O$-kdl!x o=`X\AG$@opVmN p8yF{(H&+ ҙ3,& , "2$MΑYz vG!QUGGI2=5xZ7Q8z4:Ben(gM0߅+p>ղJHUcBI8)pe2SLA*oyC H5s4)x%T2 *f>C )Ea'qo5M2UIڧi1?Tr-RDK% ȃ/6;Ic䠓_>OػC.S6/CэΨO;TP/cX٢i..O;Uو;]X +-Gj+2Kku Vίψ;<) '!lrZ6ےw4dj&ʸnj7ѵcCS)۱Hh6:(cQl%cYRs}#`ݭz),-kÈ{ |ӕ2xn,L kT$쿔Xjjى[ݕ2pR2ApFX)T;0mVݫ[a{CH"0K6Dy\&KEo%^EH.y%7r^m p9/6IhM䜁Eo$\&N@͢7Z.y' zEp- ="hM䖋Ig/*f\%Bm]'m^nuG[|Eڬm2Ǵ">"dVعhm+A؋і[50rU]IFA1.7\'S%ldSA)pf[gJZuM6Ժ)2 ts--:.W"DMV{M ='kf@HУhQYWdFB{ɀ:){M =&HhQY4( #GdУ`$FB{ɀ:){M =&HhQY4( #abF>Dh?obh?ob8Nڽꎷ$yZb>"dRꪟLb f0X72Q)Hud$c$[Yb-fAַ։/[{~bE:ִ_ /M|$76fD^D U>)i{s. #ɈEz~#zުzOoU3^Q2bYz~#z&LA??UFR%MuXY0Q,!Ҳ3skb _欥oU3P%,fx H@߽]z[h!k'lnlsYoUTWUBQ@sp6)+*U4pHOoU3^Qe-FS=?U& ުg7dZuT3z\-Bm]z\-Bm^ WQ_2vVUY'W̝eD u">F^j%aa%U.U 2la DbGchV#p*)2sYE <N7Uj}tnx5b@MH 舀""$9sg\6؆T+(Ad:V0Hhn|8 58> uC `붵*8&8\Hi$of4oUB®"1ɽ"_VMJ+KSDXD@X; Ph?obh?ob8Nڽꎷ$yZb>"d[ձ2#CpK{}ET,"qx__If<={ >X.UTe\A]ol+kYLHk.Nlk@_"/c^ͼ+dD@xq p8kj6C%p V3 KR8\Vi&xf3gE;֗bCVR#h19~!M?/*J(ɈD]# NŔF&"($ ɉ5(͚.\085"lȬ$bnTZ*G$7X<)Iwi5!ɴ LD17x沪kl)sj3݆b&D@X; Ph?obh?ob8Nڽꎷ$yZb>"dR+X"4[~-Z>F^j'daatXkۼ+xˌm/w, DDD@yqhpJ+95I[k] Š;^"G ioYm[飊i+9O!fM z'ZEk&L!mE*q{MVsX5"VsU-lо*sFOػ9Z>OؽF7:>"dVتO;Tھu..Aknv@hO!kH٩BҲ%{hf&k jY5Ӓ +uŀ0ui䩒`dTR" ""`'j(%2=;W+%E\gK{j{WIAY,T5I&' W,7(ew62)[g}[j_֦Xw.7deL.} %NScK^amM̢?g! f=ik G hVe" ,e`(sp} ٷwMsp} ٷz'm^nuG[|EڭZ.j!75cv^AV9O n `YZ3A3A`\ދFaS&aS 7ј  f+( m{^A3A2{FZ3A3ATz-O O ދFaS&aS 7i?y?y9Z>OػǛ^ +T$>ͽWQ<*$Scq/{Wzv\NˑdjK/#vԾmSQvn$QRJ/))qi4k\Gt:C#6^>1!`ͻW4.xt)|PvTm|ڧ;m|ڧ;=K`Uf=;ʼ$%6- 3Ekd6SO1aipХ$˸"uh$2pձ4ۃxvU z|> Z1*AEUݯq uv_AE|\z !(\)*n͑6A.v]hUc )ff4gF᳔-&ʚ:$$k؁<ʼeu'5QX`+h썴|m`> aCD*ʖO<AR(A ̹.k aIͅ[I}D;Ay>1R2,ꪩ$tlzqֵ cCZ`}DD@\vߓxK\vߓxtjNѷԾSWਉ {ZA_);FRʃ&IWi<╚i . o3ofˁRUXqkPDN1ݷocdc5Ť\=O7&ҪE,<5#AQ` DQYDZF8]2 6LcVDx!OJ@Fbw5-d)'ynr|2PK&yAӵ8m^<ڢ;1?ڝOA/lNMxjO|^jw'>c/X kǔ;S5#>Izܟ$a6ɯPtNd׏(:v'er|2PK&yAӵ8m^<ڢ;1?ڝOA/lNMxjO|^jw'>c/X kǔ;S5#>Izܟ$a6ɯPtNd׏(:v'er|2PJM:!ǎP7m*xaX=-DiK}O\ <tj̞ǩyhsvh:.<: kǔ;S5#>Izܟ$a6ɯPtNd׏(:v'er|2PK&yAӵP7\ 'hañjS q5ܟ$aO|^j }'yYW0FƱ_P/!.Q=WӴ [k#aʽס7$!:ky~h ;Ah^ǵͱ dVؖT0S2i7ٰ+jYg ɑ6sh#~{DB@&ʀƚ?߼/M{]\g=JHiHyW4`~߽Z0 uBMT!Naf,ɑ6sh#~SwBe5 utGQ\  \* DnJF>w3 ѝ(w(SYj2;_CX[d3\Z hVy7Y%;[; mٷG0:;o]-}Gk-ˤ J):UGn#;o^%PΠ0Tb3lh'p* NnLsxCkPHe]ˉMΫì4q[}HJ<8IU,J:<`ի&2O J7`w7 Bbum{[1aE63Q L;HlI;5jK,_-Ҹ6`pi*L{VNXI.)Ncq!Na]T/)DJd7^4xjɪlR4qhmZ| 3b&d`5Er=ŭ%BΈ+\ 3b00yddy>U6'TإaiX,[WԦQk4|V8"pֆAr=ŭ%BU׾g+*8g4QdaM4-y:u*t5/&NJԱpZO@cppQަ/xMSbYc@mm_RM910E# ,U-l-tAZM9A$#̍9R.uvM$#[b=¨1Q>xb!'uZ p :riI]Isk"82; :V0crGg>eDffdy9Եgp?XڧKM\=M#˜㔜tiuV Q.MSmy^sۚ]3Eo[j2i|4]EǞmc}F>.MSmhϋԳ:B[$kJj!isܷ[ƚEi|4]ZAX#|dgu4ɦtj @{k'ufS8|ol-6zNȷ`OH&Q0DDD@DDD@DDD@DDD@DD7~o-oG2`lk&-9{s>Pt1|tu6&Jډ%,Fp7ȧ1kŒGO#CIGcaht0BTLv2RGy[+"mgI-#nHVC+fg]GgHg4F¼b83AQQK1,ϳuoߔMFRkُDDTm4~{iEsM5_n{l#)Hnё hk@  /qGؼ|#;tʋ>l#)HhzIPlhL,ђ9H9yVm5_鎵5CMW続jW=[-ZjW=Uxz}m4~{iEsM5_n{5[QV{UeT|mdP1a$|m h*(羊7Dcb,lS#:sAү(g" """ """ """ """ ""latexdraw-2.0.8+1.orig/help/images/bezier.jpg0000644000000000000000000001714511347255510015667 0ustar JFIFC    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( kFݕTu,ps>7Λ,\]fkr~iz^/'g^+f*px r_>Uk’Z_N\j2q]3@yE?ּn+H %_vPZ}N /is}شgO9\f6txwM^>;\>>Ox:˥7kFگb^sƯ宙/J~a[ֽǟ I[@[xv64b&ȵ˪>6BOE(Zl&jV)Pk䖷h~*[ oة+ _èk=QX!AzZUt aP3jl>*O }k|!W\OhћF]l}-Exǫ5o1Pߎ+>4:Oy-DTJjR$F |.T,5/Td-5~,((((((((((((()f8dKY ?|cf=vP>&$gXVC ~CmA~+ha͟9VMmI1]0#Fړb16Ԙ\9ѶG&(b=m1F(smI1EØm5We =jlQ9ieRyKy?Mt]_XפWk/ֲF+Y_-?#xbiuɆ?],r_5.Ч>k1L5a3^=~-hͯ]NfR_B[[B27 ?JAZ\]+Ppr>CEKnU_WYZjb227 ?JeEJM5tX*FQEQEQEQEQEQEQEQEQEU*▊_+&R-s5NqCm}'?4͝c?~M=moFռ#g}{j7"vkg6;.gR26dr)vnG&6p#FړmhsmI\9ѶF.{hRmmb=m6Ѷ16ԛhEØmjMmG&6p#Fړmhs)"tVf^i}BOCuj}m+V!Ztv/_i%#֬-Y%קooIvk8߁=- H&Iw$rB TVgN*ǚ螊((((((((($i,f9]` S Iw?J衋w&jVgے+m{w ppFAȯ !0jtHF2+5ςO-<=vw WxU|'gmn~ 6[&&œ t`z} ]DyJZJ.mInG&6p6ԛhE{hRmm mI\.G&6p6ԛhE{hRmm mI\.G&6pFXZ~m/K VS?;i  {W&3KO{}6*t'kMԭ5}> ki2:*x?H|7p;P&KMLjǭ{|z2QӞ5cV qمQXQ@Q@Q@Q@Q@Q@Q@Q@Q@Q@]_=ݼs וxAw_bݯ\Iӗ43fdf7Zntbo$>Ğ|Wl/H8xϪ#ާ]E-uk.fŵ?5~ucMy/- Z~vm <=F%>FWqkKGԏmjMmRr=m6ѶѶF.#Fړmh\mjMmr=m6ѶѶF.#Fړmh\mVfq\a^I>Zzޣ&[5'݌ya^?\]ܑOA^.eƊt;{9v[*T?R0R>e=uQ_&nVAERQEQEQEQEQEQEQEQEQEQEQEQECuuW2PD(>7#Cs,@=?θc\ƞ.]˧ۯyӶeJ4ӹ"51*{hRmmz<{mI\.G&6p6ԛhE{hRmm mI\.G&*Ky~vk&| ǠZǚ5JirSWdKM,*"cV4 ~8.ag_ʸ.=#xgXLs,c?^Q*F 0xuo :.OɡJӭ oi˦[ᛙg~d(((((((((((()"DuEK@wthVq{Q>j|SFMոE1֕ ]a[FI$z]Vj9Ϡ^W~%> LOU%~y {U4tfiom`[_#p DF`8mkܹ#6Ѷx&6p(I\.G1Rmm Tk>VmԴLpBܟX\vEӧ:傻.b]ҭn~=!ڔ[‚I$֡{i6xN6˼i_5 xWgSجDkҴoV`ck|FrޔW͟EDK&>^.tEwLО7þ |-2S摏k~֩UTw>ҍQEQEQEQEQEQEQEQEs^"<06y?@^KA8=+ǯ+xTܚs7?Psi=hМ6AkMT~f:Jw}-^٥?q׿sc8%Gk֓hbYz/Mj,jT(zw=n'ԡ~(HӴ [?vKw0kW牍B~g 2c'Q_s5 Ρ}|OQqŗVig֦6d(Q>;W2%EQ@)qRmmmsbF.#6ѶF*Mmrt=H%eJsl,XIS1TbV}nO3RWLq98Yi <#x[ecW$e#ֵO;<&Rҵm/\.IԛGJ-ᶌGo qF:,jTS1>=<_a14xoBQZߙ9NRwS k %QEIQEQEQEQEQEQEQEQEQEQEQEQEQEQExᧇ)OQ2 +u/p$g/~"J7[dGk=g^E'#$y4_ S?~x(sU\դwA*+9V-Ϊx,5?_$pjCIVs릱,81Ф*֕ԕ ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (?latexdraw-2.0.8+1.orig/help/images/launchTex.jpg0000644000000000000000000000633511347255510016341 0ustar JFIFHHExifMM*Created with The GIMPC   ")$+*($''-2@7-0=0''8L9=CEHIH+6OUNFT@GHEC !!E.'.EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE@"O!1QS"#2AUq3RVartT$%456CFbcs# A!1Qaq ?F{x'O5}eVM') Lw TkO5j7 2MB ;$c:5<Һ3 uPN䟛6g}C<^h{~Gsh8F,n8ʉ=d[N͏A/Hi+& j4?+-%ugYPӏEuZZyN%@v*5WCz<F{x'OeK~Q QP/C<F{x'E;ߣ d}݂iXe SiWWM[LUzr}e[[NY8Ny%] q&R *sJ`DޯD7>yħLL7TR (z*9ӟ%[iiӉ BrA*1>JJR Jԟ_?+\C2~V+-.◑KѰ~>3p{gn~җc`ը-t7'kdrUu\n@y9q'v0?c xZ G\8R*.WRFIK&*ZRSh%}#ey\B ŧf17 qh3Ǻ(Jtyy9# Y٤^w&kE-yՓҤt7'kjһ=t?r.7#V\AcmcOup[g))-o!8Hn>drW-.D|:A;o'g'z9\C2~V(oO%#/7čjC2~V(oO%#/7čj7'k97$8jm:,@$uE4;Uͫ7: a0*W^YI, 6;=@h>p^Îtq%VQicP8z1qq$]DKeM茗ԦAI;GE4qvj*b GLZm8ՔҌ- lNH9Ɍq;.%J@zw*էMmMrAKZVT,(QO Ga+dzЬɬn|c?aVS^ )\fִoT녽jVNu{Nj;jr3M?n:C@(8$j=uvvSgw&A sI:>vc>պiR KzN2xTy#io\d+Kn;mpP%eJ!zϳX8:WDw z4kN9ϷWݏm9/]M7n)brի:=u+'ۨa:ݎv8Ս̵#cۥ9;)𽸻Kq%e$kOX<$G@Q綆ꈒX`BXyq)҆aXC@(G&*ֻo-D[aWn | 9&1gݎL٪R<RK)7M g4&s8RU AGSG[%*/-O4$ǀ{eHOlŅ.$o.Q+P)AQ4pN,v /vr֕`d1io-;[= *[{p>qq:s!+#ZYE|k`ۑ515Y/J@! coywe6}l1tҤ#d8e/)gV,\;'(yVP96h(l+K): Q *#QmYv qUC% Rx$iQ!*Y P 'IP5Z+Sv8Cԥj@Jt 1פr9 5ӗz*`OnM0&2CvZuҀm[s8cd&O~M4y ia  q.$1\H>i$6b¨m+R#Q-jpCh7ciĺzZ!)PH`SumEոvnR#R!O0*pF saΦy%!Ё#V)V2OQq\mNeo-o]Rej WB}jșzKxYaդ%K dNj?`G?\f"$"Xm/8)-,): cQZWlatexdraw-2.0.8+1.orig/help/images/foreground.png0000644000000000000000000000123211347255510016553 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<,IDAT8jA{w1A= (DI#}x/ 9(%A n򰳻f-(f/ψct%,;즸wɒ̒LQdJM#v_.#~=zjNʲ[9ֽ#y9'0vxGs5NU$_@,4MR"DJ9U֛}wDwrjH $n <q^mP-F Te#a%Zo-*I 1a!ّ(e:=:[˨0 &*Fy0MM[cР7(dQgj5_xJihi}x/֞F@[$,}8e`݉K\^@Fԉ ikm}+k#6D Yt7-;;Z\t-MwѠikEAذ[<>8 Bkޅ2IENDB`latexdraw-2.0.8+1.orig/help/images/insertP.jpg0000644000000000000000000002100311347255510016017 0ustar JFIFHHExifMM*C    ' .)10.)-,3:J>36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOS"B !1AQ"Raq2T#3BSbrC$%45s*Q!A12"aBb ?Uп4 05ȶV}7&<6)v}ptuoN'|w#Ta>! 79 kF]m{OY2I#.le rb@甭Q ߃7I&Kd {bǷ.B_͸u7#T$U`FIS愐"imoЭБ§MHm#^Ȧ3\ZCm]{ |'|yr5F,PSK9iO {F9\WRU`pl&9ZFPHIeH%q9‰0)ftS;x9˺ lˑx]e4hon=- *ZCZ2'(`fq;׍ !c4rrݩܻOGP7osԓ=I>y)CTIuS}&+=I>"@k:Syr5B}CTIuS}&'Y>C'|yr5B=CTIuS}&'Y>C'|yr5B=CTIuS}&'Y>C'|yr5B=CTIuS}&'Y>C'|yr5B=CTIuS}&'Y>C'|yr5B=CTIuS}&'Y>C'|yr5B=CTIuS}&'Y>C'|yr5B=CTIuS}&'Y>C'|yr5B=CTIuS}&'Y>C'|yr5B=CTIO:| M>m[Ld~nM,VzV$͍` ɚ f6PQU5m4)&ܻtU>Z:`hspp;[RF#994j)i&d&G5s3>İ 9-儇ipEƇT|RM#E`(eͼqm6'J Y*i c&u! VڕQz $+'|pC,pFdFmjoT,;`e;AzN _;j#ϊAG4ٚr.3 mbm@Kaayp:zTG$Gk[8#[4F/KO,bom7৞~9W5$0j6FV\u!h)(O&$2: =6^gz\o8-I@+ 2}s.]{/s_b]hH+C--MQ+#{`w UPQݳ/seya,s=m(k)[SK |NتÜZL/m} 8uW`D#6Qyq=JbathCYk/@1K[;pɨ#GI-AHڳ"$s߇bai⵩*WILA=19jat1̐qkzl2TM>(ZXp5X5(g\6:` T5QK1t 2ü|qlQ:Ybi͕].l]ځe:|A|oo-$߲^!IDZڙ;nv>-CQ(*8 YH<02YKx$F5\PC#\ݝ v5z &,[\ʹRk{o++Gl-ztX{1g K_ ]A]9ֺٜg̬ /+s&V .!JSĵoi6hTG3)H儜 \AЛkެO+k˪CSQTڪֶ&} uHgv$Xh/u_n-{W*gl2rܭ,$N{lO!;u a>2:O-Q>KE}DcK.dMoqw.WR&)v>?72cO;MXG\tpwํ9:1@1O4SIO;GO'Xw\-8%?ESŏw#?©Q xd~[YOk N{s 9<) mxM M85$|ёBݯ߉ 'zW,Yrr4#l:4w [_F=s`=`w{ט7wx5d/WYM@͗ČoG79͓\X˦T=Sf.sEL$نqƫ 9hZʘp_³zP]&S#CrI$q`7qެ; qeAkaauh"r#QB%F,GZrR]P6VFZ.ӚCSOGw9t|7ӗjM4$:xF^9,m'p\pGz{dK8fǗ(ZTe;])$-rI'P Զ8Y.˹l,#phteɛ#l9ۮlWR'9'kec= {_ @+dߓ~Oj ;x#dߓN>;x&~O6N> @+dߓ~Oj ;x.h]t!!@B!!@B!!@W"j)#.7,6111HZlteu`!{ۗ[Y?qėJn%secݳyV~ѫoü {͸ʻHXGA+uP_mzIjGu)$G-/7ُ.ܛO.Ptwr[W$GLm|ykgT VM#%cIS~*;qY#S#YUQb9ܻ [)fFp+@漸 Yv˥W=`)]KW ]AoޛO+(E{Zeq]4S3۱E[ktcg{,Z869ǰ]YmiS?K-3|*$c!Ӌ.{()T56f^ tNܷ.W]턍#P@ܽ Xjir&Gr 䔶ֲ%=D"(g~F: j{˙eiĞw&^gSfs-9V]vENq< k kŲ2Y+Zr)O"8+ SaR-/qE6cUuкm#Ą_շYA+U>F <3hm#Z׷ ئ/Vy'&"EDo05X=Rk:JjFH32WT$կ.;cؐAo;B +4TQu@D\srvC.ҥN=/}X4_ Rn$jt\UISK3˟y7ե &%S̥o)fFf+T*t0հזAJij!1O#t vSEHP+]B1g mHwYCwY! ЀB()PB T)@C ,V<9ѿ[i޶U,F-[(O>?6i0<-|5qf9_ؐ;F=E0e>J2Ex)vܧ,\ ވ9J0OP9 e{QIDF;sM:cw1T~cS㣧gouaQ^5$685=|w+,-R;'die)i)Dq$44n{0i&c|݇ k}ZeͶ. $3-ä5UN 9s,:DX^لasKiv ַS:8NHWF.OekM1w´:f#&ֹmͷOhX (S0RUWCq٧]IЫ crx]!HP B!!@B!!@B!dS˚ZXbRIR%+F[vauȧn1И(SBshMMBI $ùHubقޓѥG_zf ™e/4EXBlXA/3T)Ew;?°ق^-g|DdOh!XBlw(A%@VSP3 `8dq hϹzMCO36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"M !1AT25BQUaqr"s#346CDRSbct%&u1 ?\[BIx:KWqߘo}f>K21fIƕaVC|*ߢlN 扝0a9<3 *dQ?NO4Ly 扝0d4q`^ҬVC 扝0a9<3 *~mߟ'P=PD0hAJ!>LuoYm]K:<''&w.;D Ws#{V,y@i'^"uz UJ|p2KkD%-|K> 'O듴n8FM~t/`BM2:׈Np|}*Tei`$~t/`(Vd#GnDuq$(qLݪw `<[u5e~k1?B*V*雮Hm Mn.Ɠ%_b>`7T*%xHԵ$VVNTBKA^s,v$>fIO5-^ x=p;iHOkr {_mo.|x&8,5 BmڻP(u[!lt+I(#>Q=0=/a0=/am=/a0=/am=/aIRFW3IZN´dF#w%O ̀kmNmNKG>A`T'LܔM*J=MY?>w${%|JOj*{E6wͬV(@\} =A,)Ht8YOA}`ݪw c)P7=Leũ*b!֪xpqْQt"}֟H *z^$ w5X*)Rd]y>KNJ#+QQ1nRhSq],gtH}Z󟤙!^J/&7H&7H @sE5+3o7mڻP&8,5 BTDŁ!KE~Q¨CRS.F5MY!pGAΐ/ms/ UNѪ(qBmTaS3",C}j +/%JmV0MkɔޗI'PUj8 (D("DcՕeYm"*ԙíbUda5*Ubğ) tn"+6`ԙb4ONNhۇ cRϔ)XVJ]zHYThZsQmI6bFg +  GiRgqim%IX"!MoƑHMoƐ߿( )*٤yr*܂mڻP&8,5 BTDŁiS%ņ䢎 !I#"R )p@G`k^uyX 9n0az0M5`̯u)tYJKmfՊ}3}2lxb#_վⳬٵ8]˗36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO}s"@ !1"AQaq2#5BTs$346UtV+ !Q1Aa23Rq" ?S)mWB*(JҘm0&fz_\0 Jj6jhi٪--EԴnbM8GU;GfS#i%/#0 af,["fM$jc<]%@*4Qg޼?`sz=F6nF/481U.HT*)uDޯ6nF/41E. QT)$IIV0FHl1ci6nAX̭kc_T;ryh6e;nNC*73s~MuWدpue@ViP`=¾j{ѢG J\$wF,zSdVLfH'Y kx/>Iʐ6uOG˶BgVdHLk3l-q D8Ґ 5>HJAaJydq8e0p##Cy㴾ʊB^lR0 Gqq 3h-0@-elrZ|&;coikyH$ZSL;fJR1Z񄛾m퍿q,$ ].V]HK-/>U% cCnq!A%9j|qOG˶BgVdHLk3a)l(- H#7 56\Y)I)lo"njCLZ&L8 wd_%TRd9<>٩dRnTyFeoaczQik!R!)tD~vq));o~%I0V9Rf5΢I^ExH3p`~+ۃhp`9C꯱_~+lC꯱_^29(t#|+]]=b9gi:{- %ɍSO}u i+qrZ`KMDE̊i7)0{Tӛ tj҇xpL߬r ^ NE!:ɒ|=d֑ yHDMm\TW+H,c ~с[zP@2$L/~9燺Jyn !<=9n/MiJs8 Ђ$:ͳ6\I/kO rq)Ƹ 4H-6xP]-ㄛ;coք7 -)riK[\JE]ZobUjf48YV+NyjR *WfMiAC<7t7WA&awGwk NdI=x^0?nrS$k@̉9lhA`^׎fѲҡ ڂ@ @O,Dwtm/riK[\JE4lz;|`c0L*t:v0ߝ}Zmcpqݮ*+X1hF++wށU92):A aLC_ P+{(ZNVʀQm|N.bCle$XHJIo:!B32St&5m~ԓl .NИSfÏS PZA94:Gn;W(}E^Lj{ۮر<БoӃrj, }+`A 06jY[-Q|@A9si}L AbI"}n A_m>}c!)&l#Y/x j(PPW7_zs$(t[8GYwep_h0` W7U} Q/uh$ԘqC [W8W㺴l|V¾j{ѪZJ2))Q~"O3 Tf]df=`J>Q@Q0K~ʘ&x:;Ix?&H oZD"mwi)LNVZ >c\ qG@E}zn8Jyn !<=9n/MiJs8 Ђ$:ͷƛo#eKtA':O,u2-Mm.mMN^Ubۭa(M* M$@W~Kx&5?$:ko`ibMqypdx\egcC//cB8Bcccccccccccccccccccccccccccccccccccccccccccccccccc"G !1A2QSUqs"45Ta#3BRr6CDbt$c%1!A ?.h;ԷdiȼX[B0.4 Y5IM7^KGV7kƶo4ڮAM-f)onB4ڙ]FT3ɦ7S&nEai۵2;vAK-7Auri}4AZ;vW_ѧn3X}#t GRYH#|npFai۵2;vA&ݳMEग़j:]FV׆y}R5L=nf7^2io}4AZ -.ÜeḫNݩ[M78z+ӷjeuvL?+ǒG"*ˏt۔*wR8XU'x7){0Ph¹PDSRrqwdž/iv8o ]Az(8o ]NFj^|?C{[?pYN c𾑥څ|:*JvSc ͐Yri>KSG_RETY!,6/iv8k ]Aƽppy{\=G*Ɠb~\!%?IE} !npPs8zU'x(X6h&ܺ\Su}|R6h+ 4R~kYR" 6-?3]EX=5V%n wO 5 9'ı rPG?WQYRITB7O>ClէR"MoxÌ{Z=ӜI<+N1A舂*s/H}aV#_+{nrSRpGy  ^+ɫc$=pEu.yV&&A&&A&3!vb]-|=Q7s1Bds1Bڈ94drzë\\u<ά]?+hY_XFf!AKyV2 |M@w2h<ŷ]_ba~kYRbPRSUU3aza^0Uʔ\J/ZQIE?+ǒG"Wu©Gu))k ԤE/fW*@9W6\aÇB遱ͣo[{Â+|lVhn{szg63t|Nf7<,82jIaK!](a18,`=b pA? ENFWqھJZ{p6 \`h´$ k)qࢁZFo ~-A8)2!/w{}ʊ[,,2WJ mzߣ.V# j+}+!׭ޥTu|L n`ֽzd@|QG m&664X5{j^68F "h2 N6H/Lhh2 AR)xF QPR7"\#/xF "h2 N6H/Lhh2 AR)xF /LhT^68F (1$ ozd@Ī)j"h x9,X(Xjàz¦Xı@2QDDy.'P%t=m!"յn߃'-rqϏ?i\'SH.j[PjR#55 KD"kڂ"(ruIa'<-er眈c1.#$bAȍQ̭m3gNHdM!A3Qha=syXPW>2o ): pe[W? $ș~/]Sz:9=N1#%FEՊZ['PN]?_"i_RkDՊE*B-psJr~ 眛>5N=B.-~~t_ܭFP_rn>M*DD'l+Q 6hJVq^&py(ot9Gt~~E ʗפ7w~Hח[6?PɁ/hLc&7?eD̥K6oI%m|Uni[NO|uO7 wx] |Np yWx{G'^ߕjɡn~_?Ay7eFsZi)r_1 [vttSIKrS6D}q;DDB7m"Y?|; \eu6HNNFŸ9q~fwQcU}ZhT1mMN]ss't[;q[jm-GrSB:[jM*\E"Ҋ2!pbA&I9J0Q5_ 5* uL9 گ!攵4U?jHŅ 9Mn:rk?ƥ/6|:X|YVaJ"s[ym"ݰk_NDTx");snW=:}m૟{5bDTPX'8U㚔,뷅Z^UDqό+5tn׭tef\t OA 2/ϾC]_t8WѼA2[蟨_йT;uO,>;CԵ`]^/*IsDJzOV^>+=iXas^Z1ӚUٙlmSFD3~>kMkD$1*ĉVD$BAA9:::;;d2b97}.Ts W(X1rF7B:5jۗH$jM#zQ92^7[C~DDTWKXZDGͬoO+YPٍcR[yo7""ʿ\ݱ{}nK󩿤N5lUƆYj  x QFDTr0~sm?aт^>=~8K4r[oܭsޙn|B]rV }Sazo{bsW{kC ST9U-"riԂ Wz߽Q,su9`)&ouikos_jo{ Z*?e_/puu}F! 6\t),,lnnnƧYcC.sﺬH.B柋ܤ " {$e;w8pElL&A!T{vCw }PON9^V)3됷ceRDxQݒ0љvz9\=[ջ<3KBDEyvX0kEFΤ7ѺљM\[H;!(kZUND-2Q|.5%<.-X~ |7M?D&=F2/'LI'W:*] }Z)-483uWA]yF19SkDBu%Ƒ)j*]B[ˉ"9wu{1ҁTZ{s7#Xxvٌf!Q/trwK1$];e<[ xzwhZ5'"R/qpqpRh=#_(r\X=Oi4UBLEK?3UtQra!KOz$k<PYaxSA"S:Vd#7_:H]1G_UNvq.FDܩXlMѫE&Co.|fJ~fxݣX[khMkO7~hv6ֈH%"H`$pLw qQ6le˖|WW{5hЀ12\NLڑ W(]0eT"mи_0w)B8.:-}Ń p!87{gCn>

ruMxXt}4ĝ&:e5JF{oc&-r^Uq!jB]sWd;w^.LU~ALFLD2A"mA5'^wZ:kлNc`e~S}[N|MC8h m;yto`ڈ,VnYNm'o,ؖeqWwxtDg,跺 !";Luoo9e/]SҳR`ܟg "k?{#[֖'OiVGqbǕb TkCg-[/0^[Ms17}6PzjV "|J2ܝ+AÈHv@әAj5F'f*!H`[l`5C99;r99sl^o8ZO55$\j@D:gQ`":\3Wl?]qЄ9jSI]KQ_:R\=׻K7\=m,:vh̤STcǓ /nvQʮ\wM}pUS5MzL Ua'& Px}}L=x}+7wn>2" ;94>; T`' 3-ftЭ?zl@YV>eL"\`D9T*UAAVe) Rٽ{ӧO0Fc2͒Uv&:.V j^t6I[Ր3cL&0 >5DJ 4oqbq}^;/""Y3niD$4i<'ӧIԷ>uZORx^KN.o X]Hnt$g1&#dAg-J "d_kO]fR !vKE"c~ wGˈ6~9\#Ρ.ۓr w{’{Z""Nީ)v[=؝5b|g / u3[Rl|LW$Jol2/o'UO`18=-^+0ׅSh-ԚҔF<{Kegy&88 0dܜO.17 ʉ,{".M D-̹''rP_RiuxAE6ws+ND}>vdlr|IC1 udd*T:SE.#-=* !||e=a\䌈Q4z;qc*3n"IFGma{29yQ=̂x9 I#ͭ l\T rł u^-T*]]]=<<>`}9ȟ,Q;Iu=ŗϗ7Keg(fDD\y'vAT7OlX?:((CNf !|SFD-FB#snnvAr gae6}YRuť+XMo$3%\pڽn\z {|\BUh5X(]&"䂇czr3=I{*6|pFCNΤ/*?e5z[8'0*va^YnrOP1J#i"P%j4gr(sRexK)௽JxQ&(!3"byեI$8?N͛y;>b ﮻]g~I(^'HAT%PPw^c T~]=v12CNDu<}fݛWkڟXJUh`BI ڌ&q+\`pSRDmEcO5im;ӱ2:8k6fቯpވ8Po]3Q_\ufX9.ȉ{h؊:#K~D/9bĖ ;6%$u?[M829s"b~q=IACVo9>97.wxՋ~Ųu lڭlN}t=????h4ﵥ2Ro4 !ι:ۤ٢G$G=F"']\,!fЊ˕3tФ=C7tӵcJ$ƮLӵE@MpΩ;y\| ?|Oo-o?٧+7R9_Cι(rW>_cէ9{cbָɛt_ǮuhXPhؖ"b,j&v*|-9!s)Ѥ/v)͜Й1Ƣ&ͤsBRV]_OٯNkң=>onJ|F8>.=<ӵ;0]m38d4&'k'ڜ/[vl JFe(*b[=2Jx.Qh6X7RY[Nȼ@D<5)hxDbb8UEǎ=n={޼m:uk$yǖ?|䩔Y{'~sIZli~Ʈ OȵQcVomAj-}ZБwHz6 {'# 5v>k&fDD4hу:uЩnZD[ބZE<[x~+ Ր,GM2p5q6o5xK: u?]^HsĵjkzQMC;H&N_֌j޴ Y)Y .Nr.p^Q %vE ֤6Wk&|cg|rvݭj]ng#}aUqa<ݰDhr6kBH"b,r¼g3}2:u>F_b:uP̮/*hFgǟպ}i67m OHc,r±G>q?=94xH3I:}:3řa^/B%Ư4ӍYyڴ6}$}bb(:YtT:x؏厽tKō/n8uWw9'f* v76,쫿جVX(B=d!R aK1VA Ԛr[}\ěۙqQ#ʣٗSԙǜ?UQ? I7}'gG m3frXdLOo}O~K{cJ]9t>gfW|LtsJi±agUFq4lMjO ܖcMSVU<Ϳ48_p@9}LQE|jӚޢ  e h7&tѶE#ysU`/;6-(8Hc1c3z.<պq)1%sEkʯ+5-ol^2b 73\IJ-lQC#aG|lH;m|(f;#?@ ϓZmymӟH___}''D^ԵF^T5rrOH[*74Oյ[פU#M/PZR]VϦv?صgwd^_[ֳZR]{1`J-[wЕ)&&'$$''Јi;OW,`XVXhYآX__]F+oT`dM*1hifeUK v 7Wvg/yq\^nnnnnnͥ^yy{CgiUnnn*}kdHvקUԄyyGTBraiиMTfKۘh#-lw߼chPIUgK$A+WEPhǓV~3uM՝&0'gƙ#WKӻ&֟\&T: fi{sK'YnaB%ufX-f3H b~f egvha--^ >-tvxbQe,Wټp(_ %$tk'.͟yrE].*okaƒۖZ0x~bv:%/u*"K1BCtsֱ*wUxij -u*`U g,ǙZ~4ۘyqq#lp.VpC뇒>~# le2t l8u}{IR ]V=Xh Fe b B[(kUgK?z/}}F]V`b@I_{ҟ WFYI1ի)V׈~$0bjcҸ뻹Woqv-tM3,lSc[h[\ߘ(U--{vbG}7~two^OjK7>s˯ YtfŰӚy3=ONܫKÕ/a7׻v5G>%r2G??58+']iB-5U 5%}|}c^%Mim]qPktMy馟49//&oի5=)յZ?UǧJZM A!jγ&޵VK y+H2'ܪx,cUm_=6Q3m6'Wmlt _{1puA};|i c& ˾Hi1]w`,pr!JdNo0mrvqȵC?XӆrCM_^8'9s&mF?~] ]C- u'榵Dݳ27xR;k&]漢 K4 -WbVbߗSC_.í—K#6dZ?/\_O!КU`--ʎBؖ6A&>X~).^؛;%\=6OfMYn'ӲM<+(^?^6Ri;ƍ3{ZLϚG[8+Ȱ9,aEM/-QW!÷oqtOŷs$sqs UQ"CkVUZJ_r% i~r?i~#Z]2Xu9P1]8=|l f2ΟӻJm'":4ƔEܖUޓKԯsk6 4?nX Z2Céu^´gy/K@XBϵ;᯽1Vh{,}8o|Sgsw|(;߃ȏgm#̠x! }K*oMʔ>sY缜5&\Ns[Y84ha+K7ŗpsqYΏ{ױ }yox)'a j,Oʟ0r9zmK}&3Mutw|wFlc>ndmm G2Mmu|Qݿ gv173ȿ />jU_KߟiL] ٜg%H9/_;fZ3ҿo#6TOLrDKZkrjs ^n1w[ 7^5kX6lu51Q zԇ֯5^2?أmgnjYN?h#JgHgq yGUg }Ե4×O/~?hz|iվY/׵>sյl9P:;C[h-ӰIJ-_2,lu5mzc͖}>~Up%=wwݥ_Dtu].wx,yVb-A]A{*ؖ'f=g(C>?kڷ=]p__M:\[{Ist9ydO?=,6-ĿLkftXOl1/YwĺٵyY`bԮ>p5uqw;MgOf5,D{֭sG>㎌jXnn`S@U3?H@? H@? }}1۷o^G H@? H@? @JG H@? H@? @JG H@? H@? @JG H@? H@? Q9?؝ɛ݌j'LPXX("zê}}ftݿ`?T*ܽ{'Q\XP\X`)7lgPy fk֬1cƽ{p]6޵kW.]ƍC =(-FӬY۷?sNNNnnn8T~@r#""3f,\(`PF#:vˎqqq...@BZV匱.][tvv *?`;PF#=zXr~% ?&T~@j4F^ziWqq1Nz@Fr] 8ZtiݕJ%J@MA4FDQlٲѣܹ3lذÇBT~@_reϞ=Ç뭷wyN: (J'''?-@4͍7+5jʔ)r<&&F̏:P[/""Yf|BxVX9wssswwwrrl *?0xਨ|ͽ{G:tHR` v1ֳg1cƴi&&&u~[֭SRREHMu BbbQn]gg焄Yf NEw}vc رcrR*+WܲeˠA}Yl>cd2q)=zDGG >Sj ʏ+1RYnݺu* }o}}f`=T~vP?l*?HGX`?#T~T~0{*?Cl*?=B{Pہ`P@=Bzrl*?U㾾`3PB f`=|l*?=BH@ H@? }}1H@? H@? H}}1H@? H@? H}}1H@? H@? H}}1H@? H@? H}}1H@? H@? H}}1H@? H@? H}}1H@? HGyZ 0 +}Pa{? vWz_?^nZ 0o߾?Xu^8> `>NMPa;g醉fg`5v߼u)ܹ%Zt@lЪm'k_tl%`'t?brtT.j5-qQbĘ ɘ?iylKy*\g?pwSS= 3::< <j5 )'%Rs_}}`sέ;,END\UԦKy[D۷G/@5ardRʍhyp]d4[| _gwbH!)g^u}Tr1^y_ʇ|V Y3SwO`f5s.)Srq"UWҰI)ZDٲW84`lQnՖBV #"jBg✋lph`p&/Lj<%%e4=`rJĔICD[H۳u1Q1Cm[:vBS?lsVm)1ޘMM Z9(d[g3.5)E'_3FTZ.q1u˒=DdQYTMq:1s+J9q(28? ՗us|g"i~R%6[yEߙ3:j:E>nY-ApeqYҨRN5bcT%ޤРDbDĹV*QӾKtH7)i_DÔ ]#ZDl%$%߭l+=߱rļ)/YSWOaq'k|?+[=$=nִrѩ{\9ȅSEI~^@8N-~f#]EQY90>/R&67LN]G:4✋bZRiDâ,Kz)nٿ!=wt]#zK7Ѹr D}rlڗZ#E2i1HMkrӍn[ϚB٥ֲ8o(D-nZ0FDq :jq?ү 'F-sݰmd,n闾-=Z˶o5^YH'3CN9>KvpCP~*.ŧOKѵLDtɢMSvm 픮s+WvQ 0";j^?Lw_R2H'A8>9}.1,3l:w#K9yFfO@ɞRs[Zg?2ܡS=)O="GjJƼ-1ou@Mg^UjqQd2I&W<P(ؕ+WJJJJJJ?.}>yAT:lƻ|LDJ#~Z.))QT`c^8cǎ BP(ճiIENDB`latexdraw-2.0.8+1.orig/help/images/line.jpg0000644000000000000000000000372311347255510015333 0ustar JFIFHHExifMM*1Created with The GIMP for the LaTeXDraw projectC    ' .)10.)-,3:J>36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOEy"4!1AQ"2BTqRr#)!1AQRa"2ѱ ?DD!DDBa|I$q0GI;(ъjA=.qk+]n̒oO/E_!{(RM"Sa鏧duLTWlb{:y2V+\Q1O'he+iہz"IdiݮY[Uhe;.DEDD!DZVur1=M\<Ba_sLUwᅝv 7i;N^n&Bco F^-H(R\kqouMee{8 auZy<[ⴏ6ZLl]nq>!wN;''zZƔʬAUr݁vWM]?TWCٳ.,7aCsS9mK9"""!jmY)]GN~UR7b `ftjs8:CF:rWVj(dyy0.MSܰdrIRM n\c4Gpt)0kj&mXNu26 3 6d 5Jj,K+;Wpnuqn,_Je6 7~mM|RCsuxH/qrճ=k25-?kx4Jy;`4<9#@*y'6=HH>r[LUM\9V /l=[]/s]>u2TC9n-VzLsq8F.}Tv3-@5U2 ؒ ύ}Sóxrkɜ32xeuX/7Ș;XʤͱV)wla{({Nٞw}gpw)O\u(}7r=.qdntdk#hJ5.(]Bv/q0m/-'WS1TĻGM 9dů{Vg;;3ҳZ>MߨR)>8`Q^w .lSݡ#XkB >c<2tp;Jb(/;ionۑЮvkQdly6zȃijlU֎Ur'%k2A# oFt1z8#J=oRs$>dBe>܇vܕݔ+1}Oc"P;gU[}7 Foմ&̌'ttZ,c47]~ eD"3ǝlOvܭ%h*MYA*_W/Ԭ{Ь8y<Āٹ;cov t "*̾ =zԞDǸ4>@@"~I>&=s_O/zqUI[%f'h IO su:9D/87k* ?"r:JlP\nLae"H9%8DDlatexdraw-2.0.8+1.orig/help/images/AutoBorders.png0000644000000000000000000000142011347255510016631 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8_ha?a Bb p3$!-V]%;ʟW? rD&IS9؜_Y{|}}$Q(|$PRXh8p@3t$y ;?Bk0S@,܁yX=}ZU<Š VIĀ%p"~vBI+J«ow_ `fGq"p3,=~xʆ-3 eZvM!2s_j0b"IAr8#gv|-!ZD{7 fбQ2H :TH`Y=tpEm\W5i;@P :R@ @ʃSfo/*@M 6n{ B@H|W`nORmzקk1a <}33P>:~` ϛ],ouZCL9\Au6 z<{p^R{LI>*K_\0dě'wI'5vK5=ƌtw1Q^YB]wZ+:| =91RDyKܤ  *=N'2N ̚{l 8FK±^k-?&W18 *?ٗGIENDB`latexdraw-2.0.8+1.orig/help/images/akinPoints.jpg0000644000000000000000000001317211347255510016522 0ustar JFIFC    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?( ( ( ( ( (*Hʡ.R<=V$H^FUQԱ|8iJt6x n==yj֚U$zlR?c{0\&UFTZiiΐZW?桪'em>Kvi'bF׶|T<{7AUyP_aҭ.y"3FUd>WǞ wuj $KE+y⾷ԣ}+Fѷui@& ?%R;|Cg##|}eūou!-|o-Tےqހ7诞|{[|WupGmg)d,e`p{ o5:jO71Nr؂ vQEQEQEQEQEQQTV=` )"!Tf_o;Tdexv+O_Q7/ -,hoRk~jږMO1@*9k'T62m'u=Cž [Lﺷi35OXZIVx%} c : BӼ7æivX ԓܓ֕y_3x JkMB QGA]ΩiՓYVp[&9W#>v<5rGӠG9o-yo<բ(&a-cl+fh63V}FG]𕖑Ockip/̡QUH`1_rؤ9>қ{X{ ).>iv5Jle(4EVVM'۵n}Mjׄ~:~^k [$'bsqPgƾ|R>~?u*ySş;mVy8+!pz^m>sV*^ aݢ,਑(/Ӽ1AiVЎ2rX$&( ( ( *l(#i*_8^~z=f4|x?}+EgZe"ePzg?XI'[+kL%#}Ey?²\o&GA'.#.g E,sF$e9@Q@Q@Q@^4ԼċcԟOd~5񕎁kQi7?n2UAV_lzU f-q'#`~f9"f*ƪ㚞ĐJ CgtqnrI㌴j~M͜(d021Wi˧c]N!ezE][E=ȡAEK\kx/J}ż `>PEPEPYVU‚Яh}O9Ym }s({[/zTiuѳDᕁ#":oMm[4|鎇zm\t9#{R}G-,I7'xZmZ;tpfus댌 (whIۙwW1kToGkp 9 F\r+ dI%RL$g3ESmi,#'ZtQEQEQEQEU[{ A 6)Uq^OlH>|OZkqVپn21.sЎP6ZBC1/ U@*Zc,X[2VqHPE1eȥP"@Q@xgio|A-֓A1̬^<@q^HK1$O<=koe6ՏROֽ|׭кQZ&V9Pu95^ ^*Ŏ f5qBs΀6(+#:>ԵX$U= רm5POP6"~56!X}=kKvԥiU$Fj@RW+#U>`?j r II41\@UцC@xw폊m//\!o7'G|q3<(0A#޹=/ᇃ}\jZ4It 1eC8EPH@e eHbye`f'S@ Β][7W :Y V2&O cV,ZqQ__izMgk$s iq97uKVu -:9&b?z;}b,mi6ybJ42K#nvPGExW.4}'sڧJGjע((((HFHꈣ,pkGּl/6HB+ /_y}|x¡O_vΞ_n}cci֖'0B[Wh ( ( ( ( ( ( (<'ҵ[m&9%ܲsПU~Ϻf|o-QKv쓹+F־tYe<FAC6"A(G(3~%)\mdvw5^iȗj fMw<7e.Ic+;ۧ, ki=VO,!MFz( +w/uxbO Mp ߆7x>z/,RKvT*97koy Ku H~0^-UEEZzh|xψ&t3l'ء+|_iyRt ^>,Դ/"S++$䃞@i;jV~L4vu>:F#ɧi'haU'߆~ oQtYn;'x+(((((((((( oEs1y B==3пgGףgEn9y+(*v +>xRZk]l6P+h VVuV,V Hz*QEQEQElatexdraw-2.0.8+1.orig/help/images/rotateB.jpg0000644000000000000000000001613711347255510016007 0ustar JFIFHHExifMM*Created with The GIMPC   ")$+*($''-2@7-0=0''8L9=CEHIH+6OUNFT@GHEC !!E.'.EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"P   !"1AQTa#2SUbqs456BRt$%&Cr3DE"!1A"aq ?pmku;[Y$FF5~JM@1pc9wJbWPKYDc#\-U.7s~o\&]>GZw<`T[c7x9iUi{~o[=JiqD]˛¾ϱ E9Cw#v#kw_vu^+l+vc.n{ >X* sPt|n|SK7s`حq4.Lea_gPv;J~oy{lԮ&Eۉ+`T[c7x9iA󵻯P2xü[=JiqD]˛±}Ihp!d=ۯSkdwjkw_4{es$;i#q[gPv;JM;[/|󵻯\6+g\M=(ssW2T(n$sҌt|n|SK7s`حq4.LeaQ[bVe8^=IwXdGPɢy\ lU 5v[U e ͼ -u, %7XMG &RDr1rp+]U 5sZڨ[(iXi(\RȜ[΃mOD5Z" 9ԋ~ @88Q-v7P>R\Lhlxy淧Ss՟! L>iрqڤ@$^;/b"+6pg85;UT$ :C3I$l@DDD@DDD@DDD@DDy?ĩj%=wA[?YV%][?YV$DADcK-T5M-7PlX$?XZmL:6$s35Ozr{TICvZNVV|dxI2nQB}LDEb[#[c.Lj7tDChfi=ޣح]S/'-D~^O(9 g*ī g*Ā1(! iv>QTF-0 M6)F$tQQ^S-8ㄓ~;Vpnkzu7?[Y $E 1l}mku3Hʪw}m wzb """ """ """ ""vO]Ty?Ġl--" W|d1QER̶֖L,F [-6WPst9Cp}M@nIr35Ozr{TICv'E 0m2p kϬv*WUELw^VDVDEKzo%#`?al`=eXw`?al`=eX2E#!.ԵP6*H@e!7ewJ8&Dx;o.)3MyxֻS՟!L~i`k?Wq &3wt'ŋXPEbYIF͸҈:N sV*ڪw}m wzb#ff}""" """ (WKžJjnuqSEdvz'hȭzq]{d9BG:gبKw;YFc9>_/Gڰ%mg8ګv6p?WAQG&}=2F[ K mՎd/pcp*o%dvZ6[k-Oq|pO &zg{8) v~zʱ vr)!g3qV%μmCMsv~#akAX WI-gs(wsj&}[ dP""O(,gnTx';K|^*᪊ f-%y){ {{O{{O){'mBoGꗴ'ꗴ.mBoy){ {{O{{O){'mBoGꗴ'ꗴ.mBoy){ {{O4+ଫ 03@?R){*un ku$cc9v~9B'|{笾]O YRI%?7|QK|_6KܷVWPst9CF5~JM@1pc9wJ oN }>B2A<$ }7(>"''*͞Wm ,^;KSad͉4H j" """ ""YI}ԵQ cB2<$7(hFI3Lg9^4'3~7ze7}~w*mvꃈ2;Ӂ:k뿛++[ @CN ǶF59i!x/|3J277hYYW$-.xO?[ڏ9t " ""c875:-dܣLָ Pp&7H$qݹE ߦq޴U0>dH4-~7zel<;i(Ot|Q.k qʯ69f{d`rCF3ȿI",c\+jn1qIfZZE$y}>֊K}u%}<ƍ50b7TYFV+;- f|y|m0,Z%?.ur\AԱ6Jybx.==N[L\.4 osӸ4VtQogrEmGz+DDZ9k3R?0'1T5.IU_t p۩1U\[N qwfPh6ʶR'沖|f)ߏ>^Olxmf+/犒xHÎ̚&xiAVktzA{mqle] C mkSӸ%'{Լ|}D/r}/ɴs :ΖDCy73Lt[ݝQDb 8DC-2՚i>qZ1_Ξo>hOh&C_]-Six6Vao9<*SZͼYM'M|}ח6Ү[Wv\\ qܝFwZj(0s76wrL#?'qzelSɚ&x^>jxieN j_K\y#Bq4^ɴDx~L6CشM'M|}יlk540oh/R^uhx^Kq|}D/r}%D/r}7ܟmmDM'M|}AH(p{Fc`n *;#Uf>TvG'uʎφ r?a}D&Gd~|7\_Q9ɨy׺- p!u<^Z}%9Tj9)hd^ymS۪#ag!WܾT5Kocl]7&wg׉Iؽn-WMP a' `{~\]]OS[<#֒4t+*M}]_P$|pG*UTS,:&!b9uK٪=~i䦔>gsm %vp?udsd6wŭq䮪Z)I{˵G7~H']eHJȘ&"\㌰Ry-uCiV\#`LGQ j_s*)($IӍ pܢl(t}\<ga<}  ɞY<#.#G2M{Ї[=KU4MQ3_ ppsm6>f-ԵT:Z;F \y7 T Jk8<4 Zcz]r^Vt 9۫__/n\+nح*F)<˺>ϢFiXu;DE?latexdraw-2.0.8+1.orig/help/images/drawProp.jpg0000644000000000000000000001744411347255510016207 0ustar JFIFHHExifMM*1Created with The GIMP for the LaTeXDraw projectC    ' .)10.)-,3:J>36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"F !1"AQ25RSaqr6T#3BUc$4bC/2q!3QR1Aa"Bb ?ɣ2TU6'Js>WKؖb {>붠V4pr;#+tmu=dg@[/pon[qerO"N_EApl0pp#F}TZ>7|E1] ގeўZ/JjVœ  O*ꊶxp$ VA-Tj$k:5]qs5C.R]m)nXRewNwjE5d2=[-#c8Bh3e uѺhlo *!dLh[rShpٗ3ξ/xe{pn 5MR*ۈֺA~bmMrdDM+r~TzGt~TzGt9ΙζetzʏHʏH#y#y(=wGwJwGwJ鑾pLNQpLeDGwJ|:WT {fF^Þ %9Kn;Ӓri}n\ 7 &*ME^42)inSg V7j)B:Zl|tL|Ŗk}`Wο(I$Eا{:YiN$27F/ʼZco?NFrt#I Σcr,5  ".0Uo{RҧYƚV}| $=tM$-pԟ`Wo~,EIzqY/bp`Nخ"Nj>X)' ]G O˨x؜Yc,{Np(Moݳ f 8zUSG|bɭFiɕqQv'p{52T-/P 2$eduڏbxc 5u:s&F_8IMԸyh&=raK6]_)w ٵ5-}zGg{s܍H޳ҜEWCyL{4qt8bG4J.E7(WFq6;vb:@^I+,wСT&N_+6{٬"aӟeɔ&Z\>x6Zkxu4r m̠^}w <{rs0͢$zA^/.}=3nms*ҤJL> ¿}{# [G WPlx?ah3m7]Dϻcإ3u7<-+Yc,{GL)Xl-q{=`N9$q[zk,nQViNz%‡xإCC@JjpfN06:}*lK4>)UhHlAF\֑p-pp2ՕYK. GX1ݭx?R`857$lټm*^ͯKSہaھ~:d_ p-nl:0]Hۛ \FT9Hr.-Ǘb˄TK4.lfr O* ;#l99~684M'T)sa{jy^&3ak%Tg;ˈ 6427x mրuF[E h.6Tld1xr[`̈́VK(n؀rU>h#KZcړmgb`b`D@y1#/W{{GZ'o~1iM[DX b*}<Ҳ{6 YU67BɃauVw9OSbv1āhg ߰e|>2h6@ζ C%T" "";;" {=`yz寨ܷ?tY=|ݣOXeOwoOB""ĸPw} Tj$}X529 }Ji/.-:؞{l 33'Sf1uluqм226I9 7oFEIR]#G!h <q@ "";;" {=`yz寨ܷ?tY=|ݣOXeOwoOB""ĸPw} Y c~nL\Ep5pbr}U;gAfKYr5 Z$:StqdE܂)ى#m7 HK$a ŗ{!0q@%T f-s#2Q^'lC/oѷ_!=A<̀fK귭ynCmj潡psH ȣ2H֍%⭢C^&tcI ;Z)\є[ qtmֽf=/ng}ob%{@RÍy3wİzv}UD  QDD~=yDǼ?\Mrq[zk,nVu7lb\(w}T;>dҾB-cFVQS+h~6n1 ڴoUدWF4sp}3#3Ύ sA3_Nd::RX.,6[**1H :9,N6$ *a=L]\A_[v\NwT )!N`W-FaH&p tsI&-FƇg{e\_V"dO"*r6٬-GnoWa":VXK wi[<ոd{ٝ}vnlmmOR8q-ٛ-I7ٮ+V`TK4Xߓ5ri,spm JnVM/R] LI{ Fɹ] /`ɵs9T*Y)f4~ē{-VDL[ju$浶kPIE8ܥGmOGhx׾mo^ꃱ?G̼H苘-#-{i{isnkOi8DCF{ +>1ɤ,M>ҍmQldLmwl,./c !kN׵m&Gҿo, D  QDD~=yDǼ?\Mrq[zk,nVu7lb\(w}P RnE͉],|,qЗ QgsBJ(BY( gs;t%:,qЖw8@$ZD@gGL{=`G-}GnV[zk. GZ{zz%" 8T,pg/hp*xAy/ - ־k)i7 U(fU)# |ħρ{f:ͺEl#,cS ɕsL MLkӂlmg܃j9.@$j=JS<qGTTI,l^&ۡw A+$ 6%@tA.yr/ 8FzEbLJ'IS\ 'oBArD\Y.n՜>ňʸ'Vi*J\iإ`hy1#/W{{GZ'o~1iM[DX#ktAen>#;ԺU;RQV;SϠHKYE[ϠHN>#.en>#;ԺgX. gGDnH T(Ǽ?zj=N1n\#_OԾWV* "69972I:i?VZ]$I_OԲRAy/j|^Տ/__~jJ( iLᑴǾ$6\ߔ}ڇ:r4w785|XVGg)axi{ϳ*^i'XLp[C6fIAЬ^c<;~}/4x,}ڟ) <85|X槃yğ<K?$K/$GH>?N _3ùы @xpyo{iίx>x,BknWh2_kyy՟}ڥѩB{$I_OԲRAy/j|^,j>x*LچU:Tm]B{W))IKQ@ղpj [<fMI[ic5ѺiZZ 7>Pn!50al;5܋1\9 AxQ˫k xw7|K?$I^i'Y) <>RAy/jpjOO?Rx>I_H>?O}ڜ,gstGM2@J,NĞPPx+hr!xߒE!%k$latexdraw-2.0.8+1.orig/help/images/framedBox.jpg0000644000000000000000000000611711347255510016313 0ustar JFIFHHExifMM*1Created with The GIMP for the LaTeXDraw projectC    ' .)10.)-,3:J>36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO:"E!1AQTV"a2BRUqt#r36b$45CS4!1AQRSaq"#23C ?qzI.̳z!cboMGUS7 )*qm#zhvH<ʷw59[x{UfHr5QRFG殺=94 coMNV)/.Dn ӣcԮʲO)$`FSMP.҆L>|WJλ2sɯޙ?+ZZ~\&tp+94kŏ=ƓMS!r`{@׽2~$T^[n4>Jf3 `eJ )ReGG$>gU'MnOĊ$YAM=X'֥yPLK Ml Yq]{'EN}uL^%FĉuF,14)ǩv5(>OĊޙ?(ы{O?Wv5(>OĊu(%:Q(&}Ǹ="[mNB*S(;+61OTĚ|-6nl-HXjJG *baID~M)B ;oRG&t (~`J/2ķSʧs~]B2%<ڔ:Xϗ6[@R0ɔ3+ѲTP *"~ŔtQՏHe6\ S@Q[@rcPdaM@@`2hƂi+,9T?.;*(y}P$zY)K˜mIj$1c\mˆVQjq2uFՃ3n^_ЫzZ{\9#WUℷ9 ?U/ sXS{jJHh l!BF L =\Om#KΡC ݍegნV74h5#s$)+ήyBF}i7 |Kkry '=XH3QK9vlOMTf7- \nORřbFv;}dq>5m[;c^il7*6a'ʴ*\9{E@IX&jY^qM]ޗ^Tٰ; o >U6lO BsJޗ^Tٰ; o >U6lOV)ŎWz_yTjK/*ol7*6a'ʦ)ŎWz_yTjK/*ol7*6a'ʦ)ŎWz_yTjK/*ol7*6a'ʦ)ŎWz_yUj,=2AZJf[6a'ʦ́cxIkaal`%XSPVe4p?z[!Fo4*[BrTT:w/latexdraw-2.0.8+1.orig/help/images/rectangleMenu.jpg0000644000000000000000000000173111347255510017172 0ustar JFIFHHExifMM*1Created with The GIMP for the LaTeXDraw projectC    ' .)10.)-,3:J>36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO&6"01AQq!"RaB#23S! ?1c%"ꛗA(\O/%Aj0 Ub4ws?1%fCrM6vUb@ DKe $;>lsL6usǻO0q4VV[foMզ$^đ=c$k-AN̮eVs~I&*@$|+'# -o,ZrTt[2ߤ );ޏ%B윣ѽR(A+G)pGV2V$5k+.jFEɵRw0J.VBoӆ~2fk S'cc?;,_yabbv6>X Lkut< 0latexdraw-2.0.8+1.orig/help/images/example.jpg0000644000000000000000000001746711347255510016051 0ustar JFIFHHExifMM*1Created with The GIMP for the LaTeXDraw projectC  $, !$4.763.22:ASF:=N>22HbINVX]^]8EfmeZlS[]YC**Y;2;YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY="L !1A"Qaq2#BR$34CTbrtSUc5D%s ?%ER%4KnWW4xdւHZb^;] AY<25s- m$ܓnmC7<̀#RKF͹󺺑܃Ce`lcvYflsލy໚vU>(cq(!by[!fu/e ` INk'i+u$(N繂w.@K4 ֡Xu!$X,H吋[cby[!fu/2TZ֜ϸ ] Il 6%n%,9;.!i{w V~#X:@l?`=]<5w5}Sic"~vĒodusp*DEHak5}R  #t1DrOu-!EA ^Q@cڷǰZ<.9APg0EM_m{,:YeSM)$66Gw8y(OY&w{z e̒`6  w\ޏZ&cGVL&nf)kZ&GH& F}ns޴@X  """ """ """ """ """ """ "" YzZ+;ާRk^ 踟?踟?vzi2O##`ܸ*ڂeM YO[>\R(t w8ŕ;[{EZU3K,rdUӪ$pvg(mnaz+b瘜wF "Ŭh#ЦDD@DDD@DDD@DDD@DDD@DDD@DDD@DDAq iF.N.l_*/TIVDʉҎClvAE^#K'#ܪ[VM6a~ӯJ )95i%7#l= ę(vRT5Jx X+ٱ쨿D0z橚1i2H毢 """ ""d7}aڽf%sXtUT+dfO6Џu5fs狹mͩ0nvGo T"8ߟ-, 0ցN3߃`w*ܿJNQk縷iK1Kl'uAA#+ 0eH I =U0= gpw4qM}KnE[2$6mE^#bHrǰN eI.;7\MXa_.ᩉ.sf4osZn4*Ú?IyhC6_~-7]H;Y*^gulNщ95;,$59,Z5p=m' CbM7%dpa$mr6@K $-YklE{oFi~l-A;m22 ^ڛ |UA 5C @n25uil@?ݕg$0-..ӯ¤!kGr l[}I.ruXJCMX';V]&xX_QcnR፥$S|ԂU]=$|JYveS5բԱtXgcߊ ԝwwy\.$H]QS1^D@DDD@DDD@DDDAFyjK㜱@8o(մ\F`neu9+r2G#k-**1hpNgt>*Hp$~z> 4}+Zψ>>ptsykO6RznW/-@FVI$0?s}~~ x2Hs6?!WeCtmAp,j\z_]>Ҡ1w^<j^- ̸!LXF\8_0: (<8}e*O~#u>+ށWkA9xD(:]r;4#vF~d6A$o+$i\:1N7?IR<uwV1ζ[CW:ɘGmأnZ3RnAҾrN3H׸{S%s'/2lr-{ y\:I~Ϗj8+Xxiu#njKܝ:^eR8Vk zֶkV ؞+7:F@.W­4Hex%@kI1';FBն[vLsكoBRR :IY(uck.lk\Inׂ QGnψEP쑹@sP(2G=7spZw׵)g`4sּ*#s`TMukb0fV:/=6Sl.\2[[ q&gڬ Q,k֓} Ductvr{) C,/{\w]DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DU*GFE Apu/PE d7;T;-h""" """ """ """ """ """ """ʆ>d*-fvEAq'ULTwe]Rv1BZE0_bˊ1J:&35m[a_b8fQt8n꟰t-/-Q'|UL%#\6_f7 Djo;ZǺ쮻H U~[EPicNQ zPskm?~%N%OO',fw^RV`~}'7sxY[tq䧉r7>'$Ωz@ag`GVv ߽TY4Qn=PZJxt34n^ʧ?+(4VhUV ép褷rA#RW|VQ__ qb'a%a#:Yb?Ux+2 N|Cء'J'5Q:wY} KFRD#kݙܒF֮QM?*I0M'oWz]SA< :Fv ggٍج"nHϲh_Z+5Stꘘ&F`\˴H?WBw jʺYRN*2S3WP7-rӶog3*X_T5$ x*9GuDl5{z)+k5޷n}\EOSG  ENʫ_QOI_+9ϵk Yţ|LJ4d+>\V##aG=h#91xIk< !8"lPhk 45A-o۟bЂlPFnh D@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DD71ciy/"8cƋX """ """ """ """ ˭|j/ ̵ ;컜ԊyhTp|n-!0m\A+nMrmډ1 n 1?\-iHh?;iΑ^cd {MXs|^S,Qg8OUy]UcGn[|aW ĶpcNB7y􅧾G裴L{NbHqy H{y|WOŞSaA Tцxlվ7D apc')~/g;{Y8폀9ϧzNpωوi]ckkeqDk-}lu:YxY04 9t~b8f,/7րk╙#/hii8t;By\ֵ gi{V(c&@svQYihr/4gvQє42)ha9\`4q7dp4iy-i$y@v9Dcu;j紆5s3m-;RؼkFi.mtԀ<boGa{]j)!ut$s͸oRa|L @\Bru}H**C$d@K.4w*ں,m7e՘q %(g z̕%[KAl-t`045i,)|/ϫeg iEEoUO Z\Fs Gb Np,b k;My[_7Z@h>yO7NȩA\D,{Up]` `/"f3<._˷otclA:" """ "" V$qksM32nnGY=#d\Yw,@ :/$ bCܠtil`rl޻}t\<T3arqv仪l@Z ASƼke+t!k{ݦwGFڪ6&m@Faݺo%Mݭ/J eci]4@gQ vwYBdt'6wi%%=HOB97.6n}݈;]T">}u2xi25,7ӭ{}k!tᬸnrFm=K⡐L \]7M{lIqHyk؋]{$d0=漛j5443'X9MH0FߦS(dqĐu۹{.# 2p@ ,51gfͥ3zKT;{/ן; g8laubᵿUvq 8VZ]O--(æ6 w3\f>L v@ ^1WXMΚ.dŠk˜ v~^-&1 kA>+a' {A3k}@pڍcnF9ċoR06RZDhuǹW|{`}5ob catdgZIx %cdf@M#zPvȚr>alj249k1f6|HO=R⑴4 &X޹s3hɐhE!wH@2_K`tSNR %^KG xb~)䦆Wf|aoeG)^Ur vmSᘳ8q>XZ] =ѡsˌ-. |/oy!4wD14asp9[._4߃u2H3+"hc$v8"4ZjtBs ffo V8fxq7qODA`{Xs6z e;\#nnop%DDD@DDD@DDD@DDDAlatexdraw-2.0.8+1.orig/help/images/insertC.jpg0000644000000000000000000003047711347255510016021 0ustar JFIFHHExifMM*C    ' .)10.)-,3:J>36F7,-@WAFLNRSR2>ZaZP`JQROC&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOI"K !1"2AQSTUaqBR#6cs3br$5C3 Q"q!123ARBa$4b ?M<'W#A}̻m5v w$˞?kXzE[G%h5mb% TNwz7yd[t) ăW/4'qۏ!$::hQ>rclOLW vkŅ\HӴAЃ nzo!`ule-\8Xz5{Mя*"Ig/\XXQ6 %*Oj@F])b֛-8}QQA#nMNS#9I{EHJI6kPs88ձtmRT@*Bu"F5ax[CqzYpV*+f<[2PRmհGX/Wlۼ5$H$ku_j;^Qin֌6c*@oy=ҝ"޴6‹d8n6lUn6I$s^_c=q߃[=gXJÉJ u|Wbl_1¸7+*74O`]oOX;j˶B8Q=^lI;DZ6w2D$t>kgxmm^fs>~H3f&(Aax*vG%Ɗ He!c@dhkĭU{`\V qV̋D6!%cUK{0O&2D |=1q/Zmo@ ! b$m]dE6@+Y^F!ԟed!ۖ\ yBV%3Mя(eƱh~qԴgY#C?ʯaXq;NRwAQ *'J兰[n IX(] mLJBƀPV6ҝGSh.lZrc?Kꉛxhe0ׄLVz[KƱCrq [PvkdB RDfQ$TtEq|V:'zя+ĩԒSiZ5j԰eBtPVAZ116ϥ!Y-Ć4uʋmzU+uN eN,ʔrjjS*'qS`4ZGOl j!6;81Lb[m՜p¿HRdVCR7Q ڃZJ@&f #" mYREֽѮ{8rc81)b lL}34n3OLR95ደDoyz-ɖsv)D yb oRLT]9[OLR@׋{lGLUᶻ) RLWs^']wm9oHOTF>{֪WtU1lg~XךުvoE;}.!O]LwBpTh:g~ݫow%?|\CҟM<=)ӪgN3|IoUe`KzzgyKzS駔?ޚuL3\$B'$Nsnb lL}3W<=)\CҟM:yC~3otU% = ]%-*甸?ޚyKzST(8gй=HNH~ݫ&ޤSbxi6!OSY*N{ )}!9 ˓D;'G*.~*0Hc}G>Z54OBm4Y6*JRRUۡNSlu>9NY VE$H=y`,/-H0ق[ABq(}ױKQM*Sc6J?_C ,59-ENc H1m*+X[i@XA :ꚇxNTݥ:@AVG JMI 0OTJ|Uة.:\`0n JAÕL쭐\:Je`jW0q[[+2 ӬW JгgvT $hJ3_V$eޗƒCςrr,w\D \C=y]X-ݍʳI!eQ Z[r)tl:IӤTUZU|*XRe~7Tq 16֯L@0 ̉&B[^NtAWbXHBGNd5)$娚5]u%­KA- dD9i Q]5 i#^ʮ/VlwjB$6a-YmzDdukI-U:}lLK\?`/E̊ ]j ]Sl -8ADҩx΅;2I%&fF֍a$Kt*I j[RJªbg +cX hT\Y7sleŵ$BU_2r u#S^-)\2ʔ5]//!W&X–+XR'2ۅ!(Ljn-Zin`%e!"dӴ*sa{s"wұs ƞPS֗n 50%W *:˭& }W@ͷ\ԖXnZ-H +Ks3H͖>VVXFRcgjaZ -9L1̤W I'e,N7)iH0 ]O)øf2gv̲T)t>CW)OV_iS)^ď Z2]mc2@mI0۠$f=m> U}G,aUI~MN8s-ְvJmPطmM}nK oKjV@$Φ8>jOJN_RޗwabCLtޢݷXnlRKv=*?\V+PZNz/1R>CorLG2b2#n?PўtjYzzVxA+hۚkmnmJSP5UMeҌRmHkQté+Ub7mj(nd0;G#O1]Vjnq\dRGZؑ^Y[1q-Ç`Wn l#p.;:Va.įSx{G5V?uo@g?7⍩3ej>U(7?OS]%s~*ݷ8!JRyrڶ-p8SUS:$uUtn Aއ~W5Eg-ï6#B5*iAdA:$~P VRQÔ:D%?Dm w 9pXH)4;~cx,hٌk=ekq!%jRS!(*>GS[a([qDTBI'x:mFmp s"%78z "NНb01wC|g2;4 :iQ|0##`)@H4xqG1.5Ş as3%FgB0d*AvPm ,&Jsf&7S0%-%9) u?uMr-7%ufs).@Z[awֵ02)eBҠ˸ \ *+js'Ac{ZZ!>4}~U❺Z'V#"J):sQl1:cќF杇( %R,)̩T@eAn**NbBdH"nJ8yLLL 눯_î/~8RRjw* 3=-HZNۑXmgRbFECbUՙQ7 .) i-x]/8P)w10;B Y(HG?ں)lR@:T:V OKZ6P.tw槰hR2 ki*S\ԕ%Dae *Pټ<%*B#\YmbN2;IRcӆ6IS (H< 8kqkIZ *GدxcRC̈́#:O)Xd)/ Q')P+#c%9ZgRIsU \U`6*pjuԐd;bЅY A &g}oXc4R (J yRQJLT;u(/H}JdH0bw0}@lmMͺ@!+LJZ"ńŪ}ʵV$G]A'()JeUfjz~DygST.1%E׹:"G~{;6n(P)7k BP StTK (G)PjWu]x% :JR|45W/d`W9TF}UWYyBazlW+բ ʧHTei:uŒ bTx$$[QP\ZwÙƓ:yY-Y$vX9in *."'MuӲSJp]nmd#@OOAVo0]>Ғܿ1hR%$Z*hNt\f@GK]DaoRKT[JH"&cI]si]+}i{>eZNɓ^q';eN$^t1:R*q\H }g"Sp yN,9dVՓ`miRҒII>rHy@tDBL 0Fn0:CHqHrbo4HUc1T%Un/Z[h$`0`  lj]ka/܆$)Iy#,NmGG[ S\pw%$',e059Ѝͫ "V #$HG33kpvRAq@ h9?USKcGQ|(8cdo5@H ܔ´lksF;~tlWKEN}5fPSi˟,f#X3޽unߎٶJ\̹@v_9?USGmwZNT/̕B3k0U8C1qJmI @S&Li[F;~tlWKEM[+/[YRfP[`8Tj9A$e$n|wzΖ;l7P!'E@'߬j|:@CyFP$hIם3ڷwzΖ~-N9t,nTuըVߒJPGD۴w_9?URT܍wz΢jCJ_kqlASR qFu7'DC G5b~DrA>VSZɝM)J\)JP R SE.BM0 H>@ h%ˤsBR26mL,qcAi BJxQ @d@ˌ6.QA)uivc9)kN˙Vy>ҢRRY%Rg^`MR8 JAuL2@ӳL-J IM( $jFTv: @@':cYO.^@/mP֕dqáhU`jtx6*À b4T.&oϡSQGTca=%2h Ǿq.H3mh}$BAIG+TsR:=r%19`f2zjz3]-M_Hu Jr b`@l-͸HhdV,9 :Vz]u었ʭԦc${'CBسbL%Ne%p!@H:h͛+oCqJDpB9茽{˖-ZPh8QNHA=^)帵&T) t޵XU Rq(:no5T6(Ѕ j6/nT󰖔i#"HFc@Xyقi6`#,$¦tڙwвy ZeB5;NהJ1^\\欥VFMtLzle"qo-P!'T}۾FTqKΰ?djoN@(ET E{mV3[422e$*L"۷t '8) 7w&}c$"}VkHͦ6P8@%Ek:GQYbv*|v@o)Ye֐"HPy!A23 NvҮnëjVFS HQf;qiRJH΅-%" 1)IHƧI$A)0`kƝathqմلD+Wc8Kn<`F2sé$l~s cHJI Q"df" eYbv%DK \eNכR6w؁}8ʴd6eR.mZnЬ9Ǜvs#2B CHCͨ (n=ʒ-E6"T{BT'cW9—lm29u"47tv.\n@NXʐ9LcZcism~ܛ2G)JNTiv qXrst`i&E3ipXBnG9tRNkv\-VdD$8::$Ѝ+Sygǻ3 i۹8[o1muAR3)j!6ʜM::zGS8xoi|J|4% Ӭ{'u?9hż&u4+ p)@)JP'-\ʴ|NZV`!%GAFZj+vݛ.$b%A@ ANRYV%|eHH+$$U=6| ҡ*R u :KIan-Tb$f0uA̫.LH0={uT&_JTPa$, {T7uJyGa'*1 *|S-87AcZv>\ʴ|%R)!:ґ0ўJR8bOYs*adݻO6bJΔA% zH o-( ̝`ŧa/.mj'L + lH2gD}% f<@H;LT0A \XZaeS~8MVp cL ; KJРH "KvcSKcMI0G[a%KIJNYQxeֵfI䏫=qX =}#` bҀ&KZ͸̣$Mx[Ͱ RrI( G ڷ)H6>ΪE&FR$z2[V[mB00+ @IڭRp{Br:#BwYXS:P"LoW)@Q^,m QH:#_ed.* MRA H{vPWX H 1=dꙊѐ-zʎbtIUPNDuAը]JSG2sDL٥\E-\.R$) ˠ ۦ*,-i %!)BD&@ YQ:座\.,(@JL&R$k߰Vi@R8UV %)V 4aSSAj$#`~ժP5n/:iAYdW}MP} 'u?I?'55nogSJRRšISsnaw_x!Ҿ z0V^7aR\y]\+SO5$l=ҳv0-]u+BVT'6G0 @&V2ɳ*JJf 2gTfPbI~[pR:u`Gq5;!Yg)=P R)@)JP R)@)JP R)@)JP =#頻􏾡$Χ'u?#}liJV"JRR9뫑^ |h)YE)JJRR()JJRR()JJRR()JJRT)}MP} 'u?I?'55nogSJRR?W]\#w:ҟ }]o:Vϗ23akΣ5Q ZgJÌםG)kΣt8y|Bf>!@gJÌםG)kΣt8y|Bf>!@gJÌםG)kΣt8y|Bf>!@gJÌםG)kΣt8y|Bf>!@gJÌםG)kΣt8y|Bf>!@gJÌםG)kΣt8y|Bf>!@gJÌםG)kΣt8y|Bf>!@gU}-,f>!Z ]_̛z+K;MwNdg/: G;gV4߃)m$ [ZQK/.gSJRJRR8?XnĴr %e:DvWUKhXO]OMclO*dJ*x=>jx=>j x;Y"OXGOXGQ;Ox)YOXGOXGQ;Ox)Ype#k2;I׶VeEmRHRyC5Q]\W+*V Rak3թlA*%E%ĒI>iYl|ۿs槊l|ۿsok্Mc 'l|ۿs槊l|ۿsok্Mc 'l|ۿs槊l|ۿsok্Mc 'l|ۿs{l6QVdJ@*tB fQ뫞75UZN$, e-@;zU!=>jx=>j x;QYI?x)|?X+!I?x)|?X+!cseۥ$p֬B.*0L Pu=U x/(% }` A2znoۄAօfBe&26$j:ꋌޢH-)*Vܒ1d8K0H's}oz /pKKJR*VE<'.Ԓٳj 6jcsX6ؼg*e'@ )8K)n!Ϛ)n!Ϛw75R$)n!Ϛ)n!Ϛw75R$)n!Ϛ)n!Ϛw75R'3-7ҀRʠu: ֫G۹o^aame9d Ǜ+^&u4+p)@)JP;oZ@CX }Ļҕ,X<}ĻzJRdZY]iJ_,V%}ĻҔY'ZzJRdZZzJRdZ *
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class LAxeSVGGenerator extends LShapeSVGGenerator { public LAxeSVGGenerator(Axe f) { super(f); } public LAxeSVGGenerator(SVGGElement elt) { this(elt, true); } /** * Creates axes from a latexdraw-SVG element. * @param elt The source element. * @param withTransformation If true, the SVG transformations will be applied. * @since 2.0.0 */ public LAxeSVGGenerator(SVGGElement elt, boolean withTransformation) { this(new Axe(new LaTeXDrawPoint2D(), false)); if(elt==null) throw new IllegalArgumentException(); setNumber(elt); setSVGParameters(elt); Vector values; String pref = LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'; String str; Axe axe = (Axe)getShape(); axe.setYLabelWest(Boolean.valueOf(elt.getAttribute(pref+LaTeXDrawNamespace.XML_AXE_IS_WEST)).booleanValue()); axe.setXLabelSouth(Boolean.valueOf(elt.getAttribute(pref+LaTeXDrawNamespace.XML_AXE_IS_SOUTH)).booleanValue()); axe.setShowOrigin(Boolean.valueOf(elt.getAttribute(pref+LaTeXDrawNamespace.XML_AXE_SHOW_ORIGIN)).booleanValue()); axe.setAxesStyleToken(elt.getAttribute(pref+LaTeXDrawNamespace.XML_STYLE)); axe.setTicksDisplayedToken(elt.getAttribute(pref+LaTeXDrawNamespace.XML_AXE_SHOW_TICKS)); axe.setTicksStyleToken(elt.getAttribute(pref+LaTeXDrawNamespace.XML_AXE_TICKS_STYLE)); axe.setLabelsDisplayedToken(elt.getAttribute(pref+LaTeXDrawNamespace.XML_AXE_LABELS_STYLE)); str = elt.getAttribute(pref+LaTeXDrawNamespace.XML_AXE_TICKS_SIZE); if(str!=null) try{ axe.setTicksSize(Double.valueOf(str)); } catch(NumberFormatException e) { /* */ } values = SVGPointsParser.getPoints(elt.getAttribute(pref+LaTeXDrawNamespace.XML_GRID_END)); if(values!=null && values.size()>0) { axe.setGridEndX((int)values.elementAt(0).getX()); axe.setGridEndY((int)values.elementAt(0).getY()); } values = SVGPointsParser.getPoints(elt.getAttribute(pref+LaTeXDrawNamespace.XML_GRID_START)); if(values!=null && values.size()>0) { axe.setGridStartX((int)values.elementAt(0).getX()); axe.setGridStartY((int)values.elementAt(0).getY()); } values = SVGPointsParser.getPoints(elt.getAttribute(pref+LaTeXDrawNamespace.XML_GRID_ORIGIN)); if(values!=null && values.size()>0) { axe.setOriginX((int)values.elementAt(0).getX()); axe.setOriginY((int)values.elementAt(0).getY()); } values = SVGPointsParser.getPoints(elt.getAttribute(pref+LaTeXDrawNamespace.XML_AXE_INCREMENT)); if(values!=null && values.size()>0) { axe.setIncrementX(values.elementAt(0).getX()); axe.setIncrementY(values.elementAt(0).getY()); } values = SVGPointsParser.getPoints(elt.getAttribute(pref+LaTeXDrawNamespace.XML_AXE_DIST_LABELS)); if(values!=null && values.size()>0) { axe.setDistLabelsX(values.elementAt(0).getX()); axe.setDistLabelsY(values.elementAt(0).getY()); } /* Looking for the two axe in order to get the position of the axes. */ SVGNodeList nl = elt.getChildren(SVGElements.SVG_G); int i=0, size = nl.getLength(); SVGGElement l1=null, l2=null; SVGElement element; while((l1==null || l2==null) && i0 ? 0 : minX3; maxX3 = maxX<0 ? 0 : maxX3; minY3 = minY>0 ? 0 : minY3; maxY3 = maxY<0 ? 0 : maxY3; switch(axesStyle) { case Axe.AXES_STYLE_AXES_VALUE: boolean arrowOk = (float)minX!=(float)maxX || (float)maxX!=(float)minY || (float)minY!=(float)maxY; Line xLine = new Line(new LaTeXDrawPoint2D(position.x+gridStart.x*Figure.PPC, position.getY()), new LaTeXDrawPoint2D(position.x+gridEnd.x*Figure.PPC, position.getY()), true); Line yLine = new Line(new LaTeXDrawPoint2D(position.x, position.getY()-gridEnd.getY()*Figure.PPC), new LaTeXDrawPoint2D(position.x, position.getY()-gridStart.getY()*Figure.PPC), true); xLine.setLinesColor(shape.getLinesColor()); xLine.setLineStyle(shape.getLineStyle()); xLine.setThickness((float)thickness); yLine.setLinesColor(shape.getLinesColor()); yLine.setLineStyle(shape.getLineStyle()); yLine.setThickness((float)thickness); if(!arrowHead1.getArrowStyle().equals(PSTricksConstants.NONEARROW_STYLE) && arrowOk) { String arrowStyle = arrowHead1.getArrowStyle(); lgth = arrowHead1.getArrowHeadLength(); boolean isArrow = arrowHead1.needReduceLine(); if((minX!=0 && isYLabelWest) || (maxX!=0 && !isYLabelWest) || maxY==minY) { if(isArrow && !isYLabelWest) { if(arrowStyle.equals(PSTricksConstants.RARROW_STYLE)) arrowStyle = PSTricksConstants.LARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.LARROW_STYLE)) arrowStyle = PSTricksConstants.RARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.DLARROW_STYLE)) arrowStyle = PSTricksConstants.DRARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.DRARROW_STYLE)) arrowStyle = PSTricksConstants.DLARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.RRBRACKET_STYLE)) arrowStyle = PSTricksConstants.LRBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.LRBRACKET_STYLE)) arrowStyle = PSTricksConstants.RRBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.RSBRACKET_STYLE)) arrowStyle = PSTricksConstants.LSBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.LSBRACKET_STYLE)) arrowStyle = PSTricksConstants.RSBRACKET_STYLE; } if(isArrow) if(isYLabelWest) xLine.getPt1().x-=lgth; else xLine.getPt2().x+=lgth; if(isYLabelWest) xLine.setArrow1Style(arrowStyle); else xLine.setArrow2Style(arrowStyle); } if((minY!=0 && isXLabelSouth) || (maxY!=0 && !isXLabelSouth) || maxX==minX) { arrowStyle = arrowHead1.getArrowStyle(); if(isArrow && isXLabelSouth) { if(arrowStyle.equals(PSTricksConstants.RARROW_STYLE)) arrowStyle = PSTricksConstants.LARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.LARROW_STYLE)) arrowStyle = PSTricksConstants.RARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.DLARROW_STYLE)) arrowStyle = PSTricksConstants.DRARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.DRARROW_STYLE)) arrowStyle = PSTricksConstants.DLARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.RRBRACKET_STYLE)) arrowStyle = PSTricksConstants.LRBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.LRBRACKET_STYLE)) arrowStyle = PSTricksConstants.RRBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.RSBRACKET_STYLE)) arrowStyle = PSTricksConstants.LSBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.LSBRACKET_STYLE)) arrowStyle = PSTricksConstants.RSBRACKET_STYLE; } if(isArrow) if(isXLabelSouth) yLine.getPt2().y+=lgth; else yLine.getPt1().y-=lgth; if(isXLabelSouth) yLine.setArrow2Style(arrowStyle); else yLine.setArrow1Style(arrowStyle); } } if(!arrowHead2.getArrowStyle().equals(PSTricksConstants.NONEARROW_STYLE) && arrowOk) { String arrowStyle = arrowHead2.getArrowStyle(); lgth = arrowHead2.getArrowHeadLength(); boolean isArrow = arrowHead2.needReduceLine(); if((maxY!=0 && isXLabelSouth) || (minY!=0 && !isXLabelSouth) || maxY==minY) { if(isArrow && !isXLabelSouth) { if(arrowStyle.equals(PSTricksConstants.RARROW_STYLE)) arrowStyle = PSTricksConstants.LARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.LARROW_STYLE)) arrowStyle = PSTricksConstants.RARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.DLARROW_STYLE)) arrowStyle = PSTricksConstants.DRARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.DRARROW_STYLE)) arrowStyle = PSTricksConstants.DLARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.RRBRACKET_STYLE)) arrowStyle = PSTricksConstants.LRBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.LRBRACKET_STYLE)) arrowStyle = PSTricksConstants.RRBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.RSBRACKET_STYLE)) arrowStyle = PSTricksConstants.LSBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.LSBRACKET_STYLE)) arrowStyle = PSTricksConstants.RSBRACKET_STYLE; } if(maxY==minY && minY==0) { if(isArrow) if(maxX>0) xLine.getPt1().y-=lgth; else xLine.getPt2().y+=lgth; if(maxX>0) xLine.setArrow1Style(arrowStyle); else xLine.setArrow2Style(arrowStyle); } else { if(isArrow) if(isXLabelSouth) yLine.getPt1().y-=lgth; else yLine.getPt2().y+=lgth; if(isXLabelSouth) yLine.setArrow1Style(arrowStyle); else yLine.setArrow2Style(arrowStyle); } } if((maxX!=0 && isYLabelWest) || (minX!=0 && !isYLabelWest) || maxX==minX) { arrowStyle = arrowHead2.getArrowStyle(); if(isArrow && isYLabelWest) { if(arrowStyle.equals(PSTricksConstants.RARROW_STYLE)) arrowStyle = PSTricksConstants.LARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.LARROW_STYLE)) arrowStyle = PSTricksConstants.RARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.DLARROW_STYLE)) arrowStyle = PSTricksConstants.DRARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.DRARROW_STYLE)) arrowStyle = PSTricksConstants.DLARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.RRBRACKET_STYLE)) arrowStyle = PSTricksConstants.LRBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.LRBRACKET_STYLE)) arrowStyle = PSTricksConstants.RRBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.RSBRACKET_STYLE)) arrowStyle = PSTricksConstants.LSBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.LSBRACKET_STYLE)) arrowStyle = PSTricksConstants.RSBRACKET_STYLE; } if(maxX==minX && minX==0) { if(isArrow) if(maxY>0) yLine.getPt2().x+=lgth; else xLine.getPt1().x-=lgth; if(maxY>0) yLine.setArrow2Style(arrowStyle); else yLine.setArrow1Style(arrowStyle); } else { if(isArrow) if(isYLabelWest) xLine.getPt2().x+=lgth; else xLine.getPt1().x-=lgth; if(isYLabelWest) xLine.setArrow2Style(arrowStyle); else xLine.setArrow1Style(arrowStyle); } } } elt.appendChild(new LLineSVGGenerator(xLine).toSVG(document)); elt.appendChild(new LLineSVGGenerator(yLine).toSVG(document)); break; case Axe.AXES_STYLE_FRAME_VALUE: if(gridEnd.x>0 || gridEnd.y>0) { double xMax = position.x+gridEnd.x*Figure.PPC; double yMax = position.y-gridEnd.y*Figure.PPC; LaTeXDrawRectangle r = new LaTeXDrawRectangle( new LaTeXDrawPoint2D(position.x, gridEnd.y>0?yMax:position.y), new LaTeXDrawPoint2D(gridEnd.x>0?xMax:position.x, position.y), false); r.setBordersPosition(PSTricksConstants.BORDERS_MIDDLE); r.setLinesColor(shape.getLinesColor()); r.setLineStyle(shape.getLineStyle()); r.setThickness((float)thickness); elt.appendChild(new LRectangleSVGGenerator(r).toSVG(document)); } break; } double endX = distLabelsX!=0. ? maxX3 : maxX3/increment.x; double endY = distLabelsY!=0. ? maxY3 : maxY3/increment.getY(); double startX = distLabelsX!=0. ? minX3 : minX3/increment.x; double startY = distLabelsY!=0. ? minY3 : minY3/increment.getY(); if(ticksDisplayed!=Axe.LABELS_DISPLAYED_NON_VALUE)// We draw the ticks { if(ticksStyle==Axe.TICKS_STYLE_FULL_VALUE || (ticksStyle==Axe.TICKS_STYLE_TOP_VALUE && maxY>0) || (ticksStyle==Axe.TICKS_STYLE_BOTTOM_VALUE && maxY<=0)) if(ticksDisplayed==Axe.LABELS_DISPLAYED_X_VALUE || ticksDisplayed==Axe.LABELS_DISPLAYED_ALL_VALUE) { SVGElement ticksX = new SVGGElement(document); Line l = new Line(false); l.setThickness((float)thickness); l.setLinesColor(shape.getLinesColor()); for(j=1; j<=endX; j++) try{ ticksX.appendChild(new SVGLineElement(position.x+j*gapX*increment.x, position.y, position.x+j*gapX*increment.x, position.y-ticksSize-thickness/2., document)); } catch(MalformedSVGDocument e) { /* */ } for(j=-1; j>=startX; j--) try{ ticksX.appendChild(new SVGLineElement(position.x+j*gapX*increment.x, position.y, position.x+j*gapX*increment.x, position.y-ticksSize-thickness/2., document)); } catch(MalformedSVGDocument e) { /* */ } elt.appendChild(ticksX); } if(ticksStyle==Axe.TICKS_STYLE_FULL_VALUE || (ticksStyle==Axe.TICKS_STYLE_TOP_VALUE && maxX>0) || (ticksStyle==Axe.TICKS_STYLE_BOTTOM_VALUE && maxX<=0)) if(ticksDisplayed==Axe.LABELS_DISPLAYED_Y_VALUE || ticksDisplayed==Axe.LABELS_DISPLAYED_ALL_VALUE) { SVGElement ticksY = new SVGGElement(document); for(j=1; j<=endY; j++) try{ ticksY.appendChild(new SVGLineElement(position.x, position.y-j*gapY*increment.getY(), position.x+ticksSize+thickness/2., position.y-j*gapY*increment.getY(), document)); } catch(MalformedSVGDocument e) { /* */ } for(j=-1; j>=startY; j--) try{ ticksY.appendChild(new SVGLineElement(position.x, position.y-j*gapY*increment.getY(), position.x+ticksSize+thickness/2., position.y-j*gapY*increment.getY(), document)); } catch(MalformedSVGDocument e) { /* */ } elt.appendChild(ticksY); } if(ticksStyle==Axe.TICKS_STYLE_FULL_VALUE || (ticksStyle==Axe.TICKS_STYLE_BOTTOM_VALUE && maxY>0) || (ticksStyle==Axe.TICKS_STYLE_TOP_VALUE && maxY<=0)) if(ticksDisplayed==Axe.LABELS_DISPLAYED_X_VALUE || ticksDisplayed==Axe.LABELS_DISPLAYED_ALL_VALUE) { SVGElement ticksX = new SVGGElement(document); for(j=1; j<=endX; j++) try{ ticksX.appendChild(new SVGLineElement(position.x+j*gapX*increment.x, position.y, position.x+j*gapX*increment.x, position.y+ticksSize+thickness/2., document)); } catch(MalformedSVGDocument e) { /* */ } for(j=-1; j>=startX; j--) try{ ticksX.appendChild(new SVGLineElement(position.x+j*gapX*increment.x, position.y, position.x+j*gapX*increment.x, position.y+ticksSize+thickness/2., document)); } catch(MalformedSVGDocument e) { /* */ } elt.appendChild(ticksX); } if(ticksStyle==Axe.TICKS_STYLE_FULL_VALUE || (ticksStyle==Axe.TICKS_STYLE_BOTTOM_VALUE && maxX>0) || (ticksStyle==Axe.TICKS_STYLE_TOP_VALUE && maxX<=0)) if(ticksDisplayed==Axe.LABELS_DISPLAYED_Y_VALUE || ticksDisplayed==Axe.LABELS_DISPLAYED_ALL_VALUE) { SVGElement ticksY = new SVGGElement(document); for(j=1; j<=endY; j++) try{ ticksY.appendChild(new SVGLineElement(position.x, position.y-j*gapY*increment.getY(), position.x-ticksSize-thickness/2., position.y-j*gapY*increment.getY(), document)); } catch(MalformedSVGDocument e) { /* */ } for(j=-1; j>=startY; j--) try{ ticksY.appendChild(new SVGLineElement(position.x, position.y-j*gapY*increment.getY(), position.x-ticksSize-thickness/2., position.y-j*gapY*increment.getY(), document)); } catch(MalformedSVGDocument e) { /* */ } elt.appendChild(ticksY); } } if(labelsDisplayed==Axe.LABELS_DISPLAYED_ALL_VALUE || labelsDisplayed==Axe.LABELS_DISPLAYED_X_VALUE) {// We show the labels on the X-axe. float height = fontMetrics.getAscent(); double gap = ((ticksDisplayed==Axe.LABELS_DISPLAYED_ALL_VALUE|| ticksDisplayed==Axe.LABELS_DISPLAYED_X_VALUE)&& ((isXLabelSouth && (ticksStyle==Axe.TICKS_STYLE_BOTTOM_VALUE || ticksStyle==Axe.TICKS_STYLE_FULL_VALUE)) || (!isXLabelSouth && (ticksStyle==Axe.TICKS_STYLE_TOP_VALUE || ticksStyle==Axe.TICKS_STYLE_FULL_VALUE)))? ticksSize:0)+thickness/2.+Axe.GAP_LABEL; double sep = maxY<=0 || !isXLabelSouth? -gap-Axe.GAP_LABEL : gap+height; String str; if(((isXLabelSouth && gridStart.y>=0) || (!isXLabelSouth && gridEnd.y<=0)) && (gridStart.x!=gridEnd.x || gridStart.x!=0) && gridStart.y<=0 && showOrigin) { SVGElement text = new SVGTextElement(document); text.setAttribute(SVGAttributes.SVG_FONT_SIZE, String.valueOf(font.getSize())); text.setAttribute(SVGAttributes.SVG_STROKE_WIDTH, "1");//$NON-NLS-1$ text.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.CSS_BLACK_NAME); text.setAttribute(SVGAttributes.SVG_X, String.valueOf((int)(position.x-fontMetrics.stringWidth(String.valueOf((int)origin.x))/2.))); text.setAttribute(SVGAttributes.SVG_Y, String.valueOf((int)(position.y+sep))); text.setTextContent(String.valueOf((int)origin.x)); elt.appendChild(text); } SVGElement texts = new SVGGElement(document); texts.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.CSS_BLACK_NAME); texts.setAttribute(SVGAttributes.SVG_STROKE_WIDTH, "1");//$NON-NLS-1$ texts.setAttribute(SVGAttributes.SVG_FONT_SIZE, String.valueOf(font.getSize())); SVGElement text; for(i=increment.x, j=1; j<=endX; i+=increment.x, j++) { text = new SVGTextElement(document); str = (((int)increment.x)==increment.x?String.valueOf((int)(i+origin.x)) : String.valueOf(i+origin.x)); text.setAttribute(SVGAttributes.SVG_X, String.valueOf((int)(position.x+j*gapX*increment.x-fontMetrics.stringWidth(str)/2.))); text.setAttribute(SVGAttributes.SVG_Y, String.valueOf((int)(position.y+sep))); text.setTextContent(str); texts.appendChild(text); } for(i=-increment.x, j=-1; j>=startX; i-=increment.x, j--) { text = new SVGTextElement(document); str = (((int)increment.x)==increment.x?String.valueOf((int)(i+origin.x)) : String.valueOf(i+origin.x)); text.setAttribute(SVGAttributes.SVG_X, String.valueOf((int)(position.x+j*gapX*increment.x-fontMetrics.stringWidth(str)/2.))); text.setAttribute(SVGAttributes.SVG_Y, String.valueOf((int)(position.y+sep))); text.setTextContent(str); texts.appendChild(text); } elt.appendChild(texts); } if(labelsDisplayed==Axe.LABELS_DISPLAYED_ALL_VALUE || labelsDisplayed==Axe.LABELS_DISPLAYED_Y_VALUE) {// We show the labels on the Y-axe. float height = fontMetrics.getAscent(); String str; if(maxX>0 && isYLabelWest) { double gap = (ticksBot && (ticksDisplayed==Axe.LABELS_DISPLAYED_ALL_VALUE || ticksDisplayed==Axe.LABELS_DISPLAYED_Y_VALUE)?ticksSize:0)+thickness/2.; if(gridStart.x==0 && (gridStart.y!=gridEnd.y || gridStart.y!=0) && showOrigin) { SVGElement text = new SVGTextElement(document); text.setAttribute(SVGAttributes.SVG_FONT_SIZE, String.valueOf(font.getSize())); text.setAttribute(SVGAttributes.SVG_STROKE_WIDTH, "1");//$NON-NLS-1$ text.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.CSS_BLACK_NAME); text.setAttribute(SVGAttributes.SVG_X, String.valueOf((int)(position.x-gap-fontMetrics.stringWidth(String.valueOf((int)origin.y))-Axe.GAP_LABEL))); text.setAttribute(SVGAttributes.SVG_Y, String.valueOf((int)(position.y+height/2.))); text.setTextContent(String.valueOf((int)origin.y)); elt.appendChild(text); } SVGElement texts = new SVGGElement(document); texts.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.CSS_BLACK_NAME); texts.setAttribute(SVGAttributes.SVG_STROKE_WIDTH, "1");//$NON-NLS-1$ texts.setAttribute(SVGAttributes.SVG_FONT_SIZE, String.valueOf(font.getSize())); SVGElement text; for(i=increment.getY(), j=1; j<=endY; i+=increment.getY(), j++) { text = new SVGTextElement(document); str = ((int)increment.getY())==increment.getY()?String.valueOf((int)(i+origin.y)):String.valueOf(i+origin.y); text.setAttribute(SVGAttributes.SVG_X, String.valueOf((int)(position.x-gap-fontMetrics.stringWidth(str)-Axe.GAP_LABEL))); text.setAttribute(SVGAttributes.SVG_Y, String.valueOf((int)(position.y+height/2.-j*gapY*increment.getY()))); text.setTextContent(str); texts.appendChild(text); } for(i=-increment.getY(), j=-1; j>=startY; i-=increment.getY(), j--) { text = new SVGTextElement(document); str = ((int)increment.getY())==increment.getY()?String.valueOf((int)(i+origin.y)):String.valueOf(i+origin.y); text.setAttribute(SVGAttributes.SVG_X, String.valueOf((int)(position.x-gap-fontMetrics.stringWidth(str)-Axe.GAP_LABEL))); text.setAttribute(SVGAttributes.SVG_Y, String.valueOf((int)(position.y+height/2.-j*gapY*increment.getY()))); text.setTextContent(str); texts.appendChild(text); } elt.appendChild(texts); } else { double gap = ((!ticksBot || ticksStyle==Axe.TICKS_STYLE_FULL_VALUE) && (ticksDisplayed==Axe.LABELS_DISPLAYED_ALL_VALUE|| ticksDisplayed==Axe.LABELS_DISPLAYED_Y_VALUE)?ticksSize:0)+thickness/2.; if((!isYLabelWest && gridEnd.x<=0) || (isYLabelWest && gridStart.x>=0) && (gridStart.y!=gridEnd.y || gridStart.y!=0) && showOrigin) { SVGElement text = new SVGTextElement(document); text.setAttribute(SVGAttributes.SVG_FONT_SIZE, String.valueOf(font.getSize())); text.setAttribute(SVGAttributes.SVG_STROKE_WIDTH, "1");//$NON-NLS-1$ text.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.CSS_BLACK_NAME); text.setAttribute(SVGAttributes.SVG_X, String.valueOf((int)(position.x+gap+Axe.GAP_LABEL))); text.setAttribute(SVGAttributes.SVG_Y, String.valueOf((int)(position.y+height/2.))); text.setTextContent(String.valueOf((int)origin.y)); elt.appendChild(text); } SVGElement texts = new SVGGElement(document); texts.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.CSS_BLACK_NAME); texts.setAttribute(SVGAttributes.SVG_FONT_SIZE, String.valueOf(font.getSize())); texts.setAttribute(SVGAttributes.SVG_STROKE_WIDTH, "1");//$NON-NLS-1$ SVGElement text; for(i=increment.getY(), j=1; j<=endY; i+=increment.getY(), j++) { text = new SVGTextElement(document); text.setAttribute(SVGAttributes.SVG_X, String.valueOf((int)(position.x+gap+Axe.GAP_LABEL))); text.setAttribute(SVGAttributes.SVG_Y, String.valueOf((int)(position.y+height/2.-j*gapY*increment.getY()))); text.setTextContent(((int)increment.getY())==increment.getY()?String.valueOf((int)(i+origin.y)):String.valueOf(i+origin.y)); texts.appendChild(text); } for(i=-increment.getY(), j=-1; j>=startY; i-=increment.getY(), j--) { text = new SVGTextElement(document); text.setAttribute(SVGAttributes.SVG_X, String.valueOf((int)(position.x+gap+Axe.GAP_LABEL))); text.setAttribute(SVGAttributes.SVG_Y, String.valueOf((int)(position.y+height/2.-j*gapY*increment.getY()))); text.setTextContent(((int)increment.getY())==increment.getY()?String.valueOf((int)(i+origin.y)):String.valueOf(i+origin.y)); texts.appendChild(text); } elt.appendChild(texts); } } if(rotationAngle%(Math.PI*2)!=0) setSVGRotationAttribute(elt); } } latexdraw-2.0.8+1.orig/latexDraw/generators/svg/LRhombusSVGGenerator.java0000644000000000000000000001257411347255510023241 0ustar package latexDraw.generators.svg; import java.awt.geom.Point2D; import java.util.Vector; import latexDraw.figures.Figure; import latexDraw.figures.LaTeXDrawRectangle; import latexDraw.figures.Rhombus; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.elements.SVGElement; import latexDraw.parsers.svg.elements.SVGGElement; import latexDraw.parsers.svg.elements.SVGPolygonElement; import latexDraw.parsers.svg.parsers.SVGPointsParser; import latexDraw.psTricks.PSTricksConstants; import latexDraw.util.LaTeXDrawNamespace; import latexDraw.util.LaTeXDrawPoint2D; /** * Defines an SVG generator for a polygon.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class LRhombusSVGGenerator extends LPolygonSVGGenerator { public LRhombusSVGGenerator(Rhombus f) { super(f); } public LRhombusSVGGenerator(SVGGElement elt) { this(elt, true); } /** * Creates a rhombus from a latexdraw-SVG element. * @param elt The source element. * @since 2.0.0 */ public LRhombusSVGGenerator(SVGGElement elt, boolean withTransformation) { this(new Rhombus(false)); setNumber(elt); SVGElement elt2 = getLaTeXDrawElement(elt, null); if(elt==null || elt2==null || !(elt2 instanceof SVGPolygonElement)) throw new IllegalArgumentException(); SVGPolygonElement main = (SVGPolygonElement)elt2; Rhombus r = (Rhombus)getShape(); setSVGLatexdrawParameters(elt); setSVGParameters(main); Vector ptsPol = SVGPointsParser.getPoints(elt.getAttribute( elt.getUsablePrefix(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE_URI)+LaTeXDrawNamespace.XML_POINTS)); if(ptsPol==null || ptsPol.size()!=LaTeXDrawRectangle.NB_POINTS_FRAME) throw new IllegalArgumentException(); r.getPoint(0).setLocation(ptsPol.elementAt(0)); r.getPoint(1).setLocation(ptsPol.elementAt(1)); r.getPoint(2).setLocation(ptsPol.elementAt(2)); r.getPoint(3).setLocation(ptsPol.elementAt(3)); r.updateShape(); setSVGShadowParameters(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_SHADOW)); setSVGDbleBordersParameters(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_DBLE_BORDERS)); if(withTransformation) applyTransformations(elt); } @Override public SVGElement toSVG(SVGDocument doc) { if(doc==null) return null; Rhombus r = (Rhombus)shape; LaTeXDrawPoint2D nw = r.getTheNWPoint(), se = r.getTheSEPoint(); LaTeXDrawPoint2D gc = r.getGravityCenter(); LaTeXDrawPoint2D p1 = new LaTeXDrawPoint2D((nw.x+se.x)/2., nw.y); LaTeXDrawPoint2D p2 = new LaTeXDrawPoint2D(se.x, (nw.y+se.y)/2.); LaTeXDrawPoint2D p3 = new LaTeXDrawPoint2D((nw.x+se.x)/2., se.y); SVGElement root = new SVGGElement(doc), elt; root.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_RHOMBUS); root.setAttribute(SVGAttributes.SVG_ID, getSVGID()); double gap = getPositionGap()/2.; double cornerGap1 = Figure.getCornerGap(gc, p1, p2, gap); double cornerGap2 = Figure.getCornerGap(gc, p2, p3, gap); if(p2.x *
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class LSquareSVGGenerator extends LRectangleSVGGenerator { public LSquareSVGGenerator(Square f) { super(f); } public LSquareSVGGenerator(SVGGElement elt) { this(elt, true); } /** * Creates a square from a latexdraw-SVG element. * @param elt The source element. * @since 2.0.0 */ public LSquareSVGGenerator(SVGGElement elt, boolean withTransformation) { this(new Square(false)); setNumber(elt); SVGElement elt2 = getLaTeXDrawElement(elt, null); Square s = (Square)getShape(); if(elt==null || elt2==null || !(elt2 instanceof SVGRectElement)) throw new IllegalArgumentException(); SVGRectElement main = (SVGRectElement)elt2; double gap = getPositionGap()/2.; double rx = main.getRx(); setSVGLatexdrawParameters(elt); setSVGParameters(main); s.getPoint(0).setLocation(main.getX()+gap, main.getY()+gap); s.getPoint(1).setLocation(main.getX()+main.getWidth()-gap, main.getY()+gap); s.getPoint(2).setLocation(main.getX()+gap, main.getY()+main.getHeight()-gap); s.getPoint(3).setLocation(main.getX()+main.getWidth()-gap, main.getY()+main.getHeight()-gap); s.setWidth(main.getWidth()); setSVGShadowParameters(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_SHADOW)); setSVGDbleBordersParameters(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_DBLE_BORDERS)); if(rx>0) s.setIsRound(true); RectangularShape r = (RectangularShape)s.getShape(); s.setFrameArc((2*rx)/(min(r.getHeight(), r.getWidth())- (s.hasDoubleBoundary() ? s.getDoubleSep()+s.getThickness() : 0))); if(withTransformation) applyTransformations(elt); } @Override public SVGElement toSVG(SVGDocument doc) { if(doc==null) return null; SVGElement root = super.toSVG(doc); root.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_SQUARE); return root; } } latexdraw-2.0.8+1.orig/latexDraw/generators/svg/LEllipseSVGGenerator.java0000644000000000000000000001115611347255510023212 0ustar package latexDraw.generators.svg; import latexDraw.figures.Ellipse; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.elements.SVGElement; import latexDraw.parsers.svg.elements.SVGEllipseElement; import latexDraw.parsers.svg.elements.SVGGElement; import latexDraw.psTricks.PSTricksConstants; import latexDraw.util.LaTeXDrawNamespace; import latexDraw.util.LaTeXDrawPoint2D; /** * Defines a SVG generator for an ellipse.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class LEllipseSVGGenerator extends LShapeSVGGenerator { public LEllipseSVGGenerator(Ellipse f) { super(f); } /** * Creates an ellipse from an SVG ellipse element. * @param elt The source element. * @since 2.0.0 */ public LEllipseSVGGenerator(SVGEllipseElement elt) { this(new Ellipse(true)); Ellipse e = (Ellipse)getShape(); setSVGParameters(elt); e.setFirstPoint(elt.getCx()-elt.getRx(), elt.getCy()-elt.getRy()); e.setLastPoint(elt.getCx()+elt.getRx(), elt.getCy()+elt.getRy()); e.setBordersPosition(PSTricksConstants.BORDERS_MIDDLE); applyTransformations(elt); } public LEllipseSVGGenerator(SVGGElement elt) { this(elt, true); } /** * Creates an ellipse from a latexdraw-SVG element. * @param elt The source element. * @since 2.0.0 */ public LEllipseSVGGenerator(SVGGElement elt, boolean withTransformation) { this(new Ellipse(false)); setNumber(elt); SVGElement elt2 = getLaTeXDrawElement(elt, null); Ellipse e = (Ellipse)getShape(); if(elt==null || elt2==null || !(elt2 instanceof SVGEllipseElement)) throw new IllegalArgumentException(); SVGEllipseElement main = (SVGEllipseElement)elt2; setSVGLatexdrawParameters(elt); setSVGParameters(main); double gap = getPositionGap()/2.; e.setFirstPoint(main.getCx()-main.getRx()+gap, main.getCy()-main.getRy()+gap); e.setLastPoint(main.getCx()+main.getRx()-gap, main.getCy()+main.getRy()-gap); setSVGShadowParameters(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_SHADOW)); setSVGDbleBordersParameters(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_DBLE_BORDERS)); if(withTransformation) applyTransformations(elt); } @Override public SVGElement toSVG(SVGDocument doc) { if(doc==null || doc.getFirstChild().getDefs()==null) throw new IllegalArgumentException(); LaTeXDrawPoint2D nw = shape.getTheNWPoint(); LaTeXDrawPoint2D se = shape.getTheSEPoint(); SVGElement elt; SVGElement root = new SVGGElement(doc); root.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_ELLIPSE); root.setAttribute(SVGAttributes.SVG_ID, getSVGID()); double gap = getPositionGap(); if(shape.hasShadow()) { elt = new SVGEllipseElement((se.x+nw.x)/2., (se.y+nw.y)/2., Math.max(1, (se.x-nw.x+gap)/2.), Math.max(1, (se.y-nw.y+gap)/2.), doc); setSVGShadowAttributes(elt, true); root.appendChild(elt); } if(shape.hasShadow() && !shape.getLineStyle().equals(PSTricksConstants.LINE_NONE_STYLE)) {// The background of the borders must be filled is there is a shadow. elt = new SVGEllipseElement((se.x+nw.x)/2., (se.y+nw.y)/2., Math.max(1, (se.x-nw.x+gap)/2.), Math.max(1, (se.y-nw.y+gap)/2.), doc); setSVGBorderBackground(elt, root); } elt = new SVGEllipseElement((se.x+nw.x)/2., (se.y+nw.y)/2., Math.max(1, (se.x-nw.x+gap)/2.), Math.max(1, (se.y-nw.y+gap)/2.), doc); setSVGAttributes(doc, elt, true); root.appendChild(elt); if(shape.hasDoubleBoundary()) { elt = new SVGEllipseElement((se.x+nw.x)/2., (se.y+nw.y)/2., Math.max(1, (se.x-nw.x+gap)/2.), Math.max(1, (se.y-nw.y+gap)/2.), doc); setSVGDoubleBordersAttributes(elt); root.appendChild(elt); } setSVGRotationAttribute(root); return root; } } latexdraw-2.0.8+1.orig/latexDraw/generators/svg/LLineSVGGenerator.java0000644000000000000000000001654411347255510022512 0ustar package latexDraw.generators.svg; import java.awt.geom.Line2D; import latexDraw.figures.ArrowHead; import latexDraw.figures.Line; import latexDraw.figures.properties.Arrowable; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.elements.*; import latexDraw.parsers.svg.elements.path.SVGPathSegLineto; import latexDraw.parsers.svg.elements.path.SVGPathSegList; import latexDraw.parsers.svg.elements.path.SVGPathSegMoveto; import latexDraw.util.LaTeXDrawNamespace; import latexDraw.util.LaTeXDrawPoint2D; /** * Defines a SVG generator for a line.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class LLineSVGGenerator extends LPolygonSVGGenerator { public LLineSVGGenerator(Line f) { super(f); } /** * Creates a line using a SVG path. * @param elt The SVG path. */ public LLineSVGGenerator(SVGPathElement elt) { super(new Line(true)); if(elt==null || !elt.isLine()) throw new IllegalArgumentException(); SVGPathSegList segs = elt.getSegList(); Line l = (Line)getShape(); l.setFirstPoint(new LaTeXDrawPoint2D(((SVGPathSegMoveto)segs.firstElement()).getPoint())); l.setLastPoint(new LaTeXDrawPoint2D(((SVGPathSegLineto)segs.lastElement()).getPoint())); l.updateShape(); setSVGParameters(elt); applyTransformations(elt); } public LLineSVGGenerator(SVGLineElement e) { this(new Line(e.getX1(), e.getY1(), e.getX2(), e.getY2(), true)); setSVGParameters(e); applyTransformations(e); } public LLineSVGGenerator(SVGGElement elt) { this(elt, true); } public LLineSVGGenerator(SVGGElement elt, boolean withTransformation) { this(new Line(false)); setNumber(elt); SVGElement elt2 = getLaTeXDrawElement(elt, null); Line l = (Line)getShape(); ArrowHead arrowHead1 = l.getArrowHead1(); ArrowHead arrowHead2 = l.getArrowHead2(); if(elt==null || elt2==null || !(elt2 instanceof SVGLineElement)) throw new IllegalArgumentException(); SVGLineElement main = (SVGLineElement)elt2; setSVGLatexdrawParameters(elt); setSVGParameters(main); l.getPt1().setLocation(main.getX1(), main.getY1()); l.getPt2().setLocation(main.getX2(), main.getY2()); arrowHead1.setPosition(l.getPoint(0)); arrowHead1.setLine(l); arrowHead1.setFigure(l); arrowHead2.setPosition(l.getPoint(1)); arrowHead2.setLine(l); arrowHead2.setFigure(l); l.updateAandB(); l.updateShape(); setSVGArrow(arrowHead1, main.getAttribute(main.getUsablePrefix()+SVGAttributes.SVG_MARKER_START), main); setSVGArrow(arrowHead2, main.getAttribute(main.getUsablePrefix()+SVGAttributes.SVG_MARKER_END), main); homogeniseArrows(arrowHead1, arrowHead2); setSVGShadowParameters(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_SHADOW)); setSVGDbleBordersParameters(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_DBLE_BORDERS)); if(withTransformation) applyTransformations(elt); } @Override public SVGElement toSVG(SVGDocument doc) { SVGElement root = new SVGGElement(doc), elt; int number = shape.getNumber(); ArrowHead arrowHeadL = ((Arrowable)shape).getArrowHead1(); ArrowHead arrowHeadR = ((Arrowable)shape).getArrowHead2(); SVGDefsElement defs = doc.getFirstChild().getDefs(); Line l = (Line)shape; SVGElement arrow1 = null, arrow2 = null, arrow1Shad = null, arrow2Shad = null; root.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE + ':' + LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_LINE); root.setAttribute(SVGAttributes.SVG_ID, getSVGID()); String arrow1Name = "arrow1-" + number;//$NON-NLS-1$ String arrow2Name = "arrow2-" + number;//$NON-NLS-1$ String arrow1ShadName = "arrow1Shad-" + number;//$NON-NLS-1$ String arrow2ShadName = "arrow2Shad-" + number;//$NON-NLS-1$ LaTeXDrawPoint2D pt1 = l.getPt1(), pt2 = l.getPt2(); if(!arrowHeadL.isWithoutStyle()) { arrow1 = new LArrowHeadSVGGenerator(arrowHeadL).toSVG(doc, false); arrow1.setAttribute(SVGAttributes.SVG_ID, arrow1Name); defs.appendChild(arrow1); if(l.hasShadow()) { arrow1Shad = new LArrowHeadSVGGenerator(arrowHeadL).toSVG(doc, true); arrow1Shad.setAttribute(SVGAttributes.SVG_ID, arrow1ShadName); defs.appendChild(arrow1Shad); } } if(!arrowHeadR.isWithoutStyle()) { arrow2 = new LArrowHeadSVGGenerator(arrowHeadR).toSVG(doc, false); arrow2.setAttribute(SVGAttributes.SVG_ID, arrow2Name); defs.appendChild(arrow2); if(l.hasShadow()) { arrow2Shad = new LArrowHeadSVGGenerator(arrowHeadR).toSVG(doc, true); arrow2Shad.setAttribute(SVGAttributes.SVG_ID, arrow2ShadName); defs.appendChild(arrow2Shad); } } if(l.hasShadow()) { SVGElement shad = new SVGLineElement(doc); shad.setAttribute(SVGAttributes.SVG_X1, String.valueOf(pt1.x)); shad.setAttribute(SVGAttributes.SVG_X2, String.valueOf(pt2.x)); shad.setAttribute(SVGAttributes.SVG_Y1, String.valueOf(pt1.y)); shad.setAttribute(SVGAttributes.SVG_Y2, String.valueOf(pt2.y)); setSVGShadowAttributes(shad, false); root.appendChild(shad); if(arrow1Shad != null) shad.setAttribute(SVGAttributes.SVG_MARKER_START, "url(#" + arrow1ShadName + ")");//$NON-NLS-1$//$NON-NLS-2$ if(arrow2Shad != null) shad.setAttribute(SVGAttributes.SVG_MARKER_END, "url(#" + arrow2ShadName + ")");//$NON-NLS-1$//$NON-NLS-2$ } elt = new SVGLineElement(doc); elt.setAttribute(SVGAttributes.SVG_X1, String.valueOf(pt1.x)); elt.setAttribute(SVGAttributes.SVG_X2, String.valueOf(pt2.x)); elt.setAttribute(SVGAttributes.SVG_Y1, String.valueOf(pt1.y)); elt.setAttribute(SVGAttributes.SVG_Y2, String.valueOf(pt2.y)); root.appendChild(elt); if(l.hasDoubleBoundary()) { SVGElement dblBord = new SVGLineElement(doc); dblBord.setAttribute(SVGAttributes.SVG_X1, String.valueOf(pt1.x)); dblBord.setAttribute(SVGAttributes.SVG_X2, String.valueOf(pt2.x)); dblBord.setAttribute(SVGAttributes.SVG_Y1, String.valueOf(pt1.y)); dblBord.setAttribute(SVGAttributes.SVG_Y2, String.valueOf(pt2.y)); setSVGDoubleBordersAttributes(dblBord); root.appendChild(dblBord); } setSVGAttributes(doc, elt, false); elt.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE + ':' + LaTeXDrawNamespace.XML_ROTATION, String.valueOf(l.getRotationAngle())); if(arrow1 != null) elt.setAttribute(SVGAttributes.SVG_MARKER_START, "url(#" + arrow1Name + ")");//$NON-NLS-1$//$NON-NLS-2$ if(arrow2 != null) elt.setAttribute(SVGAttributes.SVG_MARKER_END, "url(#" + arrow2Name + ")");//$NON-NLS-1$//$NON-NLS-2$ return root; } public static SVGLineElement toSVG(Line2D l, SVGDocument doc) { if(l==null || doc==null) return null; SVGLineElement le; try { le = new SVGLineElement(l.getX1(), l.getY1(), l.getX2(), l.getY2(), doc); } catch(MalformedSVGDocument e) { le = null; } return le; } } latexdraw-2.0.8+1.orig/latexDraw/generators/svg/LPolygonSVGGenerator.java0000644000000000000000000001224511347255510023244 0ustar package latexDraw.generators.svg; import java.awt.geom.Point2D; import java.util.Vector; import latexDraw.figures.LaTeXDrawPolygon; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.elements.*; import latexDraw.parsers.svg.elements.path.SVGPathSegLineto; import latexDraw.parsers.svg.elements.path.SVGPathSegList; import latexDraw.psTricks.PSTricksConstants; import latexDraw.util.LaTeXDrawNamespace; import latexDraw.util.LaTeXDrawPoint2D; /** * Defines a SVG generator for a polygon.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class LPolygonSVGGenerator extends LShapeSVGGenerator { public LPolygonSVGGenerator(LaTeXDrawPolygon f) { super(f); } public LPolygonSVGGenerator(SVGPathElement elt) { super(new LaTeXDrawPolygon(true)); if(elt==null || !elt.isPolygon()) throw new IllegalArgumentException(); SVGPathSegList segs = elt.getSegList(); LaTeXDrawPolygon pol = (LaTeXDrawPolygon)getShape(); int i, size; for(i=0, size=segs.size()-1; i ptsPol = e.getPoints2D(); LaTeXDrawPolygon p = (LaTeXDrawPolygon)getShape(); if(ptsPol==null) throw new IllegalArgumentException(); for(Point2D pt : ptsPol) p.addPoint(new LaTeXDrawPoint2D(pt)); } @Override public SVGElement toSVG(SVGDocument doc) { if(doc==null) throw new IllegalArgumentException(); SVGElement root = new SVGGElement(doc); SVGPolygonElement elt; String points = "";//$NON-NLS-1$ LaTeXDrawPolygon p = (LaTeXDrawPolygon)shape; root.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_POLYGON); root.setAttribute(SVGAttributes.SVG_ID, getSVGID()); for(LaTeXDrawPoint2D pt : p.getPoints()) points+=pt.x + "," + pt.y + " ";//$NON-NLS-1$//$NON-NLS-2$ if(shape.hasShadow()) { SVGPolygonElement shad = new SVGPolygonElement(doc); shad.setAttribute(SVGAttributes.SVG_POINTS, points); setSVGShadowAttributes(shad, true); root.appendChild(shad); } if(shape.hasShadow() && !shape.getLineStyle().equals(PSTricksConstants.LINE_NONE_STYLE)) {// The background of the borders must be filled is there is a shadow. elt = new SVGPolygonElement(doc); elt.setAttribute(SVGAttributes.SVG_POINTS, points); setSVGBorderBackground(elt, root); } elt = new SVGPolygonElement(doc); elt.setAttribute(SVGAttributes.SVG_POINTS, points); root.appendChild(elt); setSVGAttributes(doc, elt, true); setSVGRotationAttribute(root); if(shape.hasDoubleBoundary()) { SVGPolygonElement dblBord = new SVGPolygonElement(doc); dblBord.setAttribute(SVGAttributes.SVG_POINTS, points); setSVGDoubleBordersAttributes(dblBord); root.appendChild(dblBord); } return root; } } latexdraw-2.0.8+1.orig/latexDraw/generators/svg/LShapeSVGGenerator.java0000644000000000000000000010610011347255510022647 0ustar package latexDraw.generators.svg; import static java.lang.Math.PI; import static java.lang.Math.toDegrees; import java.awt.Color; import java.awt.geom.Point2D; import java.text.ParseException; import latexDraw.figures.ArrowHead; import latexDraw.figures.Figure; import latexDraw.figures.LaTeXDrawRectangle; import latexDraw.figures.Line; import latexDraw.parsers.svg.*; import latexDraw.parsers.svg.elements.*; import latexDraw.parsers.svg.elements.path.SVGPathSegLineto; import latexDraw.parsers.svg.elements.path.SVGPathSegList; import latexDraw.parsers.svg.elements.path.SVGPathSegMoveto; import latexDraw.parsers.svg.parsers.SVGLengthParser; import latexDraw.parsers.svg.parsers.URIReferenceParser; import latexDraw.psTricks.PSTricksConstants; import latexDraw.util.LaTeXDrawNamespace; import latexDraw.util.LaTeXDrawPoint2D; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * This class allows the generation or the importation of SVG parameters to a general LaTeXDraw shape.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 10/24/07
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public abstract class LShapeSVGGenerator { protected Figure shape; public LShapeSVGGenerator(Figure f) { if(f==null) throw new IllegalArgumentException(); shape = f; } /** * @return The SVG ID of the shape (starting with the token "id" followed by the number of the shape). * @since 2.0.0 */ public String getSVGID() { return "id" + shape.getNumber(); //$NON-NLS-1$ } /** * Sets the ID of the figure according to the ID attribute of the SVGGElement, or an increment of meter if a problem occur. * @param g The SVGGElement. * @since 2.0.0 */ public void setNumber(SVGGElement g) { if(g==null) return; String nb = g.getAttribute(g.getUsablePrefix()+SVGAttributes.SVG_ID); String pref = "id"; //$NON-NLS-1$ if(nb==null) shape.setNewNumber(); else try{ shape.setNumber(Double.valueOf(nb).intValue()); } catch(NumberFormatException e) { if(nb.startsWith(pref)) try { shape.setNumber(Double.valueOf(nb.substring(pref.length())).intValue()); } catch(NumberFormatException e2) { shape.setNewNumber(); } else shape.setNewNumber(); } } /** * Applies the set of transformations that concerned the given SVG element to the shape. * @param elt The element that contains the SVG transformation list. * @since 2.0.0 */ public void applyTransformations(SVGElement elt) { if(elt==null) return ; SVGTransformList tl = elt.getWholeTransform(); // The list of the transformations that are applied on the element. for(int i = tl.size()-1; i>=0; i--) applyTransformation(tl.elementAt(i)); } /** * Applies an SVG transformation on the shape. * @param t The SVG transformation to apply. * @since 2.0.0 */ public void applyTransformation(SVGTransform t) { if(t!=null) switch(t.getType()) { case SVGTransform.SVG_TRANSFORM_ROTATE: getShape().rotate(new LaTeXDrawPoint2D(t.getMatrix().getE(), t.getMatrix().getF()), Math.toRadians(t.getRotationAngle())); break; case SVGTransform.SVG_TRANSFORM_SCALE: break; case SVGTransform.SVG_TRANSFORM_TRANSLATE: getShape().shift(t.getTX(), t.getTY()); break; //TODO Quand 'Bordel !' sera implémenté, y mettre les trucs qui vont dans 'default:'. } } /** * When the arrows are read from an SVG document, we need to set the parameters of the first * arrow to the second arrow and vise et versa; because the arrows of a shape share the same * parameters. This method carries out this job. * @param ah1 The first arrow. * @param ah2 The second arrow. * @since 2.0.0 */ public void homogeniseArrows(ArrowHead ah1, ArrowHead ah2) { if(ah1==null || ah2==null) return ; homogeniseArrowFrom(ah1, ah2); homogeniseArrowFrom(ah2, ah1); } /** * Copies the parameters of the first arrow to the second arrow (only * the parameters of the current style are copied). * @see #homogeniseArrows(ArrowHead, ArrowHead) * @param source The arrow that will be copied. * @param target The arrow that will be set. * @since 2.0.0 */ protected void homogeniseArrowFrom(ArrowHead source, ArrowHead target) { if(source==null || target==null) return ; String style = source.getArrowStyle(); if(style.equals(PSTricksConstants.NONEARROW_STYLE)) return ; if(style.equals(PSTricksConstants.BAREND_STYLE) || style.equals(PSTricksConstants.BARIN_STYLE)) { target.setTBarSizeDim(source.getTBarSizeDim()); target.setTBarSizeNum(source.getTBarSizeNum()); } else if(style.equals(PSTricksConstants.LARROW_STYLE) || style.equals(PSTricksConstants.RARROW_STYLE) || style.equals(PSTricksConstants.DLARROW_STYLE) || style.equals(PSTricksConstants.DRARROW_STYLE)) { target.setArrowInset(source.getArrowInset()); target.setArrowLength(source.getArrowLength()); target.setArrowSizeDim(source.getArrowSizeDim()); target.setArrowSizeNum(target.getArrowSizeNum()); } else if(style.equals(PSTricksConstants.RRBRACKET_STYLE) || style.equals(PSTricksConstants.LRBRACKET_STYLE)) { target.setRBracketNum(source.getRBracketNum()); target.setTBarSizeDim(source.getTBarSizeDim()); target.setTBarSizeNum(source.getTBarSizeNum()); } else if(style.equals(PSTricksConstants.RSBRACKET_STYLE) || style.equals(PSTricksConstants.LSBRACKET_STYLE)) { target.setBracketNum(source.getBracketNum()); target.setTBarSizeDim(source.getTBarSizeDim()); target.setTBarSizeNum(source.getTBarSizeNum()); } else if(style.equals(PSTricksConstants.DISKEND_STYLE) || style.equals(PSTricksConstants.DISKIN_STYLE) || style.equals(PSTricksConstants.CIRCLEEND_STYLE) || style.equals(PSTricksConstants.CIRCLEIN_STYLE)) { target.setDotSizeDim(source.getDotSizeDim()); target.setDotSizeNum(source.getDotSizeNum()); } } /** * Sets the shadow parameters of the figure by using an SVG element having "type:shadow". * @param elt The source element. * @since 2.0.0 */ protected void setSVGShadowParameters(SVGElement elt) { if(elt==null || !shape.canHaveShadow()) return ; String fill = elt.getFill(); if(fill!=null && !fill.equals(SVGAttributes.SVG_VALUE_NONE) && !fill.startsWith("url(#"))//$NON-NLS-1$ shape.setShadowColor(CSSColors.getRGBColour(fill)); SVGTransformList tl = elt.getTransform(); SVGTransform t; double tx, ty; boolean sSize = false, sAngle = false; for(int i=0, size=tl.size(); i0. ? -Math.PI/2. : Math.PI/2.; else { angle = Math.acos(gravityCenter.distance(gravityCenter.x+tx+shSize, gravityCenter.y)/ gravityCenter.distance(gravityCenter.x+tx+shSize, gravityCenter.y+ty)); if(tx+shSize<0) { if(ty<0.) angle = Math.PI - angle; else angle += Math.PI; } else if(ty>0.) angle *= -1; } shape.setShadowAngle(angle); sAngle = true; } } } shape.setHasShadow(true); } /** * Sets the double borders parameters of the figure by using an SVG element. * @param elt The SVG element. * @since 2.0.0 */ protected void setSVGDbleBordersParameters(SVGElement elt) { if(elt==null) return ; shape.setDoubleSep(elt.getStrokeWidth()); shape.setDoubleColor(elt.getStroke()); shape.setThickness((float)((shape.getThickness()-shape.getDoubleSep())/2.)); shape.setHasDoubleBoundary(true); } protected void setSVGLatexdrawParameters(SVGElement elt) { if(elt==null) return ; if(shape.isBordersMovable()) { String bp = elt.getAttribute(elt.getUsablePrefix(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE_URI)+ LaTeXDrawNamespace.XML_BORDERS_POS); if(bp!=null) shape.setBordersPosition(bp); } } /** * Sets the global parameters of the figure by using an SVG element. * @param elt The SVG element. * @since 2.0.0 */ protected void setSVGParameters(SVGElement elt) { if(elt==null) return ; if(shape.isThicknessable()) shape.setThickness((float)elt.getStrokeWidth()); shape.setLinesColor(elt.getStroke()); if(shape.isDashableOrDotable()) LShapeSVGGenerator.setDashedDotted(shape, elt.getStrokeDasharray(), elt.getLinecap()); if(shape.canBeFilled()) LShapeSVGGenerator.setFill(shape, elt.getFill(), elt.getSVGRoot().getDefs()); CSSStylesGenerator.setCSSStyles(shape, elt.getStylesCSS(), elt.getSVGRoot().getDefs()); } /** * Sets the given arrow head using the SVG arrow with the ID arrowID * @param ah The arrow head to set. * @param arrowID The SVG ID of the SVG arrow head. * @param elt An element of the SVG document (useful to get the defs of the document). * @since 2.0.0 */ protected void setSVGArrow(ArrowHead ah, String arrowID, SVGElement elt) { if(ah==null || arrowID==null || elt==null) return ; LArrowHeadSVGGenerator ahGen1 = new LArrowHeadSVGGenerator(ah); try{ ahGen1.setArrow((SVGMarkerElement)elt.getDef(new URIReferenceParser(arrowID).getURI()), getShape()); } catch(ClassCastException e) { e.printStackTrace(); } } /** * @param elt The source g element. * @param type The type of the latexdraw element (double borders, shadow, main), if null, the main element is returned. * @return The Researched element. * @since 2.0.0 */ protected SVGElement getLaTeXDrawElement(SVGGElement elt, String type) { if(elt==null) return null; NodeList nl = elt.getChildNodes(); int i=0, size = nl.getLength(); Node ltdElt=null, n; String bis = elt.lookupPrefixUsable(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE_URI); if(type==null) while(i0) transfo = rotation + " " + transfo; else transfo = rotation; elt.setAttribute(SVGAttributes.SVG_TRANSFORM, transfo); } } /** * Sets the double borders parameters to the given SVG element if the current figure has double borders. * @param elt The element to set. * @exception IllegalArgumentException If elt is null. * @since 2.0.0 */ protected void setSVGDoubleBordersAttributes(Element elt) { if(elt==null) throw new IllegalArgumentException(); if(shape.hasDoubleBoundary()) { elt.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.getColorName(shape.getDoubleColor(), true)); elt.setAttribute(SVGAttributes.SVG_STROKE_WIDTH, String.valueOf(shape.getDoubleSep())); elt.setAttribute(SVGAttributes.SVG_FILL, SVGAttributes.SVG_VALUE_NONE); elt.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_DBLE_BORDERS); } } /** * * @param elt The element to set if the current figure has a shadow. * @param shadowFills True if a shadow must fill the figure. * @exception IllegalArgumentException If elt is null. * @since 2.0.0 */ protected void setSVGShadowAttributes(Element elt, boolean shadowFills) { if(elt==null) throw new IllegalArgumentException(); if(shape.hasShadow()) { LaTeXDrawPoint2D gravityCenter = shape.getGravityCenter(); LaTeXDrawPoint2D pt = new LaTeXDrawPoint2D(gravityCenter.x+shape.getShadowSize(), gravityCenter.y); pt = shape.rotatePoint(pt, -shape.getShadowAngle()); elt.setAttribute(SVGAttributes.SVG_TRANSFORM, SVGTransform.createTranslation((float)shape.getShadowSize(), 0) + " " + //$NON-NLS-1$ SVGTransform.createTranslation((float)(pt.x-gravityCenter.x-shape.getShadowSize()), (float)(pt.y-gravityCenter.y))); elt.setAttribute(SVGAttributes.SVG_STROKE_WIDTH, String.valueOf(shape.hasDoubleBoundary() ? shape.getThickness()*2+shape.getDoubleSep() : shape.getThickness())); elt.setAttribute(SVGAttributes.SVG_FILL, shadowFills || shape.isFilled() ? CSSColors.getColorName(shape.getShadowColor(), true) : SVGAttributes.SVG_VALUE_NONE); elt.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.getColorName(shape.getShadowColor(), true)); elt.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_SHADOW); } } /** * Sets the SVG attribute of the current figure. * @param doc The original document with which, all the elements will be created. * @param root The root element of the document. * @param shadowFills True if a shadow must fill the figure. * @since 2.0.0 */ protected void setSVGAttributes(SVGDocument doc, SVGElement root, boolean shadowFills) { if(root==null || doc.getFirstChild().getDefs()==null) throw new IllegalArgumentException(); SVGDefsElement defs = doc.getFirstChild().getDefs(); if(shape.isBordersMovable()) root.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE +':'+ LaTeXDrawNamespace.XML_BORDERS_POS, shape.getBordersPosition()); if(shape.isThicknessable()) { LShapeSVGGenerator.setThickness(root, shape.getThickness(), shape.hasDoubleBoundary(), shape.getDoubleSep()); root.setStroke(shape.getLinesColor()); } if(shape.canBeFilled()) if((shape.isFilled() || (shape.hasShadow() && shadowFills)) && !shape.isHatched() && !shape.hasGradient()) root.setAttribute(SVGAttributes.SVG_FILL, CSSColors.getColorName(shape.getInteriorColor(), true)); else if(shape.getHatchingStyle().equals(PSTricksConstants.TOKEN_FILL_NONE)) root.setAttribute(SVGAttributes.SVG_FILL, SVGAttributes.SVG_VALUE_NONE); else if(shape.getHatchingStyle().equals(PSTricksConstants.TOKEN_FILL_GRADIENT)) { Element grad = new SVGLinearGradientElement(doc), stop; String id = SVGElements.SVG_LINEAR_GRADIENT + shape.getNumber(); double gradMidPt = shape.getGradientAngle()>PI || (shape.getGradientAngle()<0 && shape.getGradientAngle()>-PI)? 1-shape.getGradientMidPoint() : shape.getGradientMidPoint(); grad.setAttribute(SVGAttributes.SVG_ID, id); if(((float)(shape.getGradientAngle()%(2*PI))) != (float)(PI/2f)) { Point2D.Float p1 = new Point2D.Float(), p2 = new Point2D.Float(); getGradientPoints(p1, p2, true); grad.setAttribute(SVGAttributes.SVG_X1, String.valueOf(p1.x)); grad.setAttribute(SVGAttributes.SVG_Y1, String.valueOf(p1.y)); grad.setAttribute(SVGAttributes.SVG_X2, String.valueOf(p2.x)); grad.setAttribute(SVGAttributes.SVG_Y2, String.valueOf(p2.y)); grad.setAttribute(SVGAttributes.SVG_GRADIENT_UNITS, SVGAttributes.SVG_UNITS_VALUE_USR); } if(gradMidPt!=0) { stop = doc.createElement(SVGElements.SVG_STOP); stop.setAttribute(SVGAttributes.SVG_OFFSET, "0");//$NON-NLS-1$ stop.setAttribute(SVGAttributes.SVG_STOP_COLOR, CSSColors.getColorName(shape.getGradientStartColor(), true)); grad.appendChild(stop); } stop = doc.createElement(SVGElements.SVG_STOP); stop.setAttribute(SVGAttributes.SVG_OFFSET, String.valueOf(gradMidPt)); stop.setAttribute(SVGAttributes.SVG_STOP_COLOR, CSSColors.getColorName(shape.getGradientEndColor(), true)); grad.appendChild(stop); if(gradMidPt!=1) { stop = doc.createElement(SVGElements.SVG_STOP); stop.setAttribute(SVGAttributes.SVG_OFFSET, "1");//$NON-NLS-1$ stop.setAttribute(SVGAttributes.SVG_STOP_COLOR, CSSColors.getColorName(shape.getGradientStartColor(), true)); grad.appendChild(stop); } defs.appendChild(grad); root.setAttribute(SVGAttributes.SVG_FILL, "url(#" + id + ')');//$NON-NLS-1$ } else { if(shape.isHatched()) { String id = SVGElements.SVG_PATTERN + shape.getNumber(); Element hatch = doc.createElement(SVGElements.SVG_PATTERN); Element gPath = doc.createElement(SVGElements.SVG_G); LaTeXDrawPoint2D max = shape.getTheSENonRotatedBoundPoint(); root.setAttribute(SVGAttributes.SVG_FILL, "url(#" + id + ')');//$NON-NLS-1$ hatch.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_TYPE, shape.getHatchingStyle()); hatch.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_ROTATION, String.valueOf(shape.getHatchingAngle())); hatch.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_SIZE, String.valueOf(shape.getHatchingSep())); hatch.setAttribute(SVGAttributes.SVG_PATTERN_UNITS, SVGAttributes.SVG_UNITS_VALUE_USR); hatch.setAttribute(SVGAttributes.SVG_ID, id); hatch.setAttribute(SVGAttributes.SVG_X, "0"); hatch.setAttribute(SVGAttributes.SVG_Y, "0"); hatch.setAttribute(SVGAttributes.SVG_WIDTH, String.valueOf((int)max.x)); hatch.setAttribute(SVGAttributes.SVG_HEIGHT, String.valueOf((int)max.y)); gPath.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.getColorName(shape.getHatchingColor(), true)); gPath.setAttribute(SVGAttributes.SVG_STROKE_WIDTH, String.valueOf(shape.getHatchingWidth())); gPath.setAttribute(SVGAttributes.SVG_STROKE_DASHARRAY, SVGAttributes.SVG_VALUE_NONE); Element path = doc.createElement(SVGElements.SVG_PATH); path.setAttribute(SVGAttributes.SVG_D, getSVGHatchingsPath().toString()); gPath.appendChild(path); if(shape.isFilled() || (shape.hasShadow() && shadowFills)) { Element fill = doc.createElement(SVGElements.SVG_RECT); fill.setAttribute(SVGAttributes.SVG_FILL, CSSColors.getColorName(shape.getInteriorColor(), true)); fill.setAttribute(SVGAttributes.SVG_STROKE, SVGAttributes.SVG_VALUE_NONE); fill.setAttribute(SVGAttributes.SVG_WIDTH, String.valueOf((int)max.x)); fill.setAttribute(SVGAttributes.SVG_HEIGHT, String.valueOf((int)max.y)); hatch.appendChild(fill); } defs.appendChild(hatch); hatch.appendChild(gPath); } }//else if(shape.isDashableOrDotable()) LShapeSVGGenerator.setDashedDotted(root, shape.getBlackDashLength(), shape.getWhiteDashLength(), shape.getDotSep(), shape.getLineStyle(), shape.hasDoubleBoundary(), shape.getThickness(), shape.getDoubleSep()); } /** * @return The path of the hatchings of the shape. * @since 2.0.0 */ public SVGPathSegList getSVGHatchingsPath() { SVGPathSegList path = new SVGPathSegList(); if(!shape.isHatched()) return path; String hatchingStyle = shape.getHatchingStyle(); double hatchingAngle = shape.getHatchingAngle(); LaTeXDrawRectangle bound = new LaTeXDrawRectangle(shape.getTheNWNonRotatedBoundPoint(), shape.getTheSENonRotatedBoundPoint(), false); if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_VLINES) || hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_VLINES_F)) getSVGHatchingsPath_(path, hatchingAngle, bound); else if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_HLINES) || hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_HLINES_F)) getSVGHatchingsPath_(path, hatchingAngle>0?hatchingAngle-Math.PI/2.:hatchingAngle+Math.PI/2., bound); else if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_CROSSHATCH) || hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_CROSSHATCH_F)) { getSVGHatchingsPath_(path, hatchingAngle, bound); getSVGHatchingsPath_(path, hatchingAngle>0?hatchingAngle-Math.PI/2.:hatchingAngle+Math.PI/2., bound); } return path; } private void getSVGHatchingsPath_(SVGPathSegList path, double hAngle, LaTeXDrawRectangle bound) { if(path == null || bound==null) return; double angle2 = hAngle%(Math.PI*2.); float halphPI = (float)(Math.PI/2.); double hatchingWidth = shape.getHatchingWidth(); double hatchingSep = shape.getHatchingSep(); LaTeXDrawPoint2D nw = bound.getTheNWPoint(); LaTeXDrawPoint2D se = bound.getTheSEPoint(); if(angle2>0) { if((float)angle2>3f*halphPI) angle2 = angle2-Math.PI*2.; else if((float)angle2>halphPI) angle2 = angle2-Math.PI; } else if((float)angle2<-3f*halphPI) angle2 = angle2+Math.PI*2.; else if((float)angle2<-halphPI) angle2 = angle2+Math.PI; double val = hatchingWidth+hatchingSep; float fAngle = (float)angle2; if(fAngle==0f) for(double x = nw.x; x0f) { y1 = nw.y; maxX = se.x + (se.y-(nw.y<0?nw.y:0)) * Math.tan(angle2); } else { y1 = se.y; maxX = se.x - se.y * Math.tan(angle2); } x1 = nw.x; x2 = x1; y2 = y1; if(((float)incX)<=0f) return ; while(x2 < maxX) { x2 += incX; y1 += incY; path.add(new SVGPathSegMoveto(x1, y1, false)); path.add(new SVGPathSegLineto(x2, y2, false)); } } } /** * Gets the points needed to the gradient definition. The given points must not be null, there value will be set in the method. * @param p1 The first point to set. * @param p2 The second point to set. * @param ignoreMidPt True, gradientMidPt will be ignored. * @throws IllegalArgumentException If p1 or p2 is null. * @since 2.0.0 */ protected void getGradientPoints(Point2D.Float p1, Point2D.Float p2, boolean ignoreMidPt) { if(p1==null || p2==null) throw new IllegalArgumentException(); try { LaTeXDrawPoint2D NW = shape.getTheNWPoint(); LaTeXDrawPoint2D SE = shape.getTheSEPoint(); LaTeXDrawPoint2D pt1 = new LaTeXDrawPoint2D((NW.x+SE.x)/2., NW.y); LaTeXDrawPoint2D pt2 = new LaTeXDrawPoint2D((NW.x+SE.x)/2., SE.y); double angle = shape.getGradientAngle()%(2*PI); double gradMidPt = shape.getGradientMidPoint(); if(angle<0) angle = 2*PI + angle; if(angle>=PI) { gradMidPt = 1 - shape.getGradientMidPoint(); angle = angle-PI; } if(angle!=0) { if((angle%(PI/2.))==0) { pt1 = new LaTeXDrawPoint2D(NW.x, (NW.y+SE.y)/2.); pt2 = new LaTeXDrawPoint2D(SE.x, (NW.y+SE.y)/2.); if(!ignoreMidPt &&gradMidPt<0.5) pt1.x = pt2.x - Point2D.distance(pt2.x, pt2.y, SE.x,(NW.y+SE.y)/2.); pt2.x = (NW.x+(SE.x-NW.x)*(ignoreMidPt ? 1 : gradMidPt)); } else { LaTeXDrawPoint2D cg = shape.getGravityCenter(); Line l2, l; pt1 = Figure.rotatePoint(pt1, cg, -angle); pt2 = Figure.rotatePoint(pt2, cg, -angle); l = new Line(pt1, pt2, false); if(angle>=0 && angle<(PI/2.)) l2 = l.getPerpendicularLine(NW, false); else l2 = l.getPerpendicularLine(new LaTeXDrawPoint2D(NW.x,SE.y), false); pt1 = l.getIntersection(l2); double distance = Point2D.distance(cg.x, cg.y, pt1.x, pt1.y); l.setPointAt(pt1, 0); LaTeXDrawPoint2D[] pts = l.findPoints(pt1, 2*distance*(ignoreMidPt ? 1 : gradMidPt)); pt2 = pts[0]; if(!ignoreMidPt && gradMidPt<0.5) pt1 = Figure.rotatePoint(pt1, cg, PI); } }//if(angle!=0) else { if(!ignoreMidPt && gradMidPt<0.5) pt1.y = pt2.y - Point2D.distance(pt2.x, pt2.y, (NW.x+SE.x)/2.,SE.y); pt2.y = (NW.y+(SE.y-NW.y)*(ignoreMidPt ? 1 : gradMidPt)); } p1.setLocation(pt1.x, pt1.y); p2.setLocation(pt2.x, pt2.y); }catch(Exception e) { p1.setLocation(0, 0); p2.setLocation(0, 0); } } /** * Sets the colour of the line of the shape with the given SVG stroke. * @param f The shape to set. * @param stoke The stroke of the shape. * @since 2.0.0 */ public static void setLineColour(Figure f, String stoke) { if(f==null || stoke==null) return; f.setLinesColor(CSSColors.getRGBColour(stoke)); } /** * Sets the fill properties to the given figure. * @param f The figure to set. * @param fill The fill properties * @param defs The definition that may be useful to the the fill properties (url), may be null. * @since 2.0.0 */ public static void setFill(Figure f, String fill, SVGDefsElement defs) { if(fill==null || f==null || fill.equals(SVGAttributes.SVG_VALUE_NONE)) return ; if(fill.startsWith("url(#") && fill.endsWith(")") && defs!=null)//$NON-NLS-1$//$NON-NLS-2$ { String uri = fill.substring(5, fill.length()-1); SVGElement def = defs.getDef(uri); if(def!=null) if(def instanceof SVGPatternElement) { SVGPatternElement pat = (SVGPatternElement)def; Color c = pat.getBackgroundColor(); String str = pat.getAttribute(pat.getUsablePrefix(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE_URI)+LaTeXDrawNamespace.XML_TYPE); double angle; double sep; double width; String attr; try { angle = Double.valueOf(pat.getAttribute(pat.getUsablePrefix(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE_URI)+ LaTeXDrawNamespace.XML_ROTATION)); }catch(Exception e) { angle = 0.; } attr = pat.getAttribute(pat.getUsablePrefix(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE_URI)+LaTeXDrawNamespace.XML_SIZE); if(attr==null) sep = pat.getHatchingSep(); else try { sep = Double.valueOf(attr); }catch(Exception e) { sep = 0.; } if(PSTricksConstants.isValidFillStyle(str)) f.setHatchingStyle(str); if(!Double.isNaN(angle)) f.setHatchingAngle(angle); f.setIsFilled(c!=null); f.setInteriorColor(c); f.setHatchingColor(pat.getHatchingColor()); if(!Double.isNaN(sep)) f.setHatchingSep(sep); width = pat.getHatchingStrokeWidth(); if(!Double.isNaN(width)) f.setHatchingWidth((float)width); } else if(def instanceof SVGLinearGradientElement) { SVGLinearGradientElement grad = (SVGLinearGradientElement)def; f.setGradientStartColor(grad.getStartColor()); f.setGradientEndColor(grad.getEndColor()); f.setHatchingStyle(PSTricksConstants.TOKEN_FILL_GRADIENT); f.setGradientMidPoint(grad.getMiddlePoint()); f.setGradientAngle(grad.getAngle()); } } else { Color c = CSSColors.getRGBColour(fill); if(c!=null) { f.setInteriorColor(c); f.setIsFilled(true); } } } /** * Sets the figure properties concerning the line properties. * @param f The figure to set. * @param dashArray The dash array SVG property. * @param linecap The line cap SVG property. * @since 2.0.0 */ public static void setDashedDotted(Figure f, String dashArray, String linecap) { if(f==null || dashArray==null) return ; if(!dashArray.equals(SVGAttributes.SVG_VALUE_NONE)) if(linecap!=null && SVGAttributes.SVG_LINECAP_VALUE_ROUND.equals(linecap)) f.setLineStyle(PSTricksConstants.LINE_DOTTED_STYLE); else f.setLineStyle(PSTricksConstants.LINE_DASHED_STYLE); } public static void setThickness(SVGElement elt, float thickness, boolean hasDoubleBorders, double doubleSep) { if(elt==null) return ; elt.setStrokeWidth(hasDoubleBorders ? thickness*2. + doubleSep : thickness); } public static void setDashedDotted(Element elt, float blackDash, float whiteDash, float dotSep, String lineStyle, boolean hasDoubleBorders, float thickness, double doubleSep) { if(elt==null) return ; if(lineStyle.equals(PSTricksConstants.LINE_DASHED_STYLE)) elt.setAttribute(SVGAttributes.SVG_STROKE_DASHARRAY, blackDash + ", " + whiteDash);//$NON-NLS-1$ else if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) { elt.setAttribute(SVGAttributes.SVG_STROKE_LINECAP, SVGAttributes.SVG_LINECAP_VALUE_ROUND); elt.setAttribute(SVGAttributes.SVG_STROKE_DASHARRAY, 1 + ", " + (dotSep + (hasDoubleBorders ? thickness*2f + doubleSep : thickness)));//$NON-NLS-1$ } } /** * If a figure can move its border, we have to compute the difference between the PSTricks shape and the SVG shape. * @return The gap computed with the border position, the thickness and the double boundary. Or NaN if the shape cannot move * its border. * @since 2.0.0 */ protected double getPositionGap() { double gap; if(!shape.isBordersMovable() || shape.getBordersPosition().equals(PSTricksConstants.BORDERS_MIDDLE)) gap = 0; else if(shape.getBordersPosition().equals(PSTricksConstants.BORDERS_INSIDE)) gap = -shape.getThickness() - (shape.hasDoubleBoundary() ? (float)shape.getDoubleSep() + shape.getThickness() : 0) ; else gap = shape.getThickness() + (shape.hasDoubleBoundary() ? (float)shape.getDoubleSep() + shape.getThickness() : 0); return gap; } /** * Creates a line with the style of the 'show points' option. * @param doc The document owner. * @param thickness The thickness of the line to create. * @param col The colour of the line. * @param p1 The first point of the line. * @param p2 The second point of the line. * @param blackDash The black dash interval. * @param whiteDash The white dash interval. * @param hasDble Defines if the shape had double borders. * @param dotSep The dot interval. * @return The created SVG line or null. * @since 2.0.0 */ protected static SVGLineElement getShowPointsLine(SVGDocument doc, float thickness, Color col, LaTeXDrawPoint2D p1, LaTeXDrawPoint2D p2, float blackDash, float whiteDash, boolean hasDble, float dotSep, double doubleSep) { if(doc==null) return null; SVGLineElement line = new SVGLineElement(doc); if(p1!=null) { line.setX1(p1.x); line.setY1(p1.y); } if(p2!=null) { line.setX2(p2.x); line.setY2(p2.y); } line.setStrokeWidth(thickness); line.setStroke(col); LShapeSVGGenerator.setDashedDotted(line, blackDash, whiteDash, dotSep, PSTricksConstants.LINE_DASHED_STYLE, hasDble, thickness, doubleSep); return line; } /** * Creates an SVG circle that represents a dot for the option 'show points'. * @param doc The document owner. * @param rad The radius of the circle. * @param pt The position of the point. * @param col The colour of the dot. * @return The created dot or null. * @since 2.0.0 */ protected static SVGCircleElement getShowPointsDot(SVGDocument doc, double rad, LaTeXDrawPoint2D pt, Color col) { if(doc==null) return null; SVGCircleElement circle = new SVGCircleElement(doc); circle.setR(rad); if(pt!=null) { circle.setCx(pt.x); circle.setCy(pt.y); } circle.setFill(col); return circle; } /** * When a shape has a shadow and is filled, the background of its borders must be filled with the * colour of the interior of the shape. This method does not test if it must be done, it sets a * SVG element which carries out that. * @param elt The element that will be set to define the background of the borders. * @param root The root element to which 'elt' will be appended. * @since 2.0.0 */ protected void setSVGBorderBackground(SVGElement elt, SVGElement root) { if(elt==null || root==null) return ; elt.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_BG); elt.setFill(shape.getInteriorColor()); elt.setStroke(shape.getInteriorColor()); setThickness(elt, shape.getThickness(), shape.hasDoubleBoundary(), shape.getDoubleSep()); root.appendChild(elt); } /** * @return the shape. * @since 2.0.0 */ public Figure getShape() { return shape; } } latexdraw-2.0.8+1.orig/latexDraw/generators/svg/SVGDocumentGenerator.java0000644000000000000000000001147111347255510023257 0ustar package latexDraw.generators.svg; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.util.Vector; import javax.swing.JProgressBar; import javax.swing.SwingUtilities; import latexDraw.figures.Draw; import latexDraw.figures.Figure; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.SVGElements; import latexDraw.parsers.svg.elements.*; import latexDraw.ui.DrawContainer; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.util.LaTeXDrawNamespace; import com.sun.org.apache.xml.internal.serialize.OutputFormat; import com.sun.org.apache.xml.internal.serialize.XMLSerializer; /** * Defines a generator that creates SVG documents from drawings.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class SVGDocumentGenerator { public static Draw toLatexdraw(File file, LaTeXDrawFrame frame, final JProgressBar progressBar) throws MalformedSVGDocument { if(file==null || !file.canRead()) return null; Draw drawing; Figure f; SVGDocument svgDoc = new SVGDocument(file.toURI()); if(progressBar!=null) try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { progressBar.setValue(20); } }); } catch(InterruptedException e) { e.printStackTrace(); } catch(InvocationTargetException e) { e.printStackTrace(); } f = svgDoc.toLaTeXDraw(progressBar); if(f==null) return null; if(f instanceof Draw) drawing = (Draw)f; else { drawing = new Draw(false, false); drawing.addFigure(f); } if(frame!=null) frame.getDrawPanel().getDraw().setXMLMetadata(svgDoc.getDocumentElement().getMeta()); return drawing; } public static SVGDocument toSVG(Draw drawing) { if(drawing==null) return null; SVGDocument doc = new SVGDocument(); SVGSVGElement root = doc.getFirstChild(); SVGGElement g = new SVGGElement(doc); SVGDefsElement defs = new SVGDefsElement(doc); Vector

figures = drawing.getFigures(); root.appendChild(defs); root.appendChild(g); root.setAttribute("xmlns:"+LaTeXDrawNamespace.LATEXDRAW_NAMESPACE, LaTeXDrawNamespace.LATEXDRAW_NAMESPACE_URI);//$NON-NLS-1$ for(Figure f : figures) if(f!=null) { SVGElement elt = SVGShapesFactory.createSVGElement(f, doc); if(elt!=null) g.appendChild(elt); } return doc; } public static SVGDocument toSVG(DrawContainer drawing) { if(drawing==null) return null; SVGDocument doc = toSVG(new Draw(drawing.getFigures(), false, false, true)); SVGSVGElement root = doc.getFirstChild(); SVGMetadataElement meta = new SVGMetadataElement(doc); SVGElement metaLTD = (SVGElement)doc.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+SVGElements.SVG_METADATA); meta.appendChild(metaLTD); root.appendChild(meta); drawing.getXMLMetadata(doc, metaLTD); drawing.getParentPanel().getXMLMetadata(doc, metaLTD); drawing.getParentPanel().getCodePanel().getXMLMetadata(doc, metaLTD); drawing.getParentPanel().getFrameParent().getXMLMetadata(doc, metaLTD); root.setAttribute(SVGAttributes.SVG_VERSION, "1.1");//$NON-NLS-1$ root.setAttribute(SVGAttributes.SVG_BASE_PROFILE, "full");//$NON-NLS-1$ return doc; } public static void saveSVGDocument(String path, SVGDocument doc) throws IOException { if(doc==null || path==null) return ; FileOutputStream fos = new FileOutputStream(path); OutputFormat of; XMLSerializer xmls; of = new OutputFormat(doc); of.setIndenting(true); xmls = new XMLSerializer(fos, of); xmls.serialize(doc.getDocumentElement()); fos.close(); } public static void exportAsSVG(String path, Draw drawing) throws IOException { saveSVGDocument(path, SVGDocumentGenerator.toSVG(drawing)); } /** * Exports the drawing in SVG. * @param path The path of the file. * @throws IOException * @since 2.0.0 */ public static void exportAsSVG(String path, DrawContainer drawing) throws IOException { saveSVGDocument(path, SVGDocumentGenerator.toSVG(drawing)); } } latexdraw-2.0.8+1.orig/latexDraw/generators/svg/LArrowHeadSVGGenerator.java0000644000000000000000000004763411347255510023503 0ustar package latexDraw.generators.svg; import java.awt.Color; import latexDraw.figures.ArrowHead; import latexDraw.figures.Figure; import latexDraw.figures.Line; import latexDraw.parsers.svg.*; import latexDraw.parsers.svg.elements.SVGCircleElement; import latexDraw.parsers.svg.elements.SVGElement; import latexDraw.parsers.svg.elements.SVGMarkerElement; import latexDraw.parsers.svg.elements.SVGPathElement; import latexDraw.parsers.svg.elements.path.*; import latexDraw.psTricks.PSTricksConstants; import latexDraw.util.LaTeXDrawNamespace; import latexDraw.util.LaTeXDrawPoint2D; /** * Defines a SVG generator for an arrow head.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class LArrowHeadSVGGenerator { /** The arrowhead generated or used to generate the SVG-arrow. */ protected ArrowHead arrowHead; /** * Creates an SVG-arrowhead generator. * @param ah The arrowhead. */ public LArrowHeadSVGGenerator(ArrowHead ah) { if(ah==null) throw new IllegalArgumentException(); arrowHead = ah; } /** * Creates an SVG-arrowhead generator using an SVGMarkerElement. * @param elt The SVGMarkerElement uses to creates the arrowhead. * @param owner The shape that has the arrowhead. */ public LArrowHeadSVGGenerator(SVGMarkerElement elt, Figure owner) { if(elt==null) throw new IllegalArgumentException(); arrowHead = new ArrowHead(owner); setArrow(elt, owner); } /** * Initialises the arrowhead using an SVGMarkerElement. * @param elt The SVGMarkerElement uses to initialise the arrowhead. * @param owner The figure the has the arrowhead. * @since 2.0.0 */ public void setArrow(SVGMarkerElement elt, Figure owner) { if(elt==null) return ; SVGNodeList nl = elt.getChildren(SVGElements.SVG_PATH); if(nl.getLength()==0) { nl = elt.getChildren(SVGElements.SVG_CIRCLE); if(nl.getLength()>0) setArrow((SVGCircleElement)nl.item(0), elt, owner); } else setArrow((SVGPathElement)nl.item(0), elt, owner); } /** * Initialises the arrowhead using a circle arrowhead. * @param circle The circle element. * @param elt The arrowhead element. * @param owner The shape that has the arrowhead. * @since 2.0.0 */ public void setArrow(SVGCircleElement circle, SVGMarkerElement elt, Figure owner) { if(circle==null || elt==null || owner==null) return ; double radius = circle.getR(); String dotSizeNumStr = circle.getAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_ARROW_DOT_SIZE_NUM); double dotSizeDim; double dotSizeNum; double lineWidth = owner.hasDoubleBoundary() ? owner.getDoubleSep() + 2*owner.getThickness() : owner.getThickness(); if(dotSizeNumStr==null) dotSizeNum = 1; else try { dotSizeNum = Double.valueOf(dotSizeNumStr); } catch(NumberFormatException e) { e.printStackTrace(); dotSizeNum = 1; } if(circle.getStroke()==null) { arrowHead.setArrowStyle(elt.getRefX()==0 ? PSTricksConstants.DISKEND_STYLE : PSTricksConstants.DISKIN_STYLE); dotSizeDim = radius*lineWidth*2.-dotSizeNum*lineWidth; } else { arrowHead.setArrowStyle(elt.getRefX()==0 ? PSTricksConstants.CIRCLEEND_STYLE : PSTricksConstants.CIRCLEIN_STYLE); dotSizeDim = (radius*lineWidth+lineWidth/2.)*2.-dotSizeNum*lineWidth; } if(dotSizeDim==0) arrowHead.setArrowStyle(PSTricksConstants.ROUNDIN_STYLE); else { Color filling = CSSColors.getRGBColour(circle.getFill()); if(filling!=null) arrowHead.getLine().setInteriorColor(filling); arrowHead.setDotSizeDim(dotSizeDim); arrowHead.setDotSizeNum(dotSizeNum); } } /** * Initialises the arrowhead using a path arrowhead. * @param path The path element. * @param elt The arrowhead element. * @param owner The shape that has the arrowhead. * @since 2.0.0 */ public void setArrow(SVGPathElement path, SVGMarkerElement elt, Figure owner) { if(path==null || path.getSegList().size()<2 || elt==null || owner==null) return; try { SVGPathSegList list = path.getSegList(); SVGPathSegMoveto m = (SVGPathSegMoveto)list.firstElement(); SVGPathSeg seg = list.elementAt(1); Line line = arrowHead.getLine(); LaTeXDrawPoint2D p1 = line.getPt1(); LaTeXDrawPoint2D pos = arrowHead.getPosition(); boolean isInverted = pos==p1 ? false : true; double lineWidth = owner.hasDoubleBoundary() ? owner.getDoubleSep() + 2*owner.getThickness() : owner.getThickness(); if(list.size()==2 || list.size()==4)// It may be a bar or a bracket { String tbarNumStr = path.getAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_ARROW_TBAR_SIZE_NUM); double tbarNum; double y = Math.abs(m.getY()); if(tbarNumStr==null) tbarNum = 1; else try { tbarNum = Double.valueOf(tbarNumStr); } catch(NumberFormatException e) { e.printStackTrace(); tbarNum = 1; } arrowHead.setTBarSizeNum(tbarNum); arrowHead.setTBarSizeDim(y*lineWidth*2 - tbarNum*lineWidth); if((seg instanceof SVGPathSegLineto && ((float)((SVGPathSegLineto)seg).getX())==((float)m.getX())) || (seg instanceof SVGPathSegLinetoVertical)) arrowHead.setArrowStyle(((float)m.getX())!=0f ? PSTricksConstants.BARIN_STYLE : PSTricksConstants.BAREND_STYLE); else if(seg instanceof SVGPathSegCurvetoCubic) { double width = (arrowHead.getTBarSizeDim() + arrowHead.getTBarSizeNum()*lineWidth)/lineWidth; double rBrack = (Math.abs(m.getX())-0.5)/width; arrowHead.setArrowStyle(Math.abs(m.getX())==0.5 ? isInverted ? PSTricksConstants.LRBRACKET_STYLE : PSTricksConstants.RRBRACKET_STYLE : isInverted ? PSTricksConstants.RRBRACKET_STYLE : PSTricksConstants.LRBRACKET_STYLE); arrowHead.setRBracketNum(rBrack); } else if(list.size()==4 && seg instanceof SVGPathSegLineto && list.elementAt(2) instanceof SVGPathSegLineto && list.elementAt(3) instanceof SVGPathSegLineto)// It may be a bracket. { double lgth = Math.abs(m.getX()-((SVGPathSegLineto)seg).getX()); String style = elt.getRefX()>0? PSTricksConstants.RSBRACKET_STYLE : PSTricksConstants.LSBRACKET_STYLE; y = y + (m.getY()>0 ? -0.5 : 0.5); arrowHead.setTBarSizeDim(y*lineWidth*2 - tbarNum*lineWidth); arrowHead.setBracketNum(((lgth-0.5)*lineWidth)/(arrowHead.getTBarSizeDim()/Figure.PPC + arrowHead.getTBarSizeNum()*lineWidth)); arrowHead.setArrowStyle(style); } } else if(list.size()==5 || list.size()==10)// It may be an arrow or a double arrow { if(!(seg instanceof SVGPathSegLineto && list.get(2) instanceof SVGPathSegLineto && list.get(3) instanceof SVGPathSegLineto && list.get(4) instanceof SVGPathSegClosePath)) return ; String arrNumStr = path.getAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_ARROW_SIZE_NUM); double arrNum, arrDim; double lgth = Math.abs(((SVGPathSegLineto)seg).getX() - m.getX()); if(arrNumStr==null) arrNum = 1; else try { arrNum = Double.valueOf(arrNumStr); } catch(NumberFormatException e) { e.printStackTrace(); arrNum = 1; } if(isInverted) if(list.size()==10) arrowHead.setArrowStyle(m.getX()!=0. || m.getY()!=0. ? PSTricksConstants.DLARROW_STYLE : PSTricksConstants.DRARROW_STYLE); else arrowHead.setArrowStyle(m.getX()!=0. || m.getY()!=0. ? PSTricksConstants.LARROW_STYLE : PSTricksConstants.RARROW_STYLE); else if(list.size()==10) arrowHead.setArrowStyle(m.getX()!=0. || m.getY()!=0. ? PSTricksConstants.DRARROW_STYLE : PSTricksConstants.DLARROW_STYLE); else arrowHead.setArrowStyle(m.getX()!=0. || m.getY()!=0. ? PSTricksConstants.RARROW_STYLE : PSTricksConstants.LARROW_STYLE); arrDim = lineWidth*(((SVGPathSegLineto)seg).getY()*2 - arrNum); arrowHead.setArrowLength(lgth/((arrNum*lineWidth + arrDim)/lineWidth)); arrowHead.setArrowSizeDim(arrDim); arrowHead.setArrowSizeNum(arrNum); arrowHead.setArrowInset((Math.abs(((SVGPathSegLineto)seg).getX()-((SVGPathSegLineto)list.get(2)).getX()))/lgth); } } catch(ClassCastException e) { e.printStackTrace(); } } /** * Return the SVG tree of the arrowhead or null if this arrowhead has no style. * @param doc The document used to create elements. * @return The SVG tree of the arrowhead or null if doc is null. * @since 2.0.0 */ public SVGElement toSVG(SVGDocument doc, boolean isShadow) { if(doc==null) return null; if(arrowHead.isWithoutStyle()) return null; String arrowStyle = arrowHead.getArrowStyle(); Figure figure = arrowHead.getFigure(); SVGElement marker = new SVGMarkerElement(doc); double lineWidth = figure.hasDoubleBoundary() ? figure.getDoubleSep() + 2*figure.getThickness() : figure.getThickness(); double gapPostion = 0.; if(arrowStyle.equals(PSTricksConstants.CIRCLEEND_STYLE) || arrowStyle.equals(PSTricksConstants.CIRCLEIN_STYLE)) { SVGElement circle = new SVGCircleElement(doc); double r = (arrowHead.getDotSizeDim()+arrowHead.getDotSizeNum()*lineWidth)/2.-lineWidth/2.; circle.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_ARROW_DOT_SIZE_NUM, String.valueOf(arrowHead.getDotSizeNum())); circle.setAttribute(SVGAttributes.SVG_R, String.valueOf(r/lineWidth)); circle.setAttribute(SVGAttributes.SVG_FILL, CSSColors.getColorName(figure.getInteriorColor(), true)); circle.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.getColorName(isShadow ? figure.getShadowColor() : figure.getLinesColor(), true)); circle.setStrokeWidth(1); marker.appendChild(circle); if(arrowStyle.equals(PSTricksConstants.CIRCLEIN_STYLE)) gapPostion = lineWidth * (arrowHead.isLeftArrow() ? -1 : 1); } else if(arrowStyle.equals(PSTricksConstants.DISKEND_STYLE) || arrowStyle.equals(PSTricksConstants.DISKIN_STYLE)) { SVGElement circle = new SVGCircleElement(doc); double r = (arrowHead.getDotSizeDim()+arrowHead.getDotSizeNum()*lineWidth)/2.; circle.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_ARROW_DOT_SIZE_NUM, String.valueOf(arrowHead.getDotSizeNum())); circle.setAttribute(SVGAttributes.SVG_R, String.valueOf(r/lineWidth)); circle.setAttribute(SVGAttributes.SVG_FILL, CSSColors.getColorName(isShadow ? figure.getShadowColor() : figure.getLinesColor(), true)); marker.appendChild(circle); if(arrowStyle.equals(PSTricksConstants.DISKIN_STYLE)) gapPostion = lineWidth * (arrowHead.isLeftArrow() ? -1 : 1); } else if(arrowStyle.equals(PSTricksConstants.BARIN_STYLE) || arrowStyle.equals(PSTricksConstants.BAREND_STYLE)) { SVGPathElement bar = new SVGPathElement(doc); double width = arrowHead.getTBarSizeDim() + arrowHead.getTBarSizeNum()*lineWidth; SVGPathSegList path = new SVGPathSegList(); double x = arrowStyle.equals(PSTricksConstants.BARIN_STYLE) ? arrowHead.isLeftArrow() ? 0.5 : -0.5 : 0; bar.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_ARROW_TBAR_SIZE_NUM, String.valueOf(arrowHead.getTBarSizeNum())); path.add(new SVGPathSegMoveto(x, -width/(lineWidth*2), false)); path.add(new SVGPathSegLineto(x, width/(lineWidth*2), false)); bar.setPathData(path); bar.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.getColorName(isShadow ? figure.getShadowColor() : figure.getLinesColor(), true)); bar.setAttribute(SVGAttributes.SVG_FILL, SVGAttributes.SVG_VALUE_NONE); bar.setPathData(path); bar.setStrokeWidth(1); marker.appendChild(bar); } else if(arrowStyle.equals(PSTricksConstants.LSBRACKET_STYLE) || arrowStyle.equals(PSTricksConstants.RSBRACKET_STYLE)) { SVGPathElement bar = new SVGPathElement(doc); double width = arrowHead.getTBarSizeDim() + arrowHead.getTBarSizeNum()*lineWidth; SVGPathSegList path = new SVGPathSegList(); double lgth = (arrowHead.getBracketNum()*(arrowHead.getTBarSizeDim()/Figure.PPC + arrowHead.getTBarSizeNum()*lineWidth))/lineWidth; boolean isInverted = arrowHead.isInverted();//FIXME Figure.PPC double lgth2; bar.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_ARROW_TBAR_SIZE_NUM, String.valueOf(arrowHead.getTBarSizeNum())); if((arrowStyle.equals(PSTricksConstants.LSBRACKET_STYLE))) { lgth2 = isInverted ? -lgth : 0; path.add(new SVGPathSegMoveto(lgth+lgth2+0.5, -width/(lineWidth*2)+0.5, false)); path.add(new SVGPathSegLineto(lgth2, -width/(lineWidth*2)+0.5, false)); path.add(new SVGPathSegLineto(lgth2, width/(lineWidth*2)-0.5, false)); path.add(new SVGPathSegLineto(lgth+lgth2+0.5, width/(lineWidth*2)-0.5, false)); gapPostion = isInverted ? -lineWidth/4. : -lineWidth/2.; } else { lgth2 = isInverted ? lgth : 0; path.add(new SVGPathSegMoveto(-lgth+lgth2-0.5, -width/(lineWidth*2)+0.5, false)); path.add(new SVGPathSegLineto(lgth2, -width/(lineWidth*2)+0.5, false)); path.add(new SVGPathSegLineto(lgth2, width/(lineWidth*2)-0.5, false)); path.add(new SVGPathSegLineto(-lgth+lgth2-0.5, width/(lineWidth*2)-0.5, false)); gapPostion = isInverted ? lineWidth/4. : lineWidth/2.; } marker.appendChild(bar); bar.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.getColorName(isShadow ? figure.getShadowColor() : figure.getLinesColor(), true)); bar.setAttribute(SVGAttributes.SVG_FILL, SVGAttributes.SVG_VALUE_NONE); bar.setPathData(path); bar.setAttribute(SVGAttributes.SVG_STROKE_WIDTH, "1"); //$NON-NLS-1$ } else if(arrowStyle.equals(PSTricksConstants.RARROW_STYLE) || arrowStyle.equals(PSTricksConstants.LARROW_STYLE)) { SVGElement arrow = new SVGPathElement(doc); double width = (arrowHead.getArrowSizeNum()*lineWidth + arrowHead.getArrowSizeDim())/lineWidth; double length = arrowHead.getArrowLength()*width, inset = arrowHead.getArrowInset()*length; SVGPathSegList path = new SVGPathSegList(); boolean isInverted = arrowHead.isInverted(); double lgth2; if((arrowStyle.equals(PSTricksConstants.LARROW_STYLE))) { lgth2 = isInverted ? -length : 0; path.add(new SVGPathSegMoveto(lgth2, 0., false)); path.add(new SVGPathSegLineto(length+lgth2, width/2., false)); path.add(new SVGPathSegLineto(length-inset+lgth2, 0., false)); path.add(new SVGPathSegLineto(length+lgth2, -width/2., false)); path.add(new SVGPathSegClosePath()); } else { lgth2 = isInverted ? length : 0; path.add(new SVGPathSegMoveto(lgth2, 0., false)); path.add(new SVGPathSegLineto(-length+lgth2, width/2., false)); path.add(new SVGPathSegLineto(-length+inset+lgth2, 0., false)); path.add(new SVGPathSegLineto(-length+lgth2, -width/2., false)); path.add(new SVGPathSegClosePath()); } arrow.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_ARROW_SIZE_NUM, String.valueOf(arrowHead.getArrowSizeNum())); marker.appendChild(arrow); arrow.setAttribute(SVGAttributes.SVG_FILL, CSSColors.getColorName(isShadow ? figure.getShadowColor() : figure.getLinesColor(), true)); arrow.setAttribute(SVGAttributes.SVG_D, path.toString()); } else if(arrowStyle.equals(PSTricksConstants.LRBRACKET_STYLE) || arrowStyle.equals(PSTricksConstants.RRBRACKET_STYLE)) { SVGPathElement rbracket = new SVGPathElement(doc); double width = (arrowHead.getTBarSizeDim() + arrowHead.getTBarSizeNum()*lineWidth)/lineWidth; double lgth = arrowHead.getRBracketNum()*width; double lgth2; SVGPathSegList path = new SVGPathSegList(); boolean isInverted = arrowHead.isInverted(); if((arrowStyle.equals(PSTricksConstants.LRBRACKET_STYLE))) { lgth2 = isInverted ? -lgth : 0; path.add(new SVGPathSegMoveto(lgth+lgth2+0.5, width/2., false)); path.add(new SVGPathSegCurvetoCubic(lgth+lgth2+0.5, -width/2., 0, width/2., 0, -width/2., false)); } else { lgth2 = isInverted ? lgth : 0; path.add(new SVGPathSegMoveto(-lgth+lgth2-0.5, width/2., false)); path.add(new SVGPathSegCurvetoCubic(-lgth+lgth2-0.5, -width/2., 0, width/2., 0, -width/2., false)); } marker.appendChild(rbracket); rbracket.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.getColorName(isShadow ? figure.getShadowColor() : figure.getLinesColor(), true)); rbracket.setAttribute(SVGAttributes.SVG_FILL, SVGAttributes.SVG_VALUE_NONE); rbracket.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_ARROW_TBAR_SIZE_NUM, String.valueOf(arrowHead.getTBarSizeNum())); rbracket.setPathData(path); rbracket.setStrokeWidth(1); } else if(arrowStyle.equals(PSTricksConstants.DLARROW_STYLE) || arrowStyle.equals(PSTricksConstants.DRARROW_STYLE)) { SVGElement arrow = new SVGPathElement(doc); double width = (arrowHead.getArrowSizeNum()*lineWidth + arrowHead.getArrowSizeDim())/lineWidth; double length = arrowHead.getArrowLength()*width, inset = arrowHead.getArrowInset()*length; SVGPathSegList path = new SVGPathSegList(); double lgth2; boolean isInverted = arrowHead.isInverted(); if((arrowStyle.equals(PSTricksConstants.DLARROW_STYLE))) { lgth2 = isInverted ? -length*2 : 0; path.add(new SVGPathSegMoveto(lgth2, 0, false)); path.add(new SVGPathSegLineto(length+lgth2, width/2., false)); path.add(new SVGPathSegLineto(length-inset+lgth2, 0, false)); path.add(new SVGPathSegLineto(length+lgth2, -width/2., false)); path.add(new SVGPathSegClosePath()); path.add(new SVGPathSegMoveto(length+lgth2, 0, false)); path.add(new SVGPathSegLineto(length*2+lgth2, width/2., false)); path.add(new SVGPathSegLineto(length*2-inset+lgth2, 0, false)); path.add(new SVGPathSegLineto(length*2+lgth2, -width/2., false)); path.add(new SVGPathSegClosePath()); } else { lgth2 = isInverted ? length*2 : 0; path.add(new SVGPathSegMoveto(lgth2, 0, false)); path.add(new SVGPathSegLineto(-length+lgth2, width/2., false)); path.add(new SVGPathSegLineto(-length+inset+lgth2, 0, false)); path.add(new SVGPathSegLineto(-length+lgth2, -width/2., false)); path.add(new SVGPathSegClosePath()); path.add(new SVGPathSegMoveto(-length+lgth2, 0, false)); path.add(new SVGPathSegLineto(-length*2+lgth2, width/2., false)); path.add(new SVGPathSegLineto(-length*2+inset+lgth2, 0, false)); path.add(new SVGPathSegLineto(-length*2+lgth2, -width/2., false)); path.add(new SVGPathSegClosePath()); } marker.appendChild(arrow); arrow.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_ARROW_SIZE_NUM, String.valueOf(arrowHead.getArrowSizeNum())); arrow.setAttribute(SVGAttributes.SVG_FILL, CSSColors.getColorName(isShadow ? figure.getShadowColor() : figure.getLinesColor(), true)); arrow.setAttribute(SVGAttributes.SVG_D, path.toString()); } else if(arrowStyle.equals(PSTricksConstants.ROUNDIN_STYLE)) { SVGElement circle = new SVGCircleElement(doc); circle.setAttribute(SVGAttributes.SVG_R, "0.5"); circle.setAttribute(SVGAttributes.SVG_FILL, CSSColors.getColorName(isShadow ? figure.getShadowColor() : figure.getLinesColor(), true)); marker.appendChild(circle); } if(gapPostion!=0f) marker.setAttribute(SVGAttributes.SVG_REF_X, String.valueOf(gapPostion/lineWidth)); marker.setAttribute(SVGAttributes.SVG_OVERFLOW, SVGAttributes.SVG_VALUE_VISIBLE); marker.setAttribute(SVGAttributes.SVG_ORIENT, SVGAttributes.SVG_VALUE_AUTO); return marker; } } latexdraw-2.0.8+1.orig/latexDraw/generators/svg/LRectangleSVGGenerator.java0000644000000000000000000001271511347255510023523 0ustar package latexDraw.generators.svg; import static java.lang.Math.min; import java.awt.geom.RectangularShape; import latexDraw.figures.LaTeXDrawRectangle; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.elements.SVGElement; import latexDraw.parsers.svg.elements.SVGGElement; import latexDraw.parsers.svg.elements.SVGRectElement; import latexDraw.psTricks.PSTricksConstants; import latexDraw.util.LaTeXDrawNamespace; import latexDraw.util.LaTeXDrawPoint2D; /** * Defines a SVG generator for a rectangle.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class LRectangleSVGGenerator extends LPolygonSVGGenerator { public LRectangleSVGGenerator(LaTeXDrawRectangle f) { super(f); } /** * Creates a rectangle from an SVG rect element. * @param elt The source element. * @since 2.0.0 */ public LRectangleSVGGenerator(SVGRectElement elt) { this(new LaTeXDrawRectangle(true)); setSVGRectParameters(elt); applyTransformations(elt); } public LRectangleSVGGenerator(SVGGElement elt) { this(elt, true); } /** * Creates a rectangle from a latexdraw-SVG element. * @param elt The source element. * @since 2.0.0 */ public LRectangleSVGGenerator(SVGGElement elt, boolean withTransformation) { this(new LaTeXDrawRectangle(false)); setNumber(elt); SVGElement elt2 = getLaTeXDrawElement(elt, null); if(elt==null || elt2==null || !(elt2 instanceof SVGRectElement)) throw new IllegalArgumentException(); setSVGLatexdrawParameters(elt); setSVGRectParameters((SVGRectElement)elt2); setSVGShadowParameters(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_SHADOW)); setSVGDbleBordersParameters(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_DBLE_BORDERS)); if(withTransformation) applyTransformations(elt); } private void setSVGRectParameters(SVGRectElement elt) { if(elt==null) return ; setSVGParameters(elt); double rx = elt.getRx(); LaTeXDrawRectangle r = (LaTeXDrawRectangle)getShape(); double gap = getPositionGap()/2.; r.setFirstPoint(elt.getX()+gap, elt.getY()+gap); r.setLastPoint(elt.getX()+elt.getWidth()-gap, elt.getY()+elt.getHeight()-gap); if(rx>0) r.setIsRound(true); RectangularShape rs = (RectangularShape)r.getShape(); r.setFrameArc((2*rx)/(min(rs.getHeight(), rs.getWidth())- (r.hasDoubleBoundary() ? r.getDoubleSep()+r.getThickness() : 0))); } @Override public SVGElement toSVG(SVGDocument document) { if(document==null || document.getFirstChild().getDefs()==null) throw new IllegalArgumentException(); double gap = getPositionGap(); LaTeXDrawPoint2D nw = shape.getTheNWPoint(); LaTeXDrawPoint2D se = shape.getTheSEPoint(); SVGElement elt; SVGElement root = new SVGGElement(document); root.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_RECT); root.setAttribute(SVGAttributes.SVG_ID, getSVGID()); if(shape.hasShadow()) { elt = new SVGRectElement(nw.x-gap/2., nw.y-gap/2., Math.max(1, (se.x-nw.x)+gap), Math.max(1, (se.y-nw.y)+gap), document); setSVGShadowAttributes(elt, true); setSVGRoundCorner(elt); root.appendChild(elt); } if(shape.hasShadow() && !shape.getLineStyle().equals(PSTricksConstants.LINE_NONE_STYLE)) {// The background of the borders must be filled is there is a shadow. elt = new SVGRectElement(nw.x-gap/2., nw.y-gap/2., Math.max(1, (se.x-nw.x)+gap), Math.max(1, (se.y-nw.y)+gap), document); setSVGBorderBackground(elt, root); setSVGRoundCorner(elt); } elt = new SVGRectElement(nw.x-gap/2., nw.y-gap/2., Math.max(1, (se.x-nw.x)+gap), Math.max(1, (se.y-nw.y)+gap), document); root.appendChild(elt); setSVGAttributes(document, elt, true); setSVGRoundCorner(elt); if(shape.hasDoubleBoundary()) { elt = new SVGRectElement(nw.x-gap/2., nw.y-gap/2., Math.max(1, (se.x-nw.x)+gap), Math.max(1, (se.y-nw.y)+gap), document); setSVGDoubleBordersAttributes(elt); setSVGRoundCorner(elt); root.appendChild(elt); } setSVGRotationAttribute(root); return root; } /** * Sets the roundness of the SVG shape. * @param elt The SVG element into which the roundness must be set. * @since 2.0.0 */ protected void setSVGRoundCorner(SVGElement elt) { if(elt==null) return ; if(((LaTeXDrawRectangle)shape).isRound()) { RectangularShape r = (RectangularShape)shape.getShape(); double add = shape.hasDoubleBoundary() ? shape.getDoubleSep() + shape.getThickness() : 0; double value = 0.5*(min(r.getWidth(), r.getHeight())-add)*((LaTeXDrawRectangle)shape).getFrameArc(); elt.setAttribute(SVGAttributes.SVG_RX, String.valueOf(value)); } } } latexdraw-2.0.8+1.orig/latexDraw/generators/svg/LDrawingSVGGenerator.java0000644000000000000000000000500511347255510023204 0ustar package latexDraw.generators.svg; import java.util.Vector; import latexDraw.figures.Draw; import latexDraw.figures.Figure; import latexDraw.parsers.svg.LaTeXDrawFiguresFactory; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.elements.SVGElement; import latexDraw.parsers.svg.elements.SVGGElement; import latexDraw.util.LaTeXDrawNamespace; import org.w3c.dom.NodeList; /** * Defines a SVG generator for a drawing.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class LDrawingSVGGenerator extends LShapeSVGGenerator { public LDrawingSVGGenerator(Draw f) { super(f); } public LDrawingSVGGenerator(SVGGElement elt) { this(elt, true); } /** * Creates a drawing from a G element. * @param elt The source element. * @since 2.0.0 */ public LDrawingSVGGenerator(SVGGElement elt, boolean withTransformation) { this(new Draw(true, true)); if(elt==null) throw new IllegalArgumentException(); NodeList nl = elt.getChildNodes(); Figure f; Draw d = (Draw)getShape(); if(nl.getLength()<2) throw new IllegalArgumentException(); for(int i=0, size=nl.getLength(); i figures = d.getFigures(); root.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_DRAWING); root.setAttribute(SVGAttributes.SVG_ID, getSVGID()); for(Figure f : figures) root.appendChild(SVGShapesFactory.createSVGElement(f, doc)); return root; } return null; } } latexdraw-2.0.8+1.orig/latexDraw/generators/svg/LBezierCurveSVGGenerator.java0000644000000000000000000003446511347255510024052 0ustar package latexDraw.generators.svg; import java.awt.Color; import latexDraw.figures.ArrowHead; import latexDraw.figures.BezierCurve; import latexDraw.figures.Line; import latexDraw.figures.properties.Arrowable; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.elements.SVGDefsElement; import latexDraw.parsers.svg.elements.SVGElement; import latexDraw.parsers.svg.elements.SVGGElement; import latexDraw.parsers.svg.elements.SVGPathElement; import latexDraw.parsers.svg.elements.path.SVGPathSegClosePath; import latexDraw.parsers.svg.elements.path.SVGPathSegCurvetoCubic; import latexDraw.parsers.svg.elements.path.SVGPathSegList; import latexDraw.parsers.svg.elements.path.SVGPathSegMoveto; import latexDraw.psTricks.PSTricksConstants; import latexDraw.util.LaTeXDrawNamespace; import latexDraw.util.LaTeXDrawPoint2D; /** * Defines a SVG generator for a Bézier curve.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class LBezierCurveSVGGenerator extends LPolygonSVGGenerator { public LBezierCurveSVGGenerator(BezierCurve f) { super(f); } public LBezierCurveSVGGenerator(SVGGElement elt) { this(elt, true); } /** * Creates a Bézier curve from a latexdraw-SVG element. * @param elt The source element. * @since 2.0.0 */ public LBezierCurveSVGGenerator(SVGGElement elt, boolean withTransformation) { this(new BezierCurve(false)); SVGElement elt2 = getLaTeXDrawElement(elt, null); if(elt==null || elt2==null || !(elt2 instanceof SVGPathElement)) throw new IllegalArgumentException(); SVGPathElement main = (SVGPathElement)elt2; BezierCurve bc = (BezierCurve)getShape(); ArrowHead arrowHead1 = bc.getArrowHead1(); ArrowHead arrowHead2 = bc.getArrowHead2(); setPath(main.getSegList()); setNumber(elt); setSVGLatexdrawParameters(elt); setSVGParameters(main); setSVGShadowParameters(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_SHADOW)); setSVGDbleBordersParameters(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_DBLE_BORDERS)); LaTeXDrawPoint2D pt1 = new LaTeXDrawPoint2D(bc.getPoint(0)); LaTeXDrawPoint2D pt2 = new LaTeXDrawPoint2D(bc.getPoint(-1)); arrowHead1.setPosition(pt1); arrowHead1.setLine(new Line(pt1, bc.getFirstControlPoint(0), false)); arrowHead1.setFigure(bc); arrowHead2.setPosition(pt2); arrowHead2.setLine(new Line(pt2, bc.getFirstControlPoint(-1), false)); arrowHead2.setFigure(bc); setSVGArrow(arrowHead1, main.getAttribute(main.getUsablePrefix()+SVGAttributes.SVG_MARKER_START), main); setSVGArrow(arrowHead2, main.getAttribute(main.getUsablePrefix()+SVGAttributes.SVG_MARKER_END), main); homogeniseArrows(arrowHead1, arrowHead2); bc.setShowPoints(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_SHOW_PTS)!=null); bc.updateShape(); bc.updateBorders(); if(withTransformation) applyTransformations(elt); } /** * Sets the shape path according to the given SVG path segments. * @param list The SVG path segments list * @since 2.0.0 */ public void setPath(SVGPathSegList list) { if(list==null || list.size()<2 || !(list.firstElement() instanceof SVGPathSegMoveto)) throw new IllegalArgumentException(); BezierCurve bc = (BezierCurve)getShape(); SVGPathSegMoveto m = (SVGPathSegMoveto)list.firstElement(); SVGPathSegCurvetoCubic c; int i=1, size = list.size(); bc.addPoint(new LaTeXDrawPoint2D(m.getX(), m.getY())); if(i>0 && list.elementAt(1) instanceof SVGPathSegCurvetoCubic) {// We set the control point of the first point. c = (SVGPathSegCurvetoCubic)list.elementAt(1); bc.getFirstControlPoint(-1).setLocation(c.getX1(), c.getY1()); } while(i *
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class LTriangleSVGGenerator extends LPolygonSVGGenerator { public LTriangleSVGGenerator(Triangle f) { super(f); } public LTriangleSVGGenerator(SVGGElement elt) { this(elt, true); } /** * Creates a triangle from a latexdraw-SVG element. * @param elt The source element. * @since 2.0.0 */ public LTriangleSVGGenerator(SVGGElement elt, boolean withTransformation) { this(new Triangle(false)); setNumber(elt); SVGElement elt2 = getLaTeXDrawElement(elt, null); Triangle t = (Triangle)getShape(); if(elt==null || elt2==null || !(elt2 instanceof SVGPolygonElement)) throw new IllegalArgumentException(); SVGPolygonElement main = (SVGPolygonElement)elt2; setSVGLatexdrawParameters(elt); setSVGParameters(main); Vector ptsPol = SVGPointsParser.getPoints(elt.getAttribute( elt.getUsablePrefix(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE_URI)+LaTeXDrawNamespace.XML_POINTS)); if(ptsPol==null || ptsPol.size()!=LaTeXDrawRectangle.NB_POINTS_FRAME) throw new IllegalArgumentException(); t.getPoint(0).setLocation(ptsPol.elementAt(0)); t.getPoint(1).setLocation(ptsPol.elementAt(1)); t.getPoint(2).setLocation(ptsPol.elementAt(2)); t.getPoint(3).setLocation(ptsPol.elementAt(3)); t.updateShape(); t.getBorders().updateNSEWDelimitors(); setSVGShadowParameters(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_SHADOW)); setSVGDbleBordersParameters(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_DBLE_BORDERS)); if(withTransformation) applyTransformations(elt); } @Override public SVGElement toSVG(SVGDocument doc) { if(doc==null || doc.getFirstChild().getDefs()==null) return null; Triangle t = (Triangle)getShape(); SVGElement root = new SVGGElement(doc), elt; root.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_TRIANGLE); root.setAttribute(SVGAttributes.SVG_ID, getSVGID()); double gap = getPositionGap()/2.; LaTeXDrawPoint2D pt1 = t.getPoint(0), pt2 = t.getPoint(-1); LaTeXDrawPoint2D p1 = new LaTeXDrawPoint2D((pt1.x+pt2.x)/2., pt1.y); LaTeXDrawPoint2D p2 = new LaTeXDrawPoint2D(pt2.x, pt2.y); LaTeXDrawPoint2D p3 = new LaTeXDrawPoint2D(pt1.x, pt2.y); double cornerGap1 = Figure.getCornerGap(new LaTeXDrawPoint2D(p1.x, p2.y), p1, p2, gap); double cornerGap2 = Figure.getCornerGap(t.getGravityCenter(), p2, p3, gap); if(p2.x>p3.x) cornerGap2*=-1; if(p1.y>p2.y) cornerGap1*=-1; String points = (float)p1.x + "," + (float)(p1.y - cornerGap1) + " " + //$NON-NLS-1$//$NON-NLS-2$ (float)(p2.x - cornerGap2) + "," + (float)(p2.y + (p1.y *
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 09/21/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class SVGShapesFactory { public static SVGElement createSVGElement(Figure f, SVGDocument doc) { SVGElement elt = null; if(f!=null && doc!=null) try { if(f instanceof Square) elt = new LSquareSVGGenerator((Square)f).toSVG(doc); else if(f instanceof LaTeXDrawRectangle) elt = new LRectangleSVGGenerator((LaTeXDrawRectangle)f).toSVG(doc); else if(f instanceof Line) elt = new LLineSVGGenerator((Line)f).toSVG(doc); else if(f instanceof BezierCurve) elt = new LBezierCurveSVGGenerator((BezierCurve)f).toSVG(doc); else if(f instanceof Grid) elt = new LGridSVGGenerator((Grid)f).toSVG(doc); else if(f instanceof Axe) elt = new LAxeSVGGenerator((Axe)f).toSVG(doc); else if(f instanceof Rhombus) elt = new LRhombusSVGGenerator((Rhombus)f).toSVG(doc); else if(f instanceof Triangle) elt = new LTriangleSVGGenerator((Triangle)f).toSVG(doc); else if(f instanceof JoinedLines) elt = new LLinesSVGGenerator((JoinedLines)f).toSVG(doc); else if(f instanceof Dot) elt = new LDotSVGGenerator((Dot)f).toSVG(doc); else if(f instanceof AkinPoints) elt = new LFreeHandSVGGenerator((AkinPoints)f).toSVG(doc); else if(f instanceof Arc) elt = new LArcSVGGenerator((Arc)f).toSVG(doc); else if(f instanceof Circle) elt = new LCircleSVGGenerator((Circle)f).toSVG(doc); else if(f instanceof Ellipse) elt = new LEllipseSVGGenerator((Ellipse)f).toSVG(doc); else if(f instanceof Draw) elt = new LDrawingSVGGenerator((Draw)f).toSVG(doc); else if(f instanceof Picture) elt = new LPictureSVGGenerator((Picture)f).toSVG(doc); else if(f instanceof Text) elt = new LTextSVGGenerator((Text)f).toSVG(doc); else if(f instanceof LaTeXDrawPolygon) elt = new LPolygonSVGGenerator((LaTeXDrawPolygon)f).toSVG(doc); } catch(Exception e) { e.printStackTrace(); } return elt; } } latexdraw-2.0.8+1.orig/latexDraw/generators/svg/LArcSVGGenerator.java0000644000000000000000000002253211347255510022322 0ustar package latexDraw.generators.svg; import java.awt.geom.Arc2D; import java.awt.geom.Point2D; import latexDraw.figures.Arc; import latexDraw.figures.ArrowHead; import latexDraw.figures.LaTeXDrawRectangle; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.elements.*; import latexDraw.parsers.svg.elements.path.*; import latexDraw.psTricks.PSTricksConstants; import latexDraw.util.LaTeXDrawNamespace; import latexDraw.util.LaTeXDrawPoint2D; /** * Defines a SVG generator for an arc.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class LArcSVGGenerator extends LCircleSVGGenerator { public LArcSVGGenerator(Arc f) { super(f); } public LArcSVGGenerator(SVGGElement elt) { this(elt, true); } /** * Creates an arc from a latexdraw-SVG element. * @param elt The source element. * @param withTransformation If true, the SVG transformations will be applied. * @since 2.0.0 */ public LArcSVGGenerator(SVGGElement elt, boolean withTransformation) { this(new Arc(false)); Arc a = (Arc)getShape(); SVGElement elt2 = getLaTeXDrawElement(elt, null); ArrowHead ah1 = a.getArrowHead1(); ArrowHead ah2 = a.getArrowHead2(); if(elt==null || elt2==null || !(elt2 instanceof SVGPathElement)) throw new IllegalArgumentException(); SVGPathElement main = (SVGPathElement)elt2; SVGPathSegList l = main.getSegList(); double sx, sy; LaTeXDrawRectangle borders = a.getBorders(); if(l.size()<2 && !(l.firstElement() instanceof SVGPathSegMoveto) && !(l.elementAt(1) instanceof SVGPathSegArc)) throw new IllegalArgumentException(); sx = ((SVGPathSegMoveto)l.firstElement()).getX(); sy = ((SVGPathSegMoveto)l.firstElement()).getY(); Arc2D arc = ((SVGPathSegArc)l.elementAt(1)).getArc2D(sx, sy); a.setStartAngle(Math.toRadians(arc.getAngleStart())%(Math.PI*2)); a.setEndAngle(Math.toRadians(arc.getAngleExtent()+arc.getAngleStart())%(Math.PI*2)); borders.getPoint(0).setLocation(arc.getMinX(), arc.getMinY()); borders.getPoint(1).setLocation(arc.getMaxX(), arc.getMinY()); borders.getPoint(2).setLocation(arc.getMinX(), arc.getMaxY()); borders.getPoint(3).setLocation(arc.getMaxX(), arc.getMaxY()); if(l.size()>2) if(l.elementAt(2) instanceof SVGPathSegClosePath) a.setType(Arc2D.CHORD); else if(l.size()==4 && l.elementAt(2) instanceof SVGPathSegLineto && l.elementAt(3) instanceof SVGPathSegClosePath) a.setType(Arc2D.PIE); a.setShowPoints(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_SHOW_PTS)!=null); setNumber(elt); setSVGLatexdrawParameters(elt); setSVGParameters(main); setSVGShadowParameters(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_SHADOW)); a.updateCenterStartEndDelimitors(); setSVGArrow(ah1, main.getAttribute(main.getUsablePrefix()+SVGAttributes.SVG_MARKER_START), main); setSVGArrow(ah2, main.getAttribute(main.getUsablePrefix()+SVGAttributes.SVG_MARKER_END), main); homogeniseArrows(ah1, ah2); a.updateShape(); a.updateGravityCenter(); if(withTransformation) applyTransformations(elt); } @Override public SVGElement toSVG(SVGDocument doc) { if(doc==null || doc.getFirstChild().getDefs()==null) return null; Arc arc = (Arc)shape; SVGDefsElement defs = doc.getFirstChild().getDefs(); double rotationAngle = shape.getRotationAngle(); ArrowHead arrowHead1 = arc.getArrowHead1(); ArrowHead arrowHead2 = arc.getArrowHead2(); double startAngle = arc.getStartAngle(); double endAngle = arc.getEndAngle(); int type = arc.getType(); Point2D.Double gravityCenter = shape.getGravityCenter(); SVGElement root = new SVGGElement(doc), elt; int number = shape.getNumber(); root.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_ARC); root.setAttribute(SVGAttributes.SVG_ID, getSVGID()); LaTeXDrawPoint2D start = arc.getStartPoint(false), end = arc.getEndPoint(false); double radius = arc.getRadius(); boolean largeArcFlag; SVGElement arrow1 = null, arrow2 = null, arrow1Shad = null, arrow2Shad = null; String arrow1Name = "arrow1-" + number; //$NON-NLS-1$ String arrow2Name = "arrow2-" + number;//$NON-NLS-1$ String arrow1ShadName = "arrow1Shad-" + number;//$NON-NLS-1$ String arrow2ShadName = "arrow2Shad-" + number;//$NON-NLS-1$ startAngle%=2.*Math.PI; endAngle%=2.*Math.PI; if(!arrowHead1.isWithoutStyle()) { arrow1 = new LArrowHeadSVGGenerator(arrowHead1).toSVG(doc, false); arrow1Shad = new LArrowHeadSVGGenerator(arrowHead1).toSVG(doc, true); arrow1.setAttribute(SVGAttributes.SVG_ID, arrow1Name); defs.appendChild(arrow1); if(shape.hasShadow()) { arrow1Shad.setAttribute(SVGAttributes.SVG_ID, arrow1ShadName); defs.appendChild(arrow1Shad); } } if(!arrowHead2.isWithoutStyle()) { arrow2 = new LArrowHeadSVGGenerator(arrowHead2).toSVG(doc, false); arrow2Shad = new LArrowHeadSVGGenerator(arrowHead2).toSVG(doc, true); arrow2.setAttribute(SVGAttributes.SVG_ID, arrow2Name); defs.appendChild(arrow2); if(shape.hasShadow()) { arrow2Shad.setAttribute(SVGAttributes.SVG_ID, arrow2ShadName); defs.appendChild(arrow2Shad); } } largeArcFlag = startAngle>endAngle ? 2.*Math.PI-startAngle+endAngle>=Math.PI : endAngle-startAngle>Math.PI; SVGPathSegList path = new SVGPathSegList(); path.add(new SVGPathSegMoveto(start.x, start.y, false)); path.add(new SVGPathSegArc(end.x, end.y, radius, radius, 0, largeArcFlag, false, false)); if(type==Arc2D.CHORD) path.add(new SVGPathSegClosePath()); else if(type==Arc2D.PIE) { path.add(new SVGPathSegLineto(gravityCenter.x, gravityCenter.y, false)); path.add(new SVGPathSegClosePath()); } if(shape.hasShadow()) { SVGElement shad = new SVGPathElement(doc); shad.setAttribute(SVGAttributes.SVG_D, path.toString()); setSVGShadowAttributes(shad, true); root.appendChild(shad); if(arrow1Shad!=null) shad.setAttribute(SVGAttributes.SVG_MARKER_START, "url(#" + arrow1ShadName + ")");//$NON-NLS-1$ //$NON-NLS-2$ if(arrow2Shad!=null) shad.setAttribute(SVGAttributes.SVG_MARKER_END, "url(#" + arrow2ShadName + ")");//$NON-NLS-1$ //$NON-NLS-2$ } if(shape.hasShadow() && !shape.getLineStyle().equals(PSTricksConstants.LINE_NONE_STYLE)) {// The background of the borders must be filled is there is a shadow. elt = new SVGPathElement(doc); elt.setAttribute(SVGAttributes.SVG_D, path.toString()); setSVGBorderBackground(elt, root); } elt = new SVGPathElement(doc); elt.setAttribute(SVGAttributes.SVG_D, path.toString()); root.appendChild(elt); setSVGRotationAttribute(root); setSVGAttributes(doc, elt, true); elt.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE +':'+ LaTeXDrawNamespace.XML_ROTATION, String.valueOf(rotationAngle)); if(arrow1!=null) elt.setAttribute(SVGAttributes.SVG_MARKER_START, "url(#" + arrow1Name + ")");//$NON-NLS-1$ //$NON-NLS-2$ if(arrow2!=null) elt.setAttribute(SVGAttributes.SVG_MARKER_END, "url(#" + arrow2Name + ")");//$NON-NLS-1$ //$NON-NLS-2$ if(arc.isShowPoints()) root.appendChild(getShowPointsElement(doc)); return root; } /** * Creates an SVG g element that contains the 'show points' plotting. * @param doc The owner document. * @return The created g element or null if the shape has not the 'show points' option activated. * @since 2.0.0 */ protected SVGGElement getShowPointsElement(SVGDocument doc) { Arc arc = (Arc)shape; if(!arc.isShowPoints() || doc==null) return null; SVGGElement showPts = new SVGGElement(doc); float thickness = arc.getThickness()/2f; showPts.setAttribute(new StringBuffer(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE).append(':').append( LaTeXDrawNamespace.XML_TYPE).toString(), LaTeXDrawNamespace.XML_TYPE_SHOW_PTS); showPts.appendChild(getShowPointsLine(doc, thickness, arc.getLinesColor(), arc.getGravityCenter(), arc.getNonRotatedStartPoint(), arc.getBlackDashLength(), arc.getWhiteDashLength(), false, 1, shape.getDoubleSep())); showPts.appendChild(getShowPointsLine(doc, thickness, arc.getLinesColor(), arc.getGravityCenter(), arc.getNonRotatedEndPoint(), arc.getBlackDashLength(), arc.getWhiteDashLength(), false, 1, shape.getDoubleSep())); return showPts; } } latexdraw-2.0.8+1.orig/latexDraw/generators/svg/LGridSVGGenerator.java0000644000000000000000000004203611347255510022503 0ustar package latexDraw.generators.svg; import java.awt.Color; import java.awt.FontMetrics; import java.awt.geom.Point2D; import java.util.Vector; import latexDraw.figures.Figure; import latexDraw.figures.Grid; import latexDraw.figures.LaTeXDrawRectangle; import latexDraw.parsers.svg.CSSColors; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.SVGTransform; import latexDraw.parsers.svg.elements.*; import latexDraw.parsers.svg.parsers.SVGPointsParser; import latexDraw.util.LaTeXDrawNamespace; import latexDraw.util.LaTeXDrawPoint2D; /** * Defines a SVG generator for a grid.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class LGridSVGGenerator extends LShapeSVGGenerator { public LGridSVGGenerator(Grid f) { super(f); } public LGridSVGGenerator(SVGGElement elt) { this(elt, true); } /** * Creates a grid from a latexdraw-SVG element. * @param elt The source element. * @since 2.0.0 */ public LGridSVGGenerator(SVGGElement elt, boolean withTransformation) { this(new Grid(new LaTeXDrawPoint2D(), false)); if(elt==null) throw new IllegalArgumentException(); String pref = LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':', v; Grid g = (Grid)getShape(); Vector values; g.setLinesColor(elt.getStroke()); values = SVGPointsParser.getPoints(elt.getAttribute(pref+LaTeXDrawNamespace.XML_GRID_END)); if(values!=null && values.size()>0) { g.setGridEndX((int)values.elementAt(0).getX()); g.setGridEndY((int)values.elementAt(0).getY()); } values = SVGPointsParser.getPoints(elt.getAttribute(pref+LaTeXDrawNamespace.XML_GRID_START)); if(values!=null && values.size()>0) { g.setGridStartX((int)values.elementAt(0).getX()); g.setGridStartY((int)values.elementAt(0).getY()); } values = SVGPointsParser.getPoints(elt.getAttribute(pref+LaTeXDrawNamespace.XML_GRID_ORIGIN)); if(values!=null && values.size()>0) { g.setOriginX((int)values.elementAt(0).getX()); g.setOriginY((int)values.elementAt(0).getY()); } v = elt.getAttribute(pref+LaTeXDrawNamespace.XML_GRID_X_SOUTH); if(v!=null) g.setXLabelSouth(Boolean.valueOf(v)); v = elt.getAttribute(pref+LaTeXDrawNamespace.XML_GRID_Y_WEST); if(v!=null) g.setYLabelWest(Boolean.valueOf(v)); SVGElement gridElt = getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_GRID_SUB); if(gridElt!=null) { boolean isGridDotted = false; v = gridElt.getAttribute(pref+LaTeXDrawNamespace.XML_GRID_DOTS); if(v!=null) try { g.setSubGridDots(Double.valueOf(v).intValue()); isGridDotted = g.getSubGridDots()>0; } catch(NumberFormatException e) { /* */ } v = gridElt.getAttribute(pref+LaTeXDrawNamespace.XML_GRID_SUB_DIV); if(v!=null) try{ g.setSubGridDiv(Double.valueOf(v).intValue()); } catch(NumberFormatException e) { /* */ } v = gridElt.getAttribute(pref+LaTeXDrawNamespace.XML_GRID_WIDTH); if(isGridDotted) g.setSubGridColor(CSSColors.getRGBColour(gridElt.getFill())); else g.setSubGridColor(gridElt.getStroke()); if(v==null) { double st = gridElt.getStrokeWidth(); if(!Double.isNaN(st)) g.setSubGridWidth((float)st); } else try{ g.setSubGridWidth(Double.valueOf(v).floatValue()); } catch(NumberFormatException e) { /* */ } } gridElt = getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_GRID); if(gridElt!=null) { boolean isGridDotted = false; v = gridElt.getAttribute(pref+LaTeXDrawNamespace.XML_GRID_DOTS); if(v!=null) try { g.setGridDots(Double.valueOf(v).intValue()); isGridDotted = g.getGridDots()>0; } catch(NumberFormatException e) { /* */ } v = gridElt.getAttribute(pref+LaTeXDrawNamespace.XML_GRID_WIDTH); if(isGridDotted) g.setLinesColor(CSSColors.getRGBColour(gridElt.getFill())); else g.setLinesColor(gridElt.getStroke()); if(v==null) { double st = gridElt.getStrokeWidth(); if(!Double.isNaN(st)) g.setGridWidth((float)st); } else try{ g.setGridWidth(Double.valueOf(v).floatValue()); } catch(NumberFormatException e) { /* */ } } gridElt = getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_TEXT); if(gridElt==null) g.setGridLabelsSize(0); else { v = gridElt.getAttribute(gridElt.getUsablePrefix()+SVGAttributes.SVG_FONT_SIZE); if(v!=null) try { g.setGridLabelsSize(Double.valueOf(v).intValue()); } catch(NumberFormatException e) { /* */ } g.setGridLabelsColor(gridElt.getStroke()); } setNumber(elt); g.updateFonts(); g.updateBorders(g.getFontMetrics()); if(withTransformation) applyTransformations(elt); } protected void createSVGGrid(SVGElement elt, SVGDocument document) { if(elt==null || document==null) return ; Grid grid = (Grid)shape; grid.updateBorders(); String pref = LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'; double unit = grid.getUnit(); Point2D.Double gridEnd = grid.getGridEnd(); Point2D.Double gridStart = grid.getGridStart(); int subGridDiv = grid.getSubGridDiv(); LaTeXDrawRectangle borders = grid.getBorders(); double rotationAngle = grid.getRotationAngle(); double XStep = Figure.PPC*unit, i, j, XSubStep, k, l, m, n; double YStep = XStep, YSubStep; XStep *= gridEnd.x0) { double dotStep = (unit*Figure.PPC)/(subGridDots*subGridDiv); double nbX = (maxX-minX)*subGridDiv; double nbY = (maxY-minY)*subGridDiv; SVGElement subgridDots = new SVGGElement(document), dot; subgridDots.setAttribute(SVGAttributes.SVG_FILL, CSSColors.getColorName(subGridColor, true)); subgridDots.setAttribute(pref+LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_GRID_SUB); subgridDots.setAttribute(pref+LaTeXDrawNamespace.XML_GRID_DOTS, String.valueOf(subGridDots)); subgridDots.setAttribute(pref+LaTeXDrawNamespace.XML_GRID_SUB_DIV, String.valueOf(subGridDots)); subgridDots.setAttribute(pref+LaTeXDrawNamespace.XML_GRID_WIDTH, String.valueOf(subGridWidth)); for(i=0, n=NW.x; i1) { SVGElement subgrids = new SVGGElement(document), line; subgrids.setAttribute(SVGAttributes.SVG_STROKE_WIDTH, String.valueOf(subGridWidth)); subgrids.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.getColorName(subGridColor, true)); subgrids.setAttribute(SVGAttributes.SVG_STROKE_LINECAP, SVGAttributes.SVG_LINECAP_VALUE_ROUND); subgrids.setAttribute(pref+LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_GRID_SUB); subgrids.setAttribute(pref+LaTeXDrawNamespace.XML_GRID_DOTS, String.valueOf(subGridDots)); subgrids.setAttribute(pref+LaTeXDrawNamespace.XML_GRID_SUB_DIV, String.valueOf(subGridDiv)); for(k=minX, i=posX; k0) { double dotStep = (unit*Figure.PPC)/gridDots; SVGElement gridDotsElt = new SVGGElement(document), dot; gridDotsElt.setAttribute(SVGAttributes.SVG_FILL, CSSColors.getColorName(linesColor, true)); gridDotsElt.setAttribute(pref+LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_GRID); gridDotsElt.setAttribute(pref+LaTeXDrawNamespace.XML_GRID_DOTS, String.valueOf(gridDots)); gridDotsElt.setAttribute(pref+LaTeXDrawNamespace.XML_GRID_WIDTH, String.valueOf(gridWidth)); for(k=minX, i=posX; k<=maxX; i+=XStep, k++) for(m=NW.y, n=minY; n0) { // We draw the labels float labelHeight = fontMetrics.getAscent(); float labelWidth = fontMetrics.stringWidth(String.valueOf((int)maxX)); String label; double xorigin = XStep*origin.x; double yorigin = isXLabelSouth ? YStep*origin.y+labelHeight : YStep*origin.y-2; double width=gridWidth/2., tmp = isXLabelSouth ? width : -width; SVGElement texts = new SVGGElement(document), text; texts.setAttribute(SVGAttributes.SVG_FONT_SIZE, String.valueOf(grid.getFont().getSize())); texts.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.getColorName(gridLabelsColor, true)); texts.setAttribute(pref+LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_TEXT); for(i=NW.x + (isYLabelWest ? width+gridLabelsSize/4. : -width-labelWidth-gridLabelsSize/4.), j=minX; j<=maxX; i+=absStep, j++) { text = new SVGTextElement(document); text.setAttribute(SVGAttributes.SVG_X, String.valueOf((int)i)); text.setAttribute(SVGAttributes.SVG_Y, String.valueOf((int)(yorigin+tmp))); text.setTextContent(String.valueOf((int)j)); texts.appendChild(text); } if(isYLabelWest) for(i=NW.y + (isXLabelSouth ? -width-gridLabelsSize/4. : width+labelHeight), j=maxY ; j>=minY; i+=absStep, j--) { label = String.valueOf((int)j); text = new SVGTextElement(document); text.setAttribute(SVGAttributes.SVG_X, String.valueOf((int)(xorigin-fontMetrics.stringWidth(label)-gridLabelsSize/4.-width))); text.setAttribute(SVGAttributes.SVG_Y, String.valueOf((int)i)); text.setTextContent(label); texts.appendChild(text); } else for(i=NW.y + (isXLabelSouth ? -width-gridLabelsSize/4. : width+labelHeight), j=maxY; j>=minY; i+=absStep, j--) { label = String.valueOf((int)j); text = new SVGTextElement(document); text.setAttribute(SVGAttributes.SVG_X, String.valueOf((int)(xorigin+gridLabelsSize/4.+width))); text.setAttribute(SVGAttributes.SVG_Y, String.valueOf((int)i)); text.setTextContent(label); texts.appendChild(text); } elt.appendChild(texts); } if(rotationAngle%(Math.PI*2)!=0) setSVGRotationAttribute(elt); grid.updateBorders(fontMetrics); } @Override public SVGElement toSVG(SVGDocument doc) { if(doc==null) return null; String pref = LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'; SVGElement root = new SVGGElement(doc); Grid g = (Grid)getShape(); root.setAttribute(SVGAttributes.SVG_ID, getSVGID()); root.setAttribute(pref+LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_GRID); root.setAttribute(pref+LaTeXDrawNamespace.XML_GRID_X_SOUTH, String.valueOf(g.isXLabelSouth())); root.setAttribute(pref+LaTeXDrawNamespace.XML_GRID_Y_WEST, String.valueOf(g.isYLabelWest())); root.setAttribute(pref+LaTeXDrawNamespace.XML_GRID_UNIT, String.valueOf(g.getUnit())); root.setAttribute(pref+LaTeXDrawNamespace.XML_GRID_END, g.getGridEnd().x + " " + g.getGridEnd().y);//$NON-NLS-1$ root.setAttribute(pref+LaTeXDrawNamespace.XML_GRID_START, g.getGridStart().x + " " + g.getGridStart().y);//$NON-NLS-1$ root.setAttribute(pref+LaTeXDrawNamespace.XML_GRID_ORIGIN, g.getOrigin().x + " " + g.getOrigin().y);//$NON-NLS-1$ createSVGGrid(root, doc); return root; } } latexdraw-2.0.8+1.orig/latexDraw/generators/svg/LTextSVGGenerator.java0000644000000000000000000001660411347255510022544 0ustar package latexDraw.generators.svg; import java.awt.geom.Point2D; import java.util.Vector; import latexDraw.figures.DrawBorders; import latexDraw.figures.Figure; import latexDraw.figures.FramedBox; import latexDraw.figures.Text; import latexDraw.parsers.latexdraw.LPSTParser; import latexDraw.parsers.svg.CSSColors; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.SVGElements; import latexDraw.parsers.svg.elements.SVGElement; import latexDraw.parsers.svg.elements.SVGGElement; import latexDraw.parsers.svg.elements.SVGTextElement; import latexDraw.psTricks.DviPsColors; import latexDraw.util.LaTeXDrawNamespace; import latexDraw.util.LaTeXDrawPoint2D; import org.w3c.dom.Element; import org.w3c.dom.NodeList; /** * Defines a SVG generator for a text.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class LTextSVGGenerator extends LShapeSVGGenerator { public LTextSVGGenerator(Text f) { super(f); } /** * Creates a text from an SVG text element. * @param elt The source element. * @since 2.0.0 */ public LTextSVGGenerator(SVGTextElement elt) { this(new Text(null, false)); if(elt==null) throw new IllegalArgumentException(); String txt = elt.getText(); if(txt==null || txt.length()==0) throw new IllegalArgumentException("This text is empty."); Text t = (Text)getShape(); t.setText(txt); t.setPosition(new LaTeXDrawPoint2D(elt.getX(), elt.getY())); setTextAttributes(elt); applyTransformations(elt); } public LTextSVGGenerator(SVGGElement elt) { this(elt, true); } /** * Creates a text from a latexdraw-SVG element. * @param elt The source element. * @since 2.0.0 */ public LTextSVGGenerator(SVGGElement elt, boolean withTransformation) { this(new Text(null, false)); if(elt==null) throw new IllegalArgumentException(); double x, y = 0; String v; NodeList nl; String fontFam = elt.getAttribute(SVGAttributes.SVG_FONT_FAMILY); int fontSize; Text t; try { fontSize = Double.valueOf(elt.getAttribute(SVGAttributes.SVG_FONT_SIZE)).intValue(); } catch(NumberFormatException e) { fontSize = Text.DEFAULT_SIZE.getSize(); } setNumber(elt); setTextAttributes(elt); v = elt.getAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE_URI+':'+SVGAttributes.SVG_X); x = v==null ? Double.MAX_VALUE : Double.valueOf(v).doubleValue(); nl = elt.getElementsByTagNameNS(SVGDocument.SVG_NAMESPACE, SVGElements.SVG_TEXT); if(nl.getLength()>0) { SVGTextElement text = (SVGTextElement)nl.item(0); LPSTParser parser = new LPSTParser("\\put(0,0){" + text.getText() + "}"); Vector
shapes; try{ parser.parseFramedBox(); } catch(Exception e) {e.printStackTrace(); } shapes = parser.getShapes(); if(shapes==null || shapes.isEmpty() || !(shapes.firstElement() instanceof Text)) throw new IllegalArgumentException(); t = (Text)shapes.firstElement(); y = text.getY(); x = text.getX()0) t.setSize((int)fontSize); if(fam.length()>0) t.setTextFontByFamily(fam); t.setLinesColor(CSSColors.getRGBColour(e.getFill())); t.setIsItalic(style.equals(SVGAttributes.SVG_FONT_STYLE_ITALIC) || style.equals(SVGAttributes.SVG_FONT_STYLE_OBLIQUE)); t.setIsBold(weight.equals(SVGAttributes.SVG_FONT_WEIGHT_BOLD)); } /** * Creates an SVGTextElement from the given part of text. * @param txt The text to convert in SVG. * @param doc The document to create the text element. * @param position The position of the text. * @return The SVG text element or null if a parameter is null. * @since 2.0.0 */ public SVGTextElement getSVGTextElement(String txt, SVGDocument doc, Point2D position) { if(txt==null || position==null || doc==null) return null; SVGTextElement textElt = new SVGTextElement(doc); textElt.setAttribute(SVGAttributes.SVG_X, String.valueOf(position.getX())); textElt.setAttribute(SVGAttributes.SVG_Y, String.valueOf(position.getY())); textElt.appendChild(doc.createCDATASection(txt)); return textElt; } @Override public SVGElement toSVG(SVGDocument doc) { if(doc == null) return null; SVGElement root = new SVGGElement(doc); Text t = (Text)getShape(); String ltdPref = LaTeXDrawNamespace.LATEXDRAW_NAMESPACE + ':'; root.setAttribute(ltdPref + LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_TEXT); root.setAttribute(SVGAttributes.SVG_ID, getSVGID()); root.setAttribute(SVGAttributes.SVG_FONT_FAMILY, String.valueOf(t.getCurrentFont().getFamily())); root.setAttribute(SVGAttributes.SVG_FILL, CSSColors.getColorName(t.getLinesColor(), true)); root.setAttribute(SVGAttributes.SVG_FONT_SIZE, String.valueOf(t.getCurrentFont().getSize())); root.setAttribute(ltdPref + SVGAttributes.SVG_X, String.valueOf(t.getPosition().x)); if(t.isItalic()) root.setAttribute(SVGAttributes.SVG_FONT_STYLE, SVGAttributes.SVG_FONT_STYLE_ITALIC); if(t.isBold()) root.setAttribute(SVGAttributes.SVG_FONT_WEIGHT, SVGAttributes.SVG_FONT_WEIGHT_BOLD); Element txt = new SVGTextElement(doc); String str = t.getCodePSTricksBody(new DrawBorders(false), Figure.PPC); String cols = DviPsColors.getUserColoursCode(str); if(cols!=null) cols = cols.replace(System.getProperty("line.separator"), ""); txt.setAttribute(SVGAttributes.SVG_X, String.valueOf(t.getPosition().x)); txt.setAttribute(SVGAttributes.SVG_Y, String.valueOf(t.getPosition().y)); txt.appendChild(doc.createCDATASection(cols+str)); root.appendChild(txt); setSVGRotationAttribute(root); return root; } } latexdraw-2.0.8+1.orig/latexDraw/generators/svg/LPictureSVGGenerator.java0000644000000000000000000000752211347255510023232 0ustar package latexDraw.generators.svg; import latexDraw.figures.Picture; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.elements.SVGElement; import latexDraw.parsers.svg.elements.SVGGElement; import latexDraw.parsers.svg.elements.SVGImageElement; import latexDraw.util.LaTeXDrawNamespace; import latexDraw.util.LaTeXDrawPoint2D; /** * Defines a SVG generator for an picture.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class LPictureSVGGenerator extends LShapeSVGGenerator { public LPictureSVGGenerator(Picture f) { super(f); } /** * Creates a picture from a SVGImage element. * @param elt The source element. * @since 2.0.0 */ public LPictureSVGGenerator(SVGImageElement elt) { this(new Picture(true)); if(elt==null) throw new IllegalArgumentException(); Picture p = (Picture)getShape(); p.setPathSource(elt.getURI()); p.setPicture(p.getImage()); if(p.getPicture()==null) throw new IllegalArgumentException(); p.createEPSImage(); p.getPosition().setLocation(elt.getX(), elt.getY()); p.getBorders().setFirstPoint((LaTeXDrawPoint2D)p.getPosition().clone()); p.getBorders().setLastPoint(p.getPosition().x+p.getPicture().getWidth(null), p.getPosition().x+p.getPicture().getHeight(null)); p.getBorders().setIsFilled(true); p.updateShape(); applyTransformations(elt); } public LPictureSVGGenerator(SVGGElement elt) { this(elt, true); } /** * Creates a picture from a latexdraw-SVG element. * @param elt The source element. * @since 2.0.0 */ public LPictureSVGGenerator(SVGGElement elt, boolean withTransformation) { this(new Picture(false)); setNumber(elt); SVGElement elt2 = getLaTeXDrawElement(elt, null); if(elt==null || elt2==null || !(elt2 instanceof SVGImageElement)) throw new IllegalArgumentException(); SVGImageElement main = (SVGImageElement)elt2; Picture p = (Picture)getShape(); p.setPathSource(main.getURI()); p.setPicture(p.getImage()); if(p.getPicture()==null) throw new IllegalArgumentException(); double x = main.getX(); double y = main.getY(); p.createEPSImage(); p.getPosition().setLocation(x, y); p.getBorders().setFirstPoint(new LaTeXDrawPoint2D(x, y)); p.getBorders().setLastPoint(x+p.getPicture().getWidth(null), y+p.getPicture().getHeight(null)); p.getBorders().setIsFilled(true); p.updateShape(); if(withTransformation) applyTransformations(elt); } @Override public SVGElement toSVG(SVGDocument doc) { if(doc == null) return null; SVGElement root = new SVGGElement(doc), img; Picture p = (Picture)getShape(); root.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE + ':' + LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_PICTURE); root.setAttribute(SVGAttributes.SVG_ID, getSVGID()); img = new SVGImageElement(doc, p.getPathSource()); img.setAttribute(SVGAttributes.SVG_X, String.valueOf(p.getPosition().x)); img.setAttribute(SVGAttributes.SVG_Y, String.valueOf(p.getPosition().y)); img.setAttribute(SVGAttributes.SVG_HEIGHT, String.valueOf(p.getPicture().getHeight(null))); img.setAttribute(SVGAttributes.SVG_WIDTH, String.valueOf(p.getPicture().getWidth(null))); root.appendChild(img); return root; } } latexdraw-2.0.8+1.orig/latexDraw/generators/svg/LCircleSVGGenerator.java0000644000000000000000000001166311347255510023021 0ustar package latexDraw.generators.svg; import latexDraw.figures.Circle; import latexDraw.figures.LaTeXDrawRectangle; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.elements.SVGCircleElement; import latexDraw.parsers.svg.elements.SVGElement; import latexDraw.parsers.svg.elements.SVGGElement; import latexDraw.psTricks.PSTricksConstants; import latexDraw.util.LaTeXDrawNamespace; import latexDraw.util.LaTeXDrawPoint2D; /** * Defines a SVG generator for a circle.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class LCircleSVGGenerator extends LEllipseSVGGenerator { public LCircleSVGGenerator(Circle f) { super(f); } /** * Creates a circle from an SVG circle element. * @param elt The source element. * @since 2.0.0 */ public LCircleSVGGenerator(SVGCircleElement elt) { this(new Circle(true)); Circle c = (Circle)getShape(); setSVGParameters(elt); LaTeXDrawRectangle borders = c.getBorders(); borders.getPoint(0).setLocation(elt.getCx()-elt.getR(), elt.getCy()-elt.getR()); borders.getPoint(1).setLocation(elt.getCx()+elt.getR(), elt.getCy()-elt.getR()); borders.getPoint(2).setLocation(elt.getCx()-elt.getR(), elt.getCy()+elt.getR()); borders.getPoint(3).setLocation(elt.getCx()+elt.getR(), elt.getCy()+elt.getR()); c.updateShape(); c.updateGravityCenter(); c.setBordersPosition(PSTricksConstants.BORDERS_MIDDLE); applyTransformations(elt); } public LCircleSVGGenerator(SVGGElement elt) { this(elt, true); } /** * Creates a circle from a latexdraw-SVG element. * @param elt The source element. * @since 2.0.0 */ public LCircleSVGGenerator(SVGGElement elt, boolean withTransformation) { this(new Circle(false)); setNumber(elt); SVGElement elt2 = getLaTeXDrawElement(elt, null); if(elt==null || elt2==null || !(elt2 instanceof SVGCircleElement)) throw new IllegalArgumentException(); SVGCircleElement main = (SVGCircleElement)elt2; LaTeXDrawRectangle borders = shape.getBorders(); setSVGLatexdrawParameters(elt); setSVGParameters(main); double gap = getPositionGap()/2.; borders.getPoint(0).setLocation(main.getCx()-main.getR()+gap, main.getCy()-main.getR()+gap); borders.getPoint(1).setLocation(main.getCx()+main.getR()-gap, main.getCy()-main.getR()+gap); borders.getPoint(2).setLocation(main.getCx()-main.getR()+gap, main.getCy()+main.getR()-gap); borders.getPoint(3).setLocation(main.getCx()+main.getR()-gap, main.getCy()+main.getR()-gap); shape.updateShape(); shape.updateGravityCenter(); setSVGShadowParameters(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_SHADOW)); setSVGDbleBordersParameters(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_DBLE_BORDERS)); if(withTransformation) applyTransformations(elt); } @Override public SVGElement toSVG(SVGDocument doc) { if(doc==null || doc.getFirstChild().getDefs()==null) return null; LaTeXDrawPoint2D nw = shape.getTheNWPoint(); LaTeXDrawPoint2D se = shape.getTheSEPoint(); SVGElement elt, shad = null, dblBord = null; SVGElement root = new SVGGElement(doc); root.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_CIRCLE); root.setAttribute(SVGAttributes.SVG_ID, getSVGID()); double gap = getPositionGap(); if(shape.hasShadow()) { shad = new SVGCircleElement((se.x+nw.x)/2., (se.y+nw.y)/2., (se.x-nw.x+gap)/2., doc); setSVGShadowAttributes(shad, true); root.appendChild(shad); } if(shape.hasShadow() && !shape.getLineStyle().equals(PSTricksConstants.LINE_NONE_STYLE)) {// The background of the borders must be filled is there is a shadow. elt = new SVGCircleElement((se.x+nw.x)/2., (se.y+nw.y)/2., (se.x-nw.x+gap)/2., doc); setSVGBorderBackground(elt, root); } elt = new SVGCircleElement((se.x+nw.x)/2., (se.y+nw.y)/2., (se.x-nw.x+gap)/2., doc); root.appendChild(elt); if(shape.hasDoubleBoundary()) { dblBord = new SVGCircleElement((se.x+nw.x)/2., (se.y+nw.y)/2., (se.x-nw.x+gap)/2., doc); setSVGDoubleBordersAttributes(dblBord); root.appendChild(dblBord); } setSVGAttributes(doc, elt, true); setSVGRotationAttribute(root); return root; } } latexdraw-2.0.8+1.orig/latexDraw/generators/svg/LLinesSVGGenerator.java0000644000000000000000000001774211347255510022676 0ustar package latexDraw.generators.svg; import java.awt.geom.Point2D; import java.util.Vector; import latexDraw.figures.ArrowHead; import latexDraw.figures.JoinedLines; import latexDraw.figures.Line; import latexDraw.figures.properties.Arrowable; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.elements.*; import latexDraw.parsers.svg.elements.path.SVGPathSegLineto; import latexDraw.parsers.svg.elements.path.SVGPathSegList; import latexDraw.psTricks.PSTricksConstants; import latexDraw.util.LaTeXDrawNamespace; import latexDraw.util.LaTeXDrawPoint2D; /** * Defines a SVG generator for some joined lines.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class LLinesSVGGenerator extends LPolygonSVGGenerator { public LLinesSVGGenerator(JoinedLines f) { super(f); } /** * Creates some lines using a SVG path. * @param elt The SVG path. */ public LLinesSVGGenerator(SVGPathElement elt) { super(new JoinedLines(new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(1,1), true)); if(elt==null || !elt.isLines()) throw new IllegalArgumentException(); SVGPathSegList segs = elt.getSegList(); JoinedLines jl = (JoinedLines)getShape(); int i, size; for(i=0, size=segs.size(); i ptsPol = e.getPoints2D(); JoinedLines l = (JoinedLines)getShape(); if(ptsPol==null) throw new IllegalArgumentException(); for(Point2D pt : ptsPol) l.addPoint(new LaTeXDrawPoint2D(pt)); } @Override public SVGElement toSVG(SVGDocument doc) { if(doc==null) return null; JoinedLines jl = (JoinedLines)shape; SVGElement root = new SVGGElement(doc), elt; int number = shape.getNumber(); ArrowHead arrowHead1 = ((Arrowable)shape).getArrowHead1(); ArrowHead arrowHead2 = ((Arrowable)shape).getArrowHead2(); SVGDefsElement defs = doc.getFirstChild().getDefs(); root.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE + ':' + LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_JOINED_LINES); root.setAttribute(SVGAttributes.SVG_ID, getSVGID()); String points = "";//$NON-NLS-1$ SVGElement arrow1 = null, arrow2 = null, arrow1Shad = null, arrow2Shad = null; String arrow1Name = "arrow1-" + number;//$NON-NLS-1$ String arrow2Name = "arrow2-" + number;//$NON-NLS-1$ String arrow1ShadName = "arrow1Shad-" + number;//$NON-NLS-1$ String arrow2ShadName = "arrow2Shad-" + number;//$NON-NLS-1$ if(!arrowHead1.isWithoutStyle()) { arrow1 = new LArrowHeadSVGGenerator(arrowHead1).toSVG(doc, false); arrow1Shad = new LArrowHeadSVGGenerator(arrowHead1).toSVG(doc, true); arrow1.setAttribute(SVGAttributes.SVG_ID, arrow1Name); defs.appendChild(arrow1); if(shape.hasShadow()) { arrow1Shad.setAttribute(SVGAttributes.SVG_ID, arrow1ShadName); defs.appendChild(arrow1Shad); } } if(!arrowHead2.isWithoutStyle()) { arrow2 = new LArrowHeadSVGGenerator(arrowHead2).toSVG(doc, false); arrow2Shad = new LArrowHeadSVGGenerator(arrowHead2).toSVG(doc, true); arrow2.setAttribute(SVGAttributes.SVG_ID, arrow2Name); defs.appendChild(arrow2); if(shape.hasShadow()) { arrow2Shad.setAttribute(SVGAttributes.SVG_ID, arrow2ShadName); defs.appendChild(arrow2Shad); } } for(LaTeXDrawPoint2D pt : jl.getPoints()) points += pt.x + "," + pt.y + " ";//$NON-NLS-1$//$NON-NLS-2$ if(shape.hasShadow()) { SVGElement shad = new SVGPolyLineElement(doc); shad.setAttribute(SVGAttributes.SVG_POINTS, points); setSVGShadowAttributes(shad, false); root.appendChild(shad); if(arrow1Shad != null) shad.setAttribute(SVGAttributes.SVG_MARKER_START, "url(#" + arrow1ShadName + ")");//$NON-NLS-1$ //$NON-NLS-2$ if(arrow2Shad != null) shad.setAttribute(SVGAttributes.SVG_MARKER_END, "url(#" + arrow2ShadName + ")");//$NON-NLS-1$ //$NON-NLS-2$ } if(shape.hasShadow() && !shape.getLineStyle().equals(PSTricksConstants.LINE_NONE_STYLE) && shape.isFilled()) {// The background of the borders must be filled is there is a shadow. elt = new SVGPolyLineElement(doc); elt.setAttribute(SVGAttributes.SVG_POINTS, points); setSVGBorderBackground(elt, root); } elt = new SVGPolyLineElement(doc); elt.setAttribute(SVGAttributes.SVG_POINTS, points); root.appendChild(elt); if(shape.hasDoubleBoundary()) { SVGElement dblBord = new SVGPolyLineElement(doc); dblBord.setAttribute(SVGAttributes.SVG_POINTS, points); setSVGDoubleBordersAttributes(dblBord); root.appendChild(dblBord); } setSVGAttributes(doc, elt, false); elt.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE + ':' + LaTeXDrawNamespace.XML_ROTATION, String.valueOf(shape.getRotationAngle())); if(arrow1 != null) elt.setAttribute(SVGAttributes.SVG_MARKER_START, "url(#" + arrow1Name + ")");//$NON-NLS-1$ //$NON-NLS-2$ if(arrow2 != null) elt.setAttribute(SVGAttributes.SVG_MARKER_END, "url(#" + arrow2Name + ")");//$NON-NLS-1$ //$NON-NLS-2$ return root; } } latexdraw-2.0.8+1.orig/latexDraw/generators/svg/CSSStylesGenerator.java0000644000000000000000000000340211347255510022750 0ustar package latexDraw.generators.svg; import latexDraw.figures.Figure; import latexDraw.parsers.svg.CSSStyleList; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.elements.SVGDefsElement; /** * Defines method to get/set CSS style from/to a LaTeXDraw shape.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 10/24/07
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public abstract class CSSStylesGenerator { /** * Sets the CSS styles of the given list to the given LaTeXDraw shape. * @param f The shape to set. * @param styles The styles to set to the shape. * @param defs The definitions, may be null. * @since 2.0.0 */ public static void setCSSStyles(Figure f, CSSStyleList styles, SVGDefsElement defs) { if(f==null || styles==null) return ; LShapeSVGGenerator.setThickness(f, styles.getCSSValue(SVGAttributes.SVG_STROKE_WIDTH), styles.getCSSValue(SVGAttributes.SVG_STROKE)); LShapeSVGGenerator.setLineColour(f, styles.getCSSValue(SVGAttributes.SVG_STROKE)); LShapeSVGGenerator.setDashedDotted(f, styles.getCSSValue(SVGAttributes.SVG_STROKE_DASHARRAY), styles.getCSSValue(SVGAttributes.SVG_STROKE_LINECAP)); LShapeSVGGenerator.setFill(f, styles.getCSSValue(SVGAttributes.SVG_FILL), defs); } } latexdraw-2.0.8+1.orig/latexDraw/generators/svg/LFreeHandSVGGenerator.java0000644000000000000000000001726411347255510023277 0ustar package latexDraw.generators.svg; import java.awt.geom.Point2D; import java.util.Vector; import latexDraw.figures.AkinPoints; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.elements.SVGElement; import latexDraw.parsers.svg.elements.SVGGElement; import latexDraw.parsers.svg.elements.SVGPathElement; import latexDraw.parsers.svg.elements.path.*; import latexDraw.parsers.svg.parsers.SVGPointsParser; import latexDraw.psTricks.PSTricksConstants; import latexDraw.util.LaTeXDrawNamespace; import latexDraw.util.LaTeXDrawPoint2D; /** * Defines a SVG generator for a free hand drawing.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class LFreeHandSVGGenerator extends LPolygonSVGGenerator { public LFreeHandSVGGenerator(AkinPoints f) { super(f); } public LFreeHandSVGGenerator(SVGGElement elt) { this(elt, true); } public LFreeHandSVGGenerator(SVGGElement elt, boolean withTransformation) { this(new AkinPoints(new LaTeXDrawPoint2D(), false)); AkinPoints ak = (AkinPoints)getShape(); SVGElement elt2 = getLaTeXDrawElement(elt, null); setNumber(elt); if(elt==null || elt2==null || !(elt2 instanceof SVGPathElement)) throw new IllegalArgumentException(); try{ ak.setType(Double.valueOf(elt.getAttribute( LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_PATH_TYPE)).intValue()); } catch(NumberFormatException e) { throw new IllegalArgumentException("Invalid path type."); }//$NON-NLS-1$ SVGPathElement main = (SVGPathElement)elt2; String v = elt.getAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_INTERVAL); if(v!=null) try{ ak.setInterval(Double.valueOf(v).intValue()); } catch(NumberFormatException e) { /* */ } Vector pts; pts = SVGPointsParser.getPoints(elt.getAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_POINTS)); if(pts==null) throw new IllegalArgumentException("No attribute pts."); for(Point2D pt : pts) ak.addPoint(new LaTeXDrawPoint2D(pt)); ak.removePointAt(0); setSVGLatexdrawParameters(elt); setSVGParameters(main); ak.updateShape(); ak.updateBorders(); setSVGShadowParameters(getLaTeXDrawElement(elt, LaTeXDrawNamespace.XML_TYPE_SHADOW)); v = elt.getAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_ROTATION); if(v!=null) try{ ak.setRotationAngle(Double.valueOf(v)); } catch(NumberFormatException e) { /* */ } v = elt.getAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_PATH_TYPE); if(v!=null) try{ ak.setType(Double.valueOf(v).intValue()); } catch(NumberFormatException e) { /* */ } if(withTransformation) applyTransformations(elt); } /** * @return The path of the shape. * @since 2.0.0 */ public SVGPathSegList getPath() { SVGPathSegList path = new SVGPathSegList(); AkinPoints ak = (AkinPoints)shape; int i, size = ak.getNbPoints(); int interval = ak.getInterval(); if(ak.getType()==AkinPoints.TYPE_CURVES) { float prevx = (float)ak.getPoint(-1).x; float prevy = (float)ak.getPoint(-1).y; float curx = (float)ak.getPoint(0).x; float cury = (float)ak.getPoint(0).y; float midx = (curx + prevx) / 2.0f; float midy = (cury + prevy) / 2.0f; path.add(new SVGPathSegMoveto(curx, cury, false)); if(size>interval) { prevx = curx; prevy = cury; curx = (float)ak.getPoint(interval).x; cury = (float)ak.getPoint(interval).y; midx = (curx + prevx) / 2.0f; midy = (cury + prevy) / 2.0f; path.add(new SVGPathSegLineto(midx, midy, false)); } for(i=interval*2; i *
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 11/11/07
* @author Arnaud BLOUIN
* @version 0.1
*/ public class LDotSVGGenerator extends LShapeSVGGenerator { public LDotSVGGenerator(Dot f) { super(f); } public LDotSVGGenerator(SVGGElement elt) { this(elt, true); } /** * Creates a dot from a latexdraw-SVG element. * @param elt The source element. * @since 2.0.0 */ public LDotSVGGenerator(SVGGElement elt, boolean withTransformation) { this(new Dot(false)); if(elt==null) throw new IllegalArgumentException(); Dot d = (Dot)getShape(); String v = elt.getAttribute(elt.getUsablePrefix(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE_URI)+LaTeXDrawNamespace.XML_SIZE); SVGElement main = getLaTeXDrawElement(elt, null); try { d.setCurrentStyle(elt.getAttribute(elt.getUsablePrefix(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE_URI)+LaTeXDrawNamespace.XML_DOT_SHAPE)); } catch(IllegalArgumentException e) { /* */ } if(v!=null) try { d.setWidth(Double.valueOf(v).floatValue()); } catch(NumberFormatException e) { /* */ } v = elt.getAttribute(elt.getUsablePrefix(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE_URI)+LaTeXDrawNamespace.XML_POSITION); Vector pos = SVGPointsParser.getPoints(v); if(pos!=null && !pos.isEmpty()) d.setCenter(new LaTeXDrawPoint2D(pos.firstElement())); setSVGLatexdrawParameters(elt); setSVGParameters(main); setNumber(elt); if(withTransformation) applyTransformations(elt); if(!d.canBeFilled()) d.setLinesColor(CSSColors.getRGBColour(main.getFill())); } @Override public SVGElement toSVG(SVGDocument doc) { if(doc==null) return null; Dot d = (Dot)shape; float width = d.getWidth(); Point2D.Double center = d.getCenter(); String currentStyle = d.getCurrentStyle(); SVGElement root = new SVGGElement(doc), dot; LaTeXDrawPoint2D NW = new LaTeXDrawPoint2D(center.x-width/2., center.y-width/2.); LaTeXDrawPoint2D SE = new LaTeXDrawPoint2D(center.x+width/2., center.y+width/2.); float dec = width/Dot.THICKNESS_o_STYLE_FACTOR; root.setAttribute(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_TYPE, LaTeXDrawNamespace.XML_TYPE_DOT); root.setAttribute(SVGAttributes.SVG_ID, getSVGID()); if(currentStyle.equals(PSTricksConstants.DOT_STYLE)) { dot = new SVGCircleElement(doc); dot.setAttribute(SVGAttributes.SVG_FILL, CSSColors.getColorName(d.getLinesColor(), true)); dot.setAttribute(SVGAttributes.SVG_CX, String.valueOf(NW.x+width/2.)); dot.setAttribute(SVGAttributes.SVG_CY, String.valueOf(NW.y+width/2.)); dot.setAttribute(SVGAttributes.SVG_R, String.valueOf(width/2.)); } else if(currentStyle.equals(PSTricksConstants.O_STYLE) || currentStyle.equals(PSTricksConstants.OPLUS_STYLE) || currentStyle.equals(PSTricksConstants.OTIMES_STYLE)) { float t; dot = new SVGGElement(doc); SVGElement o = new SVGCircleElement(doc); if(currentStyle.equals(PSTricksConstants.O_STYLE)) dec = (float)(width*(0.1/3.6))*2; else dec = (float)(width*(0.1/2.6))*2; if(currentStyle.equals(PSTricksConstants.OPLUS_STYLE) || currentStyle.equals(PSTricksConstants.OTIMES_STYLE)) dot.setAttribute(SVGAttributes.SVG_FILL, SVGAttributes.SVG_VALUE_NONE); else dot.setAttribute(SVGAttributes.SVG_FILL, CSSColors.getColorName(d.isFilled()? d.getInteriorColor() : Color.WHITE, true)); dot.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.getColorName(d.getLinesColor(), true)); dot.setAttribute(SVGAttributes.SVG_STROKE_WIDTH, String.valueOf(dec)); o.setAttribute(SVGAttributes.SVG_CX, String.valueOf(NW.x+width/2.)); o.setAttribute(SVGAttributes.SVG_CY, String.valueOf(NW.y+width/2.)); o.setAttribute(SVGAttributes.SVG_R, String.valueOf(width/2.-dec/2.)); dot.appendChild(o); if(currentStyle.equals(PSTricksConstants.OPLUS_STYLE)) { SVGElement p1 = new SVGLineElement(doc); SVGElement p2 = new SVGLineElement(doc); t = dec*2; p1.setAttribute(SVGAttributes.SVG_X1, String.valueOf((NW.x+SE.x)/2.)); p1.setAttribute(SVGAttributes.SVG_Y1, String.valueOf(NW.y+t)); p1.setAttribute(SVGAttributes.SVG_X2, String.valueOf((NW.x+SE.x)/2.)); p1.setAttribute(SVGAttributes.SVG_Y2, String.valueOf(SE.y-t)); p2.setAttribute(SVGAttributes.SVG_X1, String.valueOf(NW.x+t)); p2.setAttribute(SVGAttributes.SVG_Y1, String.valueOf((NW.y+SE.y)/2.)); p2.setAttribute(SVGAttributes.SVG_X2, String.valueOf(SE.x-t)); p2.setAttribute(SVGAttributes.SVG_Y2, String.valueOf((NW.y+SE.y)/2.)); dot.appendChild(p1); dot.appendChild(p2); } else if(currentStyle.equals(PSTricksConstants.OTIMES_STYLE)) { SVGElement p1 = new SVGLineElement(doc); SVGElement p2 = new SVGLineElement(doc); t = dec*2+Figure.DEFAULT_THICKNESS*2; p1.setAttribute(SVGAttributes.SVG_X1, String.valueOf(NW.x+t)); p1.setAttribute(SVGAttributes.SVG_Y1, String.valueOf(NW.y+t)); p1.setAttribute(SVGAttributes.SVG_X2, String.valueOf(SE.x-t)); p1.setAttribute(SVGAttributes.SVG_Y2, String.valueOf(SE.y-t)); p2.setAttribute(SVGAttributes.SVG_X1, String.valueOf(SE.x-t)); p2.setAttribute(SVGAttributes.SVG_Y1, String.valueOf(NW.y+t)); p2.setAttribute(SVGAttributes.SVG_X2, String.valueOf(NW.x+t)); p2.setAttribute(SVGAttributes.SVG_Y2, String.valueOf(SE.y-t)); dot.appendChild(p1); dot.appendChild(p2); } } else if(currentStyle.equals(PSTricksConstants.BAR_STYLE)) { dot = new SVGLineElement(doc); dot.setAttribute(SVGAttributes.SVG_STROKE_LINECAP, SVGAttributes.SVG_LINECAP_VALUE_SQUARE); dot.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.getColorName(d.getLinesColor(), true)); dot.setAttribute(SVGAttributes.SVG_STROKE_WIDTH, String.valueOf(d.getBarThickness())); dot.setAttribute(SVGAttributes.SVG_X1, String.valueOf((NW.x+SE.x)/2.)); dot.setAttribute(SVGAttributes.SVG_Y1, String.valueOf(NW.y+d.getBarThickness()/2.)); dot.setAttribute(SVGAttributes.SVG_X2, String.valueOf((NW.x+SE.x)/2.)); dot.setAttribute(SVGAttributes.SVG_Y2, String.valueOf(SE.y+d.getBarGap())); } else if(currentStyle.equals(PSTricksConstants.PLUS_STYLE)) { dot = new SVGGElement(doc); SVGElement p1 = new SVGLineElement(doc); SVGElement p2 = new SVGLineElement(doc); double plusGap = d.getPlusGap(); dot.setAttribute(SVGAttributes.SVG_STROKE_LINECAP, SVGAttributes.SVG_LINECAP_VALUE_SQUARE); dot.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.getColorName(d.getLinesColor(), true)); dot.setAttribute(SVGAttributes.SVG_STROKE_WIDTH, String.valueOf(width/Dot.PLUS_COEFF_WIDTH)); p1.setAttribute(SVGAttributes.SVG_X1, String.valueOf((NW.x+SE.x)/2.)); p1.setAttribute(SVGAttributes.SVG_Y1, String.valueOf(NW.y-plusGap)); p1.setAttribute(SVGAttributes.SVG_X2, String.valueOf((NW.x+SE.x)/2.)); p1.setAttribute(SVGAttributes.SVG_Y2, String.valueOf(SE.y+plusGap)); p2.setAttribute(SVGAttributes.SVG_X1, String.valueOf(NW.x-plusGap)); p2.setAttribute(SVGAttributes.SVG_Y1, String.valueOf((NW.y+SE.y)/2.)); p2.setAttribute(SVGAttributes.SVG_X2, String.valueOf(SE.x+plusGap)); p2.setAttribute(SVGAttributes.SVG_Y2, String.valueOf((NW.y+SE.y)/2.)); dot.appendChild(p1); dot.appendChild(p2); } else if(currentStyle.equals(PSTricksConstants.SQUARE_STYLE) || currentStyle.equals(PSTricksConstants.FSQUARE_STYLE)) { Color c = d.getLinesColor(); if(currentStyle.equals(PSTricksConstants.SQUARE_STYLE)) if(d.isFilled()) c = d.getInteriorColor(); else c = Color.WHITE; dec = (float)(width*(0.1/4))*2; dot = new SVGRectElement(doc); dot.setAttribute(SVG_X, String.valueOf(NW.x+dec*1.5)); dot.setAttribute(SVG_Y, String.valueOf(NW.y+dec*1.5)); dot.setAttribute(SVG_WIDTH, String.valueOf(Math.abs(NW.x-SE.x)-3*dec)); dot.setAttribute(SVG_HEIGHT, String.valueOf(Math.abs(NW.y - SE.y)-3*dec)); dot.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.getColorName(d.getLinesColor(), true)); dot.setAttribute(SVGAttributes.SVG_FILL, CSSColors.getColorName(c, true)); dot.setAttribute(SVGAttributes.SVG_STROKE_WIDTH, String.valueOf(dec)); } else if(currentStyle.equals(PSTricksConstants.TRIANGLE_STYLE) || currentStyle.equals(PSTricksConstants.FTRIANGLE_STYLE) || currentStyle.equals(PSTricksConstants.DIAMOND_STYLE) || currentStyle.equals(PSTricksConstants.FDIAMOND_STYLE) || currentStyle.equals(PSTricksConstants.PENTAGON_STYLE) || currentStyle.equals(PSTricksConstants.FPENTAGON_STYLE)) { Polygon p; Color c = d.getLinesColor(); String path; dot = new SVGPathElement(doc); if(currentStyle.equals(PSTricksConstants.TRIANGLE_STYLE) || currentStyle.equals(PSTricksConstants.FTRIANGLE_STYLE)) p = d.createTriangle(); else if(currentStyle.equals(PSTricksConstants.PENTAGON_STYLE) || currentStyle.equals(PSTricksConstants.FPENTAGON_STYLE)) p = d.createPentagon(); else p = d.createDiamond(); if(currentStyle.equals(PSTricksConstants.TRIANGLE_STYLE) || currentStyle.equals(PSTricksConstants.DIAMOND_STYLE) || currentStyle.equals(PSTricksConstants.PENTAGON_STYLE)) if(d.isFilled()) c = d.getInteriorColor(); else c = Color.WHITE; if(p.npoints==0) return null; int[] xp = p.xpoints; int[] yp = p.ypoints; //TODO use path path = "M " + xp[0] + " " + yp[0]; //$NON-NLS-1$ //$NON-NLS-2$ for(int i = 1; i *
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 06/03/07
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public abstract class AbstractCodeEditorPane extends JEditorPane implements MouseListener { private static final long serialVersionUID = 1L; protected CodePanel codePanel; /** Corresponds to the beginning of the code of the figure: \begin{pspicture}... */ protected String begin; /** Corresponds to the body of the code : the definitions of the figures (lines, dots, ...)*/ protected String body; /** Defines the start of the code. */ protected String beginCodeTag; /** Corresponds to the end of the code of the figure. */ protected String endCodeTag; /** * The constructor. * @param codePanel The associated codePanel. */ public AbstractCodeEditorPane(CodePanel codePanel) { super(); setEditable(false); addMouseListener(this); setDragEnabled(true); this.codePanel = codePanel; begin = "";//$NON-NLS-1$ body = "";//$NON-NLS-1$ setBeginCodeTag(); setEndCodeTag(); } /** * Update the buttons managing the copy of the code. * @since 1.9 */ public void updateButtonsCopy() { String text = getSelectedText(); boolean enable = text!=null && !text.equals("");//$NON-NLS-1$ codePanel.getButtonCopySel().setEnabled(enable); } public void mouseClicked(MouseEvent e) { updateButtonsCopy(); } public void mousePressed(MouseEvent e) { /* No code required */ } public void mouseReleased(MouseEvent e) { updateButtonsCopy(); } public void mouseEntered(MouseEvent e) { /* No code required */ } public void mouseExited(MouseEvent e) { /* No code required */ } @Override protected void processFocusEvent(FocusEvent e) { super.processFocusEvent(e); if(e.getID()==FocusEvent.FOCUS_LOST) { Object o = e.getOppositeComponent(); if(!(o instanceof JButton && ((JButton)o).getActionCommand().equals(LABEL_COPY_SELECTION_CODE))) { select(0, 0); codePanel.getButtonCopySel().setEnabled(false); } } } /** * @param withLatexParams True: latex parameters (position, caption, etc.) are added * to the code. * @param withComments True: comments are added to the code. * @return The generated code. * @since 2.0.3 */ public abstract String getCode(boolean withLatexParams, boolean withComments); /** * Update the text of the panel. */ public void updateText() { setText(getCode(true, true)); } /** * Set the beginning of the code generated. * @param SW The top right point. * @param NE The bottom left point. * @param pixPerCm The definition level of the drawing. * @param origin The origin point of the system of coordinates. */ public abstract void setStart(LaTeXDrawPoint2D SW, LaTeXDrawPoint2D NE, float pixPerCm, LaTeXDrawPoint2D origin); /** * Set the body (between the beginning and the end) of the code. * @param code The new code. */ public void setBody(String code) { body = code; updateText(); } /** * Empty the panel. */ public void setEmpty() { body=""; //$NON-NLS-1$ setText("");//$NON-NLS-1$ } /** * Set the tag which will be defined the start of the code. * @since 2.0.0 */ protected abstract void setBeginCodeTag(); /** * Set the tag which will be defined the end of the code. * @since 2.0.0 */ protected abstract void setEndCodeTag(); } latexdraw-2.0.8+1.orig/latexDraw/ui/codeEditorPane/PSTricksEditorPane.java0000644000000000000000000001320611347255510023257 0ustar package latexDraw.ui.codeEditorPane; import static latexDraw.ui.CodePanel.TOKEN_HORI_CENTER_END; import static latexDraw.ui.CodePanel.TOKEN_HORI_CENTER_START; import java.util.Calendar; import latexDraw.ui.CodePanel; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.util.LaTeXDrawPoint2D; import latexDraw.util.LaTeXDrawResources; /** * Defines the model of a code editor pane used which display PSTricks code.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 06/03/07
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class PSTricksEditorPane extends AbstractCodeEditorPane { private static final long serialVersionUID = 1L; /** The line code which include the package pstricks */ public static final String PACKAGE_PSTRICKS = "% \\usepackage[usenames,dvipsnames]{pstricks}\n% \\usepackage{epsfig}\n% \\usepackage{pst-grad} % For gradients\n% \\usepackage{pst-plot} % For axes\n"; //$NON-NLS-1$ /** * The constructor. * @param codePanel The associated codePanel. */ public PSTricksEditorPane(CodePanel codePanel) { super(codePanel); } @Override public String getCode(boolean withLatexParams, boolean withComments) { String seol = System.getProperty("line.separator");//$NON-NLS-1$ String code; if(body==null || body=="") //$NON-NLS-1$ code = withComments ? codePanel.getComments() : "" ; else { boolean addEntete; StringBuffer entete = new StringBuffer(); StringBuffer end = new StringBuffer(); String packages = codePanel.getDocumentPackages(); if(withLatexParams && (!codePanel.getCaption().equals("") || !codePanel.getLabel().equals("") || //$NON-NLS-1$ //$NON-NLS-2$ !codePanel.getPositionVertToken().equals(""))) //$NON-NLS-1$ { addEntete = true; entete.append("\\begin{figure}"); //$NON-NLS-1$ if(!codePanel.getPositionVertToken().equals("")) //$NON-NLS-1$ entete.append("[").append(codePanel.getPositionVertToken()).append("]"); //$NON-NLS-1$ //$NON-NLS-2$ entete.append(seol); } else addEntete = false; if(addEntete) { if(!codePanel.getLabel().equals("")) //$NON-NLS-1$ { String lab = codePanel.getLabel().replaceAll("%", ""); //$NON-NLS-1$ //$NON-NLS-2$ lab = lab.replaceAll("\\\\", ""); //$NON-NLS-1$ //$NON-NLS-2$ end.append("\\label{").append(lab).append("}").append(seol); //$NON-NLS-1$ //$NON-NLS-2$ } if(!codePanel.getCaption().equals("")) //$NON-NLS-1$ end.append("\\caption{").append(codePanel.getCaption()).append("}").append(seol);//$NON-NLS-1$//$NON-NLS-2$ end.append("\\end{figure}").append(seol); //$NON-NLS-1$ } if(withLatexParams && codePanel.getPositionHoriToken().equals(TOKEN_HORI_CENTER_START)) end.insert(0, TOKEN_HORI_CENTER_END); StringBuffer madeBy = new StringBuffer(); madeBy.append("% Generated with "); //$NON-NLS-1$ madeBy.append(LaTeXDrawResources.LABEL_APP); madeBy.append(" "); //$NON-NLS-1$ madeBy.append(LaTeXDrawFrame.VERSION); madeBy.append(seol); madeBy.append("% "); //$NON-NLS-1$ madeBy.append(Calendar.getInstance().getTime().toString()); madeBy.append(seol); StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(body); stringBuffer.append(endCodeTag); stringBuffer.append("}\n"); //$NON-NLS-1$ stringBuffer.append(end); String text = stringBuffer.toString(); // We despecialise all the "%". text = text.replaceAll("%", "\\\\%"); //$NON-NLS-1$ //$NON-NLS-2$ text = text.replaceAll(seol+"\\\\%", seol+"\\%"); //$NON-NLS-1$ //$NON-NLS-2$ stringBuffer = new StringBuffer(); stringBuffer.append(madeBy); stringBuffer.append(codePanel.getComments()); stringBuffer.append(PACKAGE_PSTRICKS); if(packages!=null && packages.length()>0) { packages = "% User packages:" + seol + packages; packages = packages.replace(seol, seol+"%"); stringBuffer.append(packages).append(seol); } stringBuffer.append(entete); if(withLatexParams) stringBuffer.append(codePanel.getPositionHoriToken()); stringBuffer.append(begin); stringBuffer.append(text); code = stringBuffer.toString(); } return code; } @Override protected void setBeginCodeTag() { beginCodeTag = "\\begin{pspicture}"; //$NON-NLS-1$ } @Override protected void setEndCodeTag() { endCodeTag = "\\end{pspicture} \n"; //$NON-NLS-1$ } @Override public void setStart(LaTeXDrawPoint2D SW, LaTeXDrawPoint2D NE, float pixPerCm, LaTeXDrawPoint2D origin) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("\\scalebox{1} % Change this value to rescale the drawing.\n{\n"); //$NON-NLS-1$ stringBuffer.append(beginCodeTag); stringBuffer.append("("); //$NON-NLS-1$ stringBuffer.append(0); stringBuffer.append(","); //$NON-NLS-1$ stringBuffer.append((float)((origin.y-SW.y)/pixPerCm)); stringBuffer.append(")"); //$NON-NLS-1$ stringBuffer.append("("); //$NON-NLS-1$ stringBuffer.append((float)((NE.x-origin.x)/pixPerCm)); stringBuffer.append(","); //$NON-NLS-1$ stringBuffer.append((float)((origin.y-NE.y)/pixPerCm)); stringBuffer.append(")\n"); //$NON-NLS-1$ begin = stringBuffer.toString(); updateText(); } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/0000755000000000000000000000000011347255510015307 5ustar latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/PreferencesFrame.java0000644000000000000000000015430111347255510021372 0ustar package latexDraw.ui.dialog; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.*; import java.util.Vector; import javax.swing.*; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import latexDraw.lang.LaTeXDrawLang; import latexDraw.ui.CodePanel; import latexDraw.ui.DrawContainer; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.ui.components.Delimitor; import latexDraw.ui.components.MagneticGrid; import latexDraw.ui.components.XScale; import latexDraw.util.*; import org.w3c.dom.*; import com.sun.org.apache.xml.internal.serialize.OutputFormat; import com.sun.org.apache.xml.internal.serialize.XMLSerializer; /** * This frame allows the user to set his preferences concerning the program and its components.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 09/14/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class PreferencesFrame extends JFrame implements ActionListener { private static final long serialVersionUID = 1L; /** The current drawing */ private DrawContainer draw; /** The main frame of the program */ private LaTeXDrawFrame mainFrame; /** The file chooser of paths selection */ private JFileChooser fileChooser; /** The title of the frame */ public static final String TITLE = LaTeXDrawLang.getDialogFrameString("PreferencesFrame.Pref"); //$NON-NLS-1$ /** The name of the button ok */ public static final String NAME_BUTTON_OK = "BUTTON_OK";//$NON-NLS-1$ /** The name of the button cancel */ public static final String NAME_BUTTON_CANCEL = "BUTTON_CANCEL";//$NON-NLS-1$ /** The name of the button default */ public static final String NAME_BUTTON_DEFAULT = "BUTTON_DEFAULT";//$NON-NLS-1$ /** The label of the X-Scale checkBox */ public static final String LABEL_CHECKBOX_XSCALE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.38"); //$NON-NLS-1$ /** The label of the Y-Scale checkBox */ public static final String LABEL_CHECKBOX_YSCALE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.39"); //$NON-NLS-1$ /** The label of the Grid checkBox */ public static final String LABEL_CHECKBOX_GRID = LaTeXDrawLang.getDialogFrameString("PreferencesFrame.grid"); //$NON-NLS-1$ /** The label of the codePanel checkBox */ public static final String LABEL_CHECKBOX_CODEPANEL = LaTeXDrawLang.getDialogFrameString("PreferencesFrame.codePanel"); //$NON-NLS-1$ /** The label of the anti-aliasing checkBox */ public static final String LABEL_CHECKBOX_ANTIALIASING = LaTeXDrawLang.getDialogFrameString("PreferencesFrame.antiAl"); //$NON-NLS-1$ /** The label of the rendering checkBox */ public static final String LABEL_CHECKBOX_RENDERING = LaTeXDrawLang.getDialogFrameString("PreferencesFrame.rendQ"); //$NON-NLS-1$ /** The label of the colour rendering checkBox */ public static final String LABEL_CHECKBOX_COLORRENDER = LaTeXDrawLang.getDialogFrameString("PreferencesFrame.colRendQ"); //$NON-NLS-1$ /** The label of the alpha-interpolation checkBox */ public static final String LABEL_CHECKBOX_ALPHAINTER = LaTeXDrawLang.getDialogFrameString("PreferencesFrame.AlphaQ"); //$NON-NLS-1$ /** The label of the drawBorders checkBox */ public static final String LABEL_CHECKBOX_DISPLAY_BORDERS = LaTeXDrawLang.getDialogFrameString("PreferencesFrame.bordersDraw"); //$NON-NLS-1$ /** The name of the button which allows to select a directory for the commands open/save.*/ public static final String NAME_BUTTON_OPENFIELD = "BUTTON_OPENFIELD";//$NON-NLS-1$ /** The name of the button which allows t select a directory for the exportation of the code. */ public static final String NAME_BUTTON_EXPORTFIELD = "BUTTON_EXPORTFIELD";//$NON-NLS-1$ public static final String NAME_BUTTON_TEX_EDITOR = "BUTTON_TEX_EDITOR";//$NON-NLS-1$ public static final String NAME_BUTTON_LATEX_DISTRIB = "BUTTON_LATEX";//$NON-NLS-1$ /** The label of the check-box code auto-update */ public static final String LABEL_AUTOUPDATE = LaTeXDrawLang.getDialogFrameString("PreferencesFrame.codeAuto"); //$NON-NLS-1$ /** The label of the Check-box checkNewVersion */ public static final String LABEL_CHECK_VERSION = LaTeXDrawLang.getDialogFrameString("PreferencesFrame.newVers"); //$NON-NLS-1$ public static final String LABEL_LANG = LaTeXDrawLang.getDialogFrameString("PreferencesFrame.lge"); //$NON-NLS-1$ public static final int NB_RECENT_FILES = 5; /** The label of the preferences */ public static final String LABEL_PREFERENCES = "TEX_DRAW_PREFERENCES";//$NON-NLS-1$ /** This check-box allows to set if antialiasing must be used */ private JCheckBox antialiasingCheckBox; /** This check-box allows to set if rendering quality must be used */ private JCheckBox renderingCheckBox; /** This check-box allows to set if colour rendering quality must be used */ private JCheckBox colorRenderCheckBox; /** This check-box allows to set if the user wants to display the grid */ private JCheckBox displayGridCB; private JCheckBox magneticGridCB; /** This check-box allows to set if the user wants to display the X-scale */ private JCheckBox displayXScaleCB; /** This check-box allows to set if the user wants to display the Y-scale */ private JCheckBox displayYScaleCB; /** Allows to update or not in real time the PSTricks code */ private JCheckBox codeAutoUpdateCB; /** Allows the set if the program must check new version on start up */ private JCheckBox checkNewVersion; /** This check-box allows to set if the user wants to display the codepanel */ private JCheckBox displayCodePanelCB; /** This check-box allows to set if the user wants to the borders * of the drawing */ private JCheckBox displayBordersCB; /** This check-box allows to set if alpha-interpolation must be used */ private JCheckBox alpaInterCheckBox; /** This textField allows to set the default directories for open/save * actions */ private JTextField pathOpenField; /** This textField allows to set the default directories for exportations * actions */ private JTextField pathExportField; private JTextField pathTexEditorField; private JTextField pathLatexDistribField; private JTextArea latexIncludes; /** Allows to set the unit of length by default */ private JComboBox unitChoice; private JComboBox themeList; private JComboBox langList; private JRadioButton classicGridRB; private JRadioButton persoGridRB; private JSpinner persoGridGapField; private JSpinner nbRecentFilesField; private Vector recentFilesName; /** Define if the main frame is maximised or not. @since 2.0.0 */ private boolean isFrameMaximized; /** Define the size of the main frame. @since 2.0.0 */ private Dimension frameSize; /** Define the position of the main frame. @since 2.0.0 */ private Point framePosition; /** Define the position of the divider. @since 2.0.0 */ private double dividerPosition = 1; /* These attributes are used to be able to restore the fields value when cancelling modifications. */ private int curNbRecentFiles; private int curGridGap; private boolean curClassicGrid; private String curLang; private String curTheme; private String curUnit; private String curTexPath; private String curExportPath; private String curOpenPath; private boolean curAlpha; private boolean curDisplayBord; private boolean curDisplayCode; private boolean curCheckVers; private boolean curAutoUpdte; private boolean curYScale; private boolean curXScale; private boolean curDisplayGrid; private boolean curMagnetic; private boolean curColRender; private boolean curRendering; private boolean curAntiAlias; private String curLatexDistrib; private String curLatexIncludes; /** * The constructor using a frame. * @param d The current drawing. * @param frame The LaTeXDrawFrame (used to set the preferences). */ public PreferencesFrame(DrawContainer d, LaTeXDrawFrame frame) { try { draw = d; mainFrame = frame; Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); setIconImage(LaTeXDrawResources.propertiesIcon.getImage()); setTitle(TITLE); setLocation(dim.width*1/3, dim.height*1/4); recentFilesName = new Vector(); JTabbedPane tabbedPane = new JTabbedPane(); JPanel pButton = new JPanel(new BorderLayout()); JPanel pGeneral = new JPanel(new BorderLayout()); tabbedPane.add(LaTeXDrawLang.getDialogFrameString("PreferencesFrame.general"), createGeneralPanel()); //$NON-NLS-1$ tabbedPane.add(LaTeXDrawLang.getDialogFrameString("PreferencesFrame.folders"), createFoldersPanel()); //$NON-NLS-1$ tabbedPane.add(LaTeXDrawLang.getDialogFrameString("PreferencesFrame.quality"), createQualityPanel()); //$NON-NLS-1$ tabbedPane.add(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.90"), createDisplayPanel()); //$NON-NLS-1$ tabbedPane.add(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.92"), createCodePanel()); //$NON-NLS-1$ tabbedPane.add(LaTeXDrawLang.getDialogFrameString("PreferencesFrame.grid"), createGridPanel()); //$NON-NLS-1$ tabbedPane.add("LaTeX", createLatexPanel()); //$NON-NLS-1$ JButton buttonOk = new JButton(AbstractParametersFrame.LABEL_OK), buttonCancel = new JButton(AbstractParametersFrame.LABEL_CANCEL), buttonDefault = new JButton(AbstractParametersFrame.LABEL_DEFAULT); GridLayout gridButton = new GridLayout(1, 3); buttonOk.setActionCommand(NAME_BUTTON_OK); buttonCancel.setActionCommand(NAME_BUTTON_CANCEL); buttonDefault.setActionCommand(NAME_BUTTON_DEFAULT); buttonOk.addActionListener(this); buttonCancel.addActionListener(this); buttonDefault.addActionListener(this); pButton.setLayout(gridButton); pButton.add(buttonOk); pButton.add(buttonCancel); pButton.add(buttonDefault); pGeneral.add(tabbedPane, BorderLayout.CENTER); pGeneral.add(pButton, BorderLayout.SOUTH); getContentPane().add(pGeneral); setSize(480, 310);//Fixes #1562954 setVisible(false); readXMLPreferences(); fileChooser = new JFileChooser(); fileChooser.setApproveButtonText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.171")); //$NON-NLS-1$ fileChooser.setDialogTitle(LaTeXDrawLang.getDialogFrameString("PreferencesFrame.selectFolder")); //$NON-NLS-1$ fileChooser.setMultiSelectionEnabled(false); }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } /** * Allows to create the panel which allows the user to set the general preferences of latexdraw. * @return The panel. */ private JPanel createGeneralPanel() { JPanel pGeneral = new JPanel(); JPanel pLang = new JPanel(); JPanel pEditor = new JPanel(); JPanel pRecent = new JPanel(); JPanel pTheme = new JPanel(); pTheme.setLayout(new BoxLayout(pTheme, BoxLayout.X_AXIS)); pEditor.setLayout(new BoxLayout(pEditor, BoxLayout.X_AXIS)); pLang.setLayout(new GridLayout(1, 2)); pGeneral.setLayout(new GridLayout(6, 1)); pRecent.setLayout(new FlowLayout(FlowLayout.LEFT)); JButton bChooseEditor = new JButton(LaTeXDrawResources.openIcon); bChooseEditor.addActionListener(this); bChooseEditor.setActionCommand(NAME_BUTTON_TEX_EDITOR); pathTexEditorField = new JTextField(); pathTexEditorField.setMaximumSize(new Dimension(300,30)); checkNewVersion = new JCheckBox(LABEL_CHECK_VERSION); langList = new JComboBox(); langList.addItem(LaTeXDrawLang.LANG_DE); langList.addItem(LaTeXDrawLang.LANG_EN); langList.addItem(LaTeXDrawLang.LANG_EN_US); langList.addItem(LaTeXDrawLang.LANG_ES); langList.addItem(LaTeXDrawLang.LANG_FR); langList.addItem(LaTeXDrawLang.LANG_IT); langList.addItem(LaTeXDrawLang.LANG_PL); langList.addItem(LaTeXDrawLang.LANG_TR); langList.setSelectedItem(LaTeXDrawLang.getlangCurrent()); langList.setPreferredSize(new Dimension(75, 30)); langList.setSize(new Dimension(75, 30)); langList.setMaximumSize(new Dimension(75, 30)); langList.setMinimumSize(new Dimension(75, 30)); SpinnerModel model = new SpinnerNumberModel(NB_RECENT_FILES,0,20,1); nbRecentFilesField = new JSpinner(model); nbRecentFilesField.setEditor(new JSpinner.NumberEditor(nbRecentFilesField, "0"));//$NON-NLS-1$ nbRecentFilesField.setPreferredSize(new Dimension(45,25)); nbRecentFilesField.setMaximumSize(new Dimension(45,25)); pRecent.add(new JLabel(LaTeXDrawLang.getString1_9("PreferencesFrame.0"))); //$NON-NLS-1$ pRecent.add(nbRecentFilesField); UIManager.LookAndFeelInfo[] info = UIManager.getInstalledLookAndFeels(); String[] nameThemes = new String[info.length]; for(int i=0; iInclude in this list the latex packages you regularly use in your drawing, e.g. :
\\usepackage[frenchb]{babel}
\\usepackage[utf8]{inputenc}"); JScrollPane scrollPane = new JScrollPane(latexIncludes); pLatexDistrib.add(pathLatexDistribField); pLatexDistrib.add(bChooseLatex); pLatex.add(label); pLatex.add(pLatexDistrib); pLatex.add(scrollPane); return pLatex; } /** * Allows to create the panel which allows the user to set the preferences about displayable elements. * @return The panel. */ private JPanel createDisplayPanel() { JPanel pDisplay = new JPanel(new GridLayout(5, 1)); displayCodePanelCB = new JCheckBox(LABEL_CHECKBOX_CODEPANEL); displayXScaleCB = new JCheckBox(LABEL_CHECKBOX_XSCALE); displayYScaleCB = new JCheckBox(LABEL_CHECKBOX_YSCALE); displayBordersCB = new JCheckBox(LABEL_CHECKBOX_DISPLAY_BORDERS); unitChoice = new JComboBox(); unitChoice.addItem(XScale.LABEL_CM); unitChoice.addItem(XScale.LABEL_INCH); pDisplay.add(displayCodePanelCB); pDisplay.add(displayXScaleCB); pDisplay.add(displayYScaleCB); pDisplay.add(displayBordersCB); pDisplay.add(unitChoice); return pDisplay; } /** * Allows to create the panel which allows the user to set preferences about paths. * @return The panel. */ private JPanel createFoldersPanel() { JPanel pFolders = new JPanel(new GridBagLayout()); pathExportField = new JTextField(); pathOpenField = new JTextField(); JButton bExport = new JButton(LaTeXDrawResources.openIcon); JButton bOpen = new JButton(LaTeXDrawResources.openIcon); bExport.setActionCommand(NAME_BUTTON_EXPORTFIELD); bOpen.setActionCommand(NAME_BUTTON_OPENFIELD); bExport.addActionListener(this); bOpen.addActionListener(this); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 6; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.HORIZONTAL; constraint.anchor = GridBagConstraints.EAST; pFolders.add(new JLabel(LaTeXDrawLang.getDialogFrameString("PreferencesFrame.defOpenSave")), constraint); //$NON-NLS-1$ constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 1; constraint.gridwidth = 6; constraint.gridheight = 1; constraint.weightx = 10; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.HORIZONTAL; constraint.anchor = GridBagConstraints.EAST; pFolders.add(pathOpenField, constraint); constraint = new GridBagConstraints(); constraint.gridx = 6; constraint.gridy = 1; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.EAST; pFolders.add(bOpen, constraint); constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 2; constraint.gridwidth = 6; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.HORIZONTAL; constraint.anchor = GridBagConstraints.EAST; pFolders.add(new JLabel(LaTeXDrawLang.getDialogFrameString("PreferencesFrame.defFold")), constraint); //$NON-NLS-1$ constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 3; constraint.gridwidth = 6; constraint.gridheight = 1; constraint.weightx = 10; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.HORIZONTAL; constraint.anchor = GridBagConstraints.EAST; pFolders.add(pathExportField, constraint); constraint = new GridBagConstraints(); constraint.gridx = 6; constraint.gridy = 3; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.EAST; pFolders.add(bExport, constraint); return pFolders; } /** * Allows to create the panel which allows the user to set preferences about the rendering. * @return The panel. */ private JPanel createQualityPanel() { JPanel pQuality = new JPanel(new GridLayout(4, 1)); antialiasingCheckBox = new JCheckBox(LABEL_CHECKBOX_ANTIALIASING); renderingCheckBox = new JCheckBox(LABEL_CHECKBOX_RENDERING); colorRenderCheckBox = new JCheckBox(LABEL_CHECKBOX_COLORRENDER); alpaInterCheckBox = new JCheckBox(LABEL_CHECKBOX_ALPHAINTER); pQuality.add(antialiasingCheckBox); pQuality.add(renderingCheckBox); pQuality.add(colorRenderCheckBox); pQuality.add(alpaInterCheckBox); return pQuality; } public void actionPerformed(ActionEvent e) { Object o = e.getSource(); try { if(o instanceof JButton) { String label = ((JButton)o).getActionCommand(); if(label==null) return ; if(label.equals(NAME_BUTTON_CANCEL)) { super.setVisible(false); nbRecentFilesField.setValue(curNbRecentFiles); persoGridGapField.setValue(curGridGap); classicGridRB.setSelected(curClassicGrid); langList.setSelectedItem(curLang); themeList.setSelectedItem(curTheme); unitChoice.setSelectedItem(curUnit); pathTexEditorField.setText(curTexPath); pathExportField.setText(curExportPath); pathOpenField.setText(curOpenPath); alpaInterCheckBox.setSelected(curAlpha); antialiasingCheckBox.setSelected(curAntiAlias); renderingCheckBox.setSelected(curRendering); colorRenderCheckBox.setSelected(curColRender); magneticGridCB.setSelected(curMagnetic); displayGridCB.setSelected(curDisplayGrid); displayXScaleCB.setSelected(curXScale); displayYScaleCB.setSelected(curYScale); codeAutoUpdateCB.setSelected(curAutoUpdte); checkNewVersion.setSelected(curCheckVers); displayCodePanelCB.setSelected(curDisplayCode); displayBordersCB.setSelected(curDisplayBord); latexIncludes.setText(curLatexIncludes); pathLatexDistribField.setText(curLatexDistrib); return; } if(label.equals(NAME_BUTTON_DEFAULT)) { setDefaultValues(); return; } if(label.equals(NAME_BUTTON_OK)) { writeXMLPreferences(true); mainFrame.setLatexIncludes(latexIncludes.getText()); mainFrame.setPathDistribLatex(pathLatexDistribField.getText()); mainFrame.setPathTexEditor(pathTexEditorField.getText()); mainFrame.setPathExport(pathExportField.getText()); mainFrame.setPathOpen(pathOpenField.getText()); draw.setAntiAliasingValue(antialiasingCheckBox.isSelected()); draw.setRenderingcolorValue(colorRenderCheckBox.isSelected()); draw.setAlphaInterValue(alpaInterCheckBox.isSelected()); draw.setRenderingValue(renderingCheckBox.isSelected()); setVisible(false); return; } if(label.equals(NAME_BUTTON_TEX_EDITOR)) { fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.showSaveDialog(this); File file = fileChooser.getSelectedFile(); if(file!=null && file.exists() && file.isFile()) pathTexEditorField.setText(file.getPath()); return; } if(label.equals(NAME_BUTTON_LATEX_DISTRIB)) { fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.showSaveDialog(this); File file = fileChooser.getSelectedFile(); if(file!=null && file.exists() && file.isFile()) pathLatexDistribField.setText(file.getPath()); return; } if(label.equals(NAME_BUTTON_OPENFIELD)) { fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setCurrentDirectory(new File(pathOpenField.getText())); fileChooser.showSaveDialog(this); File file = fileChooser.getSelectedFile(); if(file!=null) if(file.isDirectory()) pathOpenField.setText(file.getPath()); return; } if(label.equals(NAME_BUTTON_EXPORTFIELD)) { fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setCurrentDirectory(new File(pathExportField.getText())); fileChooser.showSaveDialog(this); File file = fileChooser.getSelectedFile(); if(file!=null) if(file.isDirectory()) pathExportField.setText(file.getPath()); return; } } // if(o instanceof JButton) }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } /** * Reads the preferences of latexdraw defined in XML. * @since 2.0.0 */ public void readXMLPreferences() { File xml = new File(LaTeXDrawPath.PATH_PREFERENCES_XML_FILE); File prefOld = new File(LaTeXDrawPath.PATH_PREFERENCES_FILE_OLD); setDefaultValues(); if(!xml.exists()) { if(prefOld.exists()) { readPreferences(); writeXMLPreferences(false); } else updateDrawPreferences(); return ; } prefOld.delete(); try { DocumentBuilderFactory fabrique = DocumentBuilderFactory.newInstance(); DocumentBuilder constructeur = fabrique.newDocumentBuilder(); Document document = constructeur.parse(xml); Node n = document.getFirstChild(), n2; NodeList nl; int size, i; String name, content; isFrameMaximized = true; if(n==null || !n.getNodeName().equals(LaTeXDrawNamespace.XML_ROOT_PREFERENCES)) throw new NullPointerException(); nl = n.getChildNodes(); for(i=0, size=nl.getLength(); i=0 ? divLoc/mainFrame.getWidth() : 1.)); root.appendChild(elt); elt = document.createElement(LaTeXDrawNamespace.XML_DELIMITOR_OPACITY); elt.setTextContent(String.valueOf(Delimitor.getOpacity())); root.appendChild(elt); } of = new OutputFormat(document); of.setIndenting(true); xmls = new XMLSerializer(fos, of); xmls.serialize(root); fos.close(); if(withNotification) mainFrame.setStatusBarText(LaTeXDrawLang.getDialogFrameString("PreferencesFrame.prefSaved")); //$NON-NLS-1$ }catch(Exception ex) { ex.printStackTrace(); } } /** * Allows to read the file of preferences.
*/ public void readPreferences() { try // We save the project in the file { InputStream is = new FileInputStream(new File(LaTeXDrawPath.PATH_PREFERENCES_FILE_OLD)); ObjectInputStream in = new ObjectInputStream(is); Object o = in.readObject(); if(!(o instanceof String) || !((String)o).equals(LABEL_PREFERENCES)) throw new LaTeXDrawException(LaTeXDrawException.NOT_TEXDRAW_FILE); o = in.readObject(); renderingCheckBox.setSelected(in.readBoolean()); colorRenderCheckBox.setSelected(in.readBoolean()); alpaInterCheckBox.setSelected(in.readBoolean()); antialiasingCheckBox.setSelected(in.readBoolean()); pathExportField.setText((String)in.readObject()); pathOpenField.setText((String)in.readObject()); displayCodePanelCB.setSelected(in.readBoolean()); displayGridCB.setSelected(in.readBoolean()); displayXScaleCB.setSelected(in.readBoolean()); displayYScaleCB.setSelected(in.readBoolean()); displayBordersCB.setSelected(in.readBoolean()); unitChoice.setSelectedItem(in.readObject()); codeAutoUpdateCB.setSelected(in.readBoolean()); if(((String)o).compareTo(LaTeXDrawFrame.VERSION)>0) { checkNewVersion.setSelected(LaTeXDrawFrame.DEFAULT_CHECK_VERSION); langList.setSelectedItem(LaTeXDrawLang.getlangCurrent()); } else { checkNewVersion.setSelected(in.readBoolean()); langList.setSelectedItem(in.readObject()); } if(((String)o).compareTo("1.8")>=0) //$NON-NLS-1$ { magneticGridCB.setSelected(in.readBoolean()); boolean classic = in.readBoolean(); classicGridRB.setSelected(classic); persoGridRB.setSelected(!classic); persoGridGapField.setValue(in.readInt()); pathTexEditorField.setText((String)in.readObject()); } else { persoGridRB.setSelected(MagneticGrid.DEFAULT_TYPE==MagneticGrid.TYPE_PERSONAL); classicGridRB.setSelected(MagneticGrid.DEFAULT_TYPE!=MagneticGrid.TYPE_PERSONAL); persoGridGapField.setValue(MagneticGrid.DEFAULT_PERSONAL_GRID_GAP); magneticGridCB.setSelected(false); } if(((String)o).compareTo("1.9")>=0) //$NON-NLS-1$ { nbRecentFilesField.setValue(in.readInt()); int nb = in.readInt(), i; recentFilesName.clear(); for(i=0; i=0)//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$ laf = "GTK+";//$NON-NLS-1$ else laf = "Windows";//$NON-NLS-1$ while(i < info.length && again) if(laf.compareTo(info[i].getName()) == 0) again = false; else i++; if(again) { String basic = UIManager.getCrossPlatformLookAndFeelClassName(); i = 0; while(i < info.length && again) if(basic.compareTo(info[i].getClassName()) == 0) again = false; else i++; if(!again) themeList.setSelectedItem(info[i].getName()); } else themeList.setSelectedItem(laf); isFrameMaximized = false; frameSize = new Dimension(); frameSize.height = 3*Toolkit.getDefaultToolkit().getScreenSize().height/2; frameSize.width = 3*Toolkit.getDefaultToolkit().getScreenSize().width/2; framePosition = new Point(); dividerPosition = 0.8; } /** * Allows to update the concerned attributes of the drawPanel. */ public void updateDrawPreferences() { try { boolean isMod = draw.isModified(); draw.setAntiAliasingValue(antialiasingCheckBox.isSelected()); draw.setRenderingcolorValue(colorRenderCheckBox.isSelected()); draw.setAlphaInterValue(alpaInterCheckBox.isSelected()); draw.setRenderingValue(renderingCheckBox.isSelected()); mainFrame.setLatexIncludes(latexIncludes.getText()); mainFrame.setPathDistribLatex(pathLatexDistribField.getText()); mainFrame.setMagneticGrid(magneticGridCB.isSelected()); mainFrame.setPathExport(pathExportField.getText()); mainFrame.setPathOpen(pathOpenField.getText()); mainFrame.displayCodePanel(displayCodePanelCB.isSelected()); mainFrame.setFormerIsInAutoUpdate(codeAutoUpdateCB.isSelected()); mainFrame.setIsInAutoUpdate(codeAutoUpdateCB.isSelected()); if(LaTeXDrawFrame.WITH_UPDATE) mainFrame.setCheckNewVersion(checkNewVersion.isSelected()); mainFrame.displayGrid(displayGridCB.isSelected(), classicGridRB.isSelected()); mainFrame.setPersoGridGap(Integer.valueOf(persoGridGapField.getValue().toString()).intValue()); mainFrame.displayXScale(displayXScaleCB.isSelected()); mainFrame.displayYScale(displayYScaleCB.isSelected()); mainFrame.displayBorders(displayBordersCB.isSelected()); mainFrame.setUnitForPixelsPerCm(unitChoice.getSelectedItem().toString()); mainFrame.setPathTexEditor(pathTexEditorField.getText()); String lAfName = themeList.getSelectedItem().toString(); UIManager.LookAndFeelInfo[] info = UIManager.getInstalledLookAndFeels(); boolean again = true; int i=0; while(i getRecentFilesName() { return recentFilesName; } /** * Adds a recent file. * @since 1.9 * @param absolutePath The absolute path of the file to add. */ public void addRecentFile(String absolutePath) { int i = recentFilesName.indexOf(absolutePath); int max = Float.valueOf(nbRecentFilesField.getValue().toString()).intValue(); if(i!=-1) recentFilesName.remove(i); while(recentFilesName.size()>=max) recentFilesName.remove(max-1); recentFilesName.add(0, absolutePath); writeXMLPreferences(false); } /** * @since 1.9 * @return True if the code is in auto update mode. */ public boolean isCodeInAutoUpdate() { return codeAutoUpdateCB.isSelected(); } /** * Allows to get the theme of the program.
* @since 1.9 * @return The class of the theme. */ public static String readTheme() { String laf=null; try { File xml = new File(LaTeXDrawPath.PATH_PREFERENCES_XML_FILE); if(xml.exists()) { DocumentBuilderFactory fabrique = DocumentBuilderFactory.newInstance(); DocumentBuilder constructeur = fabrique.newDocumentBuilder(); Document document = constructeur.parse(xml); Node n = document.getFirstChild(); NodeList nl; boolean again = true; if(n==null || !n.getNodeName().equals(LaTeXDrawNamespace.XML_ROOT_PREFERENCES)) throw new NullPointerException(); nl = n.getChildNodes(); for(int i=0, size=nl.getLength() ; i=0)//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$ return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; //$NON-NLS-1$ if(System.getProperty("os.name").toLowerCase().contains("win"))//$NON-NLS-1$//$NON-NLS-2$ return "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";//$NON-NLS-1$ return UIManager.getCrossPlatformLookAndFeelClassName(); } UIManager.LookAndFeelInfo[] info = UIManager.getInstalledLookAndFeels(); boolean again = true; int i=0; while(i *
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 04/08/07
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class ExportDialog extends JFileChooser { private static final long serialVersionUID = 1L; /** The slide that allows to change the compression rate. */ protected JSlider compressionSlide; /** The panel that contains the compression slider and its label. */ protected JPanel pCompression; public static final String NAME_SLIDE_COMPRESSION = "slideComp";//$NON-NLS-1$ public static final int DEFAULT_COMPRESSION_RATE = 20; public ExportDialog(String path) { super(path); setApproveButtonText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.171")); //$NON-NLS-1$ setAcceptAllFileFilterUsed(true); setMultiSelectionEnabled(false); setFileSelectionMode(JFileChooser.FILES_ONLY); setDragEnabled(true); pCompression = new JPanel(); pCompression.setLayout(new BoxLayout(pCompression, BoxLayout.X_AXIS)); pCompression.add(new JLabel(LaTeXDrawLang.getDialogFrameString("ExportDialog.0"))); //$NON-NLS-1$ compressionSlide = new JSlider(0, 100, DEFAULT_COMPRESSION_RATE); compressionSlide.setName(NAME_SLIDE_COMPRESSION); compressionSlide.setMajorTickSpacing(10); compressionSlide.setPaintTicks(true); compressionSlide.setPaintLabels(true); pCompression.add(compressionSlide); JPanel p = new JPanel(); Component c = getComponent(getComponentCount()-1); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.add(pCompression); p.add(c); add(p, BorderLayout.SOUTH); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2); } @Override public int showDialog(Component parent, String approveButtonText) throws HeadlessException { pCompression.setVisible(accept(new File("test.jpg")));//$NON-NLS-1$ return super.showDialog(parent, approveButtonText); } /** * @return The compression rate if the filter accepts jpg files, else return -1. * @since 1.9.2 */ public int getCompressionRate() { if(accept(new File("test.jpg")))//$NON-NLS-1$ return compressionSlide.getValue(); return -1; } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/PictureChooser.java0000644000000000000000000001742611347255510021122 0ustar package latexDraw.ui.dialog; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; import javax.swing.*; import javax.swing.border.BevelBorder; import latexDraw.filters.*; import latexDraw.lang.LaTeXDrawLang; /** * This class defines a file chooser for pictures; some elements come from * the JavaSwing.jar demo code source Copyright (c) 2004 Sun Microsystems.
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 04/11/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class PictureChooser extends JDialog implements ActionListener { private static final long serialVersionUID = 1L; /** The file chooser. */ JFileChooser fileChooser; /** The command name of the button cancel. */ public static final String CMD_CANCEL = "PICTURE_CHOSSER_CANCEL";//$NON-NLS-1$ /** The command name of the button ok. */ public static final String CMD_OK = "PICTURE_CHOOSER_OK";//$NON-NLS-1$ /** * The constructor. * @param parent The parent of the frame. */ public PictureChooser(JFrame parent, String msg, boolean preview, String title) { super(parent, title, true); fileChooser = new JFileChooser(); // add preview accessory if(preview) fileChooser.setAccessory(new FilePreviewer(fileChooser)); // remove the approve/cancel buttons fileChooser.setControlButtonsAreShown(false); fileChooser.setApproveButtonText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.199")); //$NON-NLS-1$ fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.addChoosableFileFilter(new BMPFilter()); fileChooser.addChoosableFileFilter(new PNGFilter()); fileChooser.addChoosableFileFilter(new PPMFilter()); fileChooser.addChoosableFileFilter(new GIFFilter()); fileChooser.addChoosableFileFilter(new JPGFilter()); fileChooser.setAcceptAllFileFilterUsed(true); // make custom controls JPanel custom = new JPanel(); custom.setLayout(new BoxLayout(custom, BoxLayout.Y_AXIS)); JLabel description = new JLabel(msg); description.setAlignmentX(Component.CENTER_ALIGNMENT); custom.add(description); custom.add(fileChooser); JPanel buttonsPanel = new JPanel(); buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.X_AXIS)); JButton cancel = new JButton(AbstractParametersFrame.LABEL_CANCEL); cancel.setActionCommand(CMD_CANCEL); cancel.addActionListener(this); JButton ok = new JButton(AbstractParametersFrame.LABEL_OK); ok.setActionCommand(CMD_OK); ok.addActionListener(this); buttonsPanel.add(ok); buttonsPanel.add(cancel); custom.add(buttonsPanel); // show the filechooser setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().add(custom, BorderLayout.CENTER); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); pack(); setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2); } /** * Allows to get the file chooser. * @return The file chooser. */ public synchronized JFileChooser getFileChooser() { return fileChooser; } /** * Allows to display the frame. * @return The selected file. */ public File displayFrame() { super.setVisible(true); return fileChooser.getSelectedFile(); } public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if(o instanceof JButton) { String cmd = ((JButton)o).getActionCommand(); if(cmd==null) return; if(cmd.equals(CMD_CANCEL)) { fileChooser.setSelectedFile(null); dispose(); return ; } if(cmd.equals(CMD_OK)) { dispose(); return ; } } } } /** * 1.14 04/07/26 * Copyright (c) 2004 Sun Microsystems, Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * -Redistribution of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * -Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of Sun Microsystems, Inc. or the names of contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE * AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY * OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * * You acknowledge that this software is not designed, licensed or intended * for use in the design, construction, operation or maintenance of any * nuclear facility. */ class FilePreviewer extends JComponent implements PropertyChangeListener { private static final long serialVersionUID = 1L; ImageIcon thumbnail = null; public FilePreviewer(JFileChooser fc) { setPreferredSize(new Dimension(100, 50)); fc.addPropertyChangeListener(this); setBorder(new BevelBorder(BevelBorder.LOWERED)); } public void loadImage(File f) { if(f == null) thumbnail = null; else { ImageIcon tmpIcon = new ImageIcon(f.getPath()); if(tmpIcon.getIconWidth() > 90) thumbnail = new ImageIcon(tmpIcon.getImage().getScaledInstance(90, -1, Image.SCALE_DEFAULT)); else thumbnail = tmpIcon; } } public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if(prop == JFileChooser.SELECTED_FILE_CHANGED_PROPERTY) { if(isShowing()) { loadImage((File) e.getNewValue()); repaint(); } } } @Override public void paint(Graphics g) { super.paint(g); if(thumbnail != null) { int x = getWidth()/2 - thumbnail.getIconWidth()/2; int y = getHeight()/2 - thumbnail.getIconHeight()/2; if(y < 0) y = 0; if(x < 5) x = 5; thumbnail.paintIcon(this, g, x, y); } } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/InsertPSTricksCodeFrame.java0000644000000000000000000001042211347255510022606 0ustar package latexDraw.ui.dialog; import java.awt.Component; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; import latexDraw.lang.LaTeXDrawLang; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.ui.components.CopyPasteMenu; import latexDraw.util.LaTeXDrawResources; /** * This frame allows to user to insert several figures from PSTricks code into the current drawing (by using the TeX parser). *
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/31/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class InsertPSTricksCodeFrame extends JFrame implements ActionListener { private static final long serialVersionUID = 1L; /** The label of the button "ok" of the frame */ public static final String LABEL_FRAME_INSERT_OK = "INSERT_CODE_OK";//$NON-NLS-1$ /** The label of the button "Cancel" of the frame */ public static final String LABEL_FRAME_INSERT_CANCEL = "INSERT_CODE_CANCEL";//$NON-NLS-1$ /** The main frame of the program */ private LaTeXDrawFrame mainFrame; /** This editor allows to put the PSTricks code */ private JEditorPane editor; protected CopyPasteMenu copyMenu; /** * The constructor. * @param frame The parent frame. */ public InsertPSTricksCodeFrame(LaTeXDrawFrame frame) { super(LaTeXDrawLang.getString1_6("InsertPSTricksCodeFrame.0")); //$NON-NLS-1$ try { mainFrame = frame; setIconImage(LaTeXDrawResources.insertPSTricksIcon.getImage()); JPanel pButton = new JPanel(); JButton buttonOk = new JButton(AbstractParametersFrame.LABEL_OK), buttonCancel = new JButton(AbstractParametersFrame.LABEL_CANCEL); editor = new JEditorPane(); copyMenu = new CopyPasteMenu(editor); buttonOk.setActionCommand(LABEL_FRAME_INSERT_OK); buttonCancel.setActionCommand(LABEL_FRAME_INSERT_CANCEL); buttonOk.addActionListener(this); buttonCancel.addActionListener(this); // The scroller of the editor JScrollPane scrollPane = new JScrollPane(editor); scrollPane.setMinimumSize(new Dimension(450, 250)); scrollPane.setPreferredSize(new Dimension(450, 250)); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); JLabel label = new JLabel(LaTeXDrawLang.getString1_6("LaTeXDrawFrame.16"), SwingConstants.CENTER); //$NON-NLS-1$ label.setAlignmentX(Component.CENTER_ALIGNMENT); editor.setText("");//$NON-NLS-1$ pButton.add(buttonOk); pButton.add(buttonCancel); pButton.setPreferredSize(new Dimension(280, 40)); pButton.setMaximumSize(new Dimension(280, 40)); getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS)); getContentPane().add(label); getContentPane().add(scrollPane); getContentPane().add(pButton); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); pack(); setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2); setVisible(false); editor.addMouseListener(copyMenu); }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if(o instanceof JButton) { String label = ((JButton)o).getActionCommand(); if(label == LABEL_FRAME_INSERT_CANCEL) { super.setVisible(false); return ; } if(label == LABEL_FRAME_INSERT_OK) { mainFrame.insertPSTricksCode(editor.getText()); super.setVisible(false); return; } } } @Override public void setVisible(boolean e) { if(e) editor.setText("");//$NON-NLS-1$ super.setVisible(e); } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/ParametersAkinPointsFrame.java0000644000000000000000000002114511347255510023233 0ustar package latexDraw.ui.dialog; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ItemEvent; import javax.swing.*; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import latexDraw.figures.AkinPoints; import latexDraw.figures.Figure; import latexDraw.lang.LaTeXDrawLang; import latexDraw.ui.DrawPanel; import latexDraw.ui.components.LaTeXDrawComboBox; /** * This class defines the frame which allows to change the parameters of polygons.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class ParametersAkinPointsFrame extends AbstractParametersFrame { private static final long serialVersionUID = 1L; public static final String NAME_INTERVAL_FIELD = "interField";//$NON-NLS-1$ public static final String ACTION_CMD_OPENCB = "openCB";//$NON-NLS-1$ protected JSpinner intervalField; protected LaTeXDrawComboBox typeChoice; protected JCheckBox openCB; /** * The constructor by default. */ public ParametersAkinPointsFrame(Frame parent, DrawPanel p, boolean attachToMainFrame) { super(parent, p, attachToMainFrame); try { JTabbedPane tabbedPane = new JTabbedPane(); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JPanel pButton = createButtonsPanel(this); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.WEST; JPanel akinP = new JPanel(new GridBagLayout()); constraint.gridx = 0; constraint.gridy = 0; akinP.add(new JLabel(LaTeXDrawLang.getString1_9("ParametersAkinPointsFrame.0")), constraint); //$NON-NLS-1$ constraint.gridx++; SpinnerModel model = new SpinnerNumberModel(AkinPoints.DEFAULT_INTERVAL, 1, 1000,1); intervalField = new JSpinner(model); intervalField.setName(NAME_INTERVAL_FIELD); intervalField.setEditor(new JSpinner.NumberEditor(intervalField, "0"));//$NON-NLS-1$ intervalField.addChangeListener(this); akinP.add(intervalField, constraint); constraint.gridx++; openCB = new JCheckBox(LaTeXDrawLang.getString1_9("ParametersAkinPointsFrame.1")); //$NON-NLS-1$ openCB.setActionCommand(ACTION_CMD_OPENCB); openCB.setName(ACTION_CMD_OPENCB); openCB.addActionListener(this); akinP.add(openCB, constraint); constraint.gridx = 0; constraint.gridy++; akinP.add(new JLabel(LaTeXDrawLang.getString1_9("ParametersAkinPointsFrame.2")), constraint); //$NON-NLS-1$ constraint.gridx++; typeChoice = AkinPoints.createTypeChoice(); typeChoice.addItemListener(this); akinP.add(typeChoice, constraint); createRotationField(); constraint.gridx++; akinP.add(new JLabel(LABEL_ROTATION), constraint); constraint.gridx++; akinP.add(rotationField, constraint); akinP.setBorder(new CompoundBorder( new TitledBorder(null, LaTeXDrawLang.getString1_9("ParametersAkinPointsFrame.3"), //$NON-NLS-1$ TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); JPanel pGeneral = new JPanel(); pGeneral.setLayout(new BoxLayout(pGeneral, BoxLayout.Y_AXIS)); pGeneral.add(akinP); pGeneral.add(createBordersPanel(false)); pGeneral.add(createFillPanel()); pGeneral.add(createHatchingPanel()); JPanel pOthers = new JPanel(); pOthers.setLayout(new BoxLayout(pOthers, BoxLayout.Y_AXIS)); pOthers.add(createShadowPanel()); pOthers.add(createGradientPanel()); tabbedPane.addTab(TITLE_TABBED_PANE_GENERAL, pGeneral); tabbedPane.addTab(TITLE_TABBED_PANE_OTHERS, pOthers); BoxLayout bl = new BoxLayout(getContentPane(), BoxLayout.Y_AXIS); getContentPane().setLayout(bl); getContentPane().add(glimpsePanelZoom); getContentPane().add(tabbedPane); getContentPane().add(pButton); pack(); setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2); setVisible(false); }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } @Override public void setVisible(boolean visible, Figure selected, boolean deleteOnCancel, boolean isFramedBox) { try { if(!(selected instanceof AkinPoints)) throw new ClassCastException(); super.setVisible(visible, selected, deleteOnCancel, isFramedBox); }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } @Override public void setFigureFrameField() { AkinPoints ak = (AkinPoints)figure; int nbPts = ak.getNbPoints(); typeChoice.setSelectedItem(String.valueOf(ak.getType())); intervalField.setValue(ak.getInterval()); intervalField.removeChangeListener(this); intervalField.setModel(new SpinnerNumberModel(ak.getInterval(),1,nbPts-1,1)); intervalField.addChangeListener(this); openCB.setSelected(ak.isOpen()); } @Override public void itemStateChanged(ItemEvent e) { super.itemStateChanged(e); try { Object o = e.getSource(); AkinPoints ak = (AkinPoints)glimpsePanel.getGlimpseFigure(); if(o instanceof LaTeXDrawComboBox) { String ac = ((LaTeXDrawComboBox)o).getActionCommand(); if(ac.equals(AkinPoints.LABEL_TYPE_CHOICE)) { setModified(true); ak.setType(Integer.valueOf(((JLabel)typeChoice.getSelectedItem()).getText()).intValue()); glimpsePanel.repaint(); return ; } return ; } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } @Override public void setDefaultsValues() { super.setDefaultsValues(); AkinPoints ak = (AkinPoints)figure; typeChoice.setSelectedItem(String.valueOf(AkinPoints.DEFAULT_TYPE)); intervalField.setValue(AkinPoints.DEFAULT_INTERVAL); ak.setOpen(AkinPoints.DEFAULT_OPEN); openCB.setSelected(AkinPoints.DEFAULT_OPEN); } @Override public void stateChanged(ChangeEvent e) { super.stateChanged(e); try { Object o = e.getSource(); if(o instanceof JSpinner) { String name = ((JSpinner)o).getName(); AkinPoints ak = (AkinPoints)glimpsePanel.getGlimpseFigure(); if(name.equals(NAME_INTERVAL_FIELD)) { setModified(true); ak.setInterval(Double.valueOf(((JSpinner)o).getValue().toString()).intValue()); glimpsePanel.repaint(); return ; } return ; } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } @Override public void saveParameters() { super.saveParameters(); AkinPoints ak = (AkinPoints)figure; ak.setInterval(Float.valueOf(intervalField.getValue().toString()).intValue()); ak.setType(Float.valueOf(((JLabel)typeChoice.getSelectedItem()).getText()).intValue()); ak.setOpen(openCB.isSelected()); drawPanel.getDraw().updateBorders(); drawPanel.updateDraw(true); } @Override public void actionPerformed(ActionEvent e) { super.actionPerformed(e); try { Object o = e.getSource(); AkinPoints ak = (AkinPoints)glimpsePanel.getGlimpseFigure(); if(o instanceof JCheckBox) { String label = ((JCheckBox)o).getActionCommand(); if(label.equals(ACTION_CMD_OPENCB)) { setModified(true); ak.setOpen(openCB.isSelected()); glimpsePanel.repaint(); return ; } return ; } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/ParametersTextFrame.java0000644000000000000000000015102311347255510022077 0ustar package latexDraw.ui.dialog; import java.awt.*; import java.awt.event.*; import java.util.Vector; import javax.swing.*; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import latexDraw.figures.Figure; import latexDraw.figures.FramedBox; import latexDraw.figures.Text; import latexDraw.lang.LaTeXDrawLang; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.DrawContainer; import latexDraw.ui.DrawPanel; import latexDraw.ui.components.ButtonIcon; import latexDraw.ui.components.ColorButton; import latexDraw.util.LaTeXDrawPoint2D; import latexDraw.util.LaTeXDrawResources; /** * This class allows to set the parameters of the text
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class ParametersTextFrame extends AbstractParametersFrame implements FocusListener, MouseListener { private static final long serialVersionUID = 1L; /** This field allows the set the text */ protected JTextField textField; /** This field allows the set the X-coordinate of the first character of the text */ protected JSpinner xCoord; /** This field allows the set the Y-coordinate of the first character of the text */ protected JSpinner yCoord; /** Allows to set the size of the text */ protected JComboBox sizeChoice; /** Allows to choice the font */ protected JComboBox fontChoice; /** Allows to set the text in italic */ protected JToggleButton buttonItalic; /** Allows to set the text in bold */ protected JToggleButton buttonBold; /** Allows to set if there is framed box or not. */ protected JCheckBox framedBoxCB; /** Allows to set that there is only a simple framed box for the text. */ protected JRadioButton simpleRB; /** Allows to set that there is only a several framed boxes for the text. */ protected JRadioButton multipleRB; /** Allows to set that the box is a circle. */ protected JRadioButton circleRB; /** Allows to set that the box is a rectangle. */ protected JRadioButton rectangleRB; /** Allows to set that the box is an ellipse. */ protected JRadioButton ellipseRB; /** Allows to set that the box is a triangle. */ protected JRadioButton triangleRB; /** Allows to set that the box is a diamond. */ protected JRadioButton diamondRB; /** Allows to add a new box. */ protected JButton addBox; /** Allows to modify the position of a box. */ protected JButton modifyBox; /** Allows to remove a box. */ protected JButton removeBox; /** The list of all the boxes. */ protected JList boxesList; /** Allows to set the frameSep attribute. */ protected JSpinner frameSepField; /** Allows to open the parameters frame of the box. */ protected JButton editBoxB; /** Allows to set the boxSep attribute. */ protected JCheckBox boxSepCB; /** Allows to set the isOpaque attribute. */ protected JCheckBox opaqueCB; /** The label of each box in the list. */ protected Vector boxes; /** Allows to select parts of the text to box. */ protected SelectTextFrame textSelFrame; /** Can choose the colour of the opacity. */ protected ColorButton opacityColorButton; /** The frame of parameters to change the rectangle and the ellipse. */ protected ParametersEllipseRectangleFrame rectFrame; /** The frame of parameters to change the circle. */ protected ParametersCircleSquareFrame circleFrame; /** The frame of parameters to change the triangle. */ protected ParametersTriangleFrame triangleFrame; /** The frame of parameters to change the diamond. */ protected ParametersRhombusFrame diamondFrame; /** The label of the button opacityColorButton. */ public static final String LABEL_OPACITY_BUTTON = LaTeXDrawLang.getString1_7("ParametersTextFrame.0"); //$NON-NLS-1$ /** The label of simpleRB */ public static final String LABEL_BOX_LIST = LaTeXDrawLang.getString1_7("ParametersTextFrame.1"); //$NON-NLS-1$ /** The label of opaqueCB */ public static final String LABEL_OPAQUE_RB = LaTeXDrawLang.getString1_7("ParametersTextFrame.2"); //$NON-NLS-1$ /** The label of circleRB */ public static final String LABEL_CIRCLE_RB = LaTeXDrawLang.getString1_7("ParametersTextFrame.3"); //$NON-NLS-1$ /** The label of rectangleRB */ public static final String LABEL_RECTANGLE_RB = LaTeXDrawLang.getString1_7("ParametersTextFrame.4"); //$NON-NLS-1$ /** The label of triangleRB */ public static final String LABEL_TRIANGLE_RB = LaTeXDrawLang.getString1_7("ParametersTextFrame.5"); //$NON-NLS-1$ /** The label of diamondRB */ public static final String LABEL_DIAMOND_RB = LaTeXDrawLang.getString1_7("ParametersTextFrame.6"); //$NON-NLS-1$ /** The label of ellipseRB */ public static final String LABEL_ELLIPSE_RB = LaTeXDrawLang.getString1_7("ParametersTextFrame.7"); //$NON-NLS-1$ /** The label of simpleRB */ public static final String LABEL_SINGLE_RB = LaTeXDrawLang.getString1_7("ParametersTextFrame.8"); //$NON-NLS-1$ /** The label of multipleRB */ public static final String LABEL_MULTIPLE_RB = LaTeXDrawLang.getString1_7("ParametersTextFrame.9"); //$NON-NLS-1$ /** The label of framedBoxCB */ public static final String LABEL_FRAMED_BOX_CB = LaTeXDrawLang.getString1_7("ParametersTextFrame.10"); //$NON-NLS-1$ /** The label of modifyBox */ public static final String LABEL_ADD_BOX = LaTeXDrawLang.getString1_7("ParametersTextFrame.11"); //$NON-NLS-1$ /** The label of modifyBox */ public static final String LABEL_MODIFY_BOX = LaTeXDrawLang.getString1_7("ParametersTextFrame.12"); //$NON-NLS-1$ /** The label of removeBox */ public static final String LABEL_REMOVE_BOX = LaTeXDrawLang.getString1_7("ParametersTextFrame.13"); //$NON-NLS-1$ /** The label of frameSepField */ public static final String LABEL_FRAME_SEP = LaTeXDrawLang.getString1_7("ParametersTextFrame.14"); //$NON-NLS-1$ /** The label of editBoxB */ public static final String LABEL_EDIT_BOX_B = LaTeXDrawLang.getString1_7("ParametersTextFrame.15"); //$NON-NLS-1$ /** The label of boxSepCB */ public static final String LABEL_BOX_SEP_CB = LaTeXDrawLang.getString1_7("ParametersTextFrame.16"); //$NON-NLS-1$ /** The label of the bold button */ public static final String LABEL_BOLD = LaTeXDrawLang.getDialogFrameString("ParametersTextFrame.0"); //$NON-NLS-1$ /** The label of the italic button */ public static final String LABEL_ITALIC = LaTeXDrawLang.getDialogFrameString("ParametersTextFrame.1"); //$NON-NLS-1$ /** The label of the font choice */ public static final String LABEL_FONT = LaTeXDrawLang.getDialogFrameString("ParametersTextFrame.2"); //$NON-NLS-1$ /** The label of the size choice */ public static final String LABEL_SIZE = LaTeXDrawLang.getDialogFrameString("ParametersTextFrame.3"); //$NON-NLS-1$ /** The label of the text field */ public static final String LABEL_TEXT = LaTeXDrawLang.getDialogFrameString("ParametersTextFrame.4"); //$NON-NLS-1$ /** * The constructor by default * @param p The panel which contains the draw */ public ParametersTextFrame(Frame parent, DrawPanel p, boolean attachToMainFrame) { super(parent, p, attachToMainFrame); try { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JTabbedPane tabbedPane = new JTabbedPane(); JToolBar toolbar = new JToolBar(); toolbar.setLayout(new FlowLayout(FlowLayout.LEFT)); toolbar.setName("Text toolbar");//$NON-NLS-1$ toolbar.setPreferredSize(new Dimension(100, 30)); toolbar.setMaximumSize(new Dimension(600, 30)); toolbar.setFloatable(false); buttonItalic = new JToggleButton(new ImageIcon(getClass().getResource("/res/Italic.png")));//$NON-NLS-1$ buttonItalic.setActionCommand(LABEL_ITALIC); buttonItalic.addActionListener(this); buttonBold = new JToggleButton(new ImageIcon(getClass().getResource("/res/Bold.png")));//$NON-NLS-1$ buttonBold.setActionCommand(LABEL_BOLD); buttonBold.addActionListener(this); toolbar.add(buttonItalic); toolbar.add(buttonBold); JPanel pButton = createButtonsPanel(this); JPanel pGeneral = new JPanel(new GridBagLayout()); textField = new JTextField(); textField.setColumns(40); textField.setName(LABEL_TEXT); textField.addKeyListener(this); Dimension dimension = new Dimension(350, 30);//fixes #1562954 textField.setMinimumSize(dimension); textField.setMaximumSize(dimension); textField.setPreferredSize(dimension); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 5; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.CENTER; pGeneral.add(textField, constraint); constraint.anchor = GridBagConstraints.WEST; constraint.gridx = 0; constraint.gridy++; constraint.gridwidth = 1; pGeneral.add(new JLabel(LABEL_X), constraint); SpinnerModel model = new SpinnerNumberModel(0,0,10000,0.1); xCoord = new JSpinner(model); xCoord.setEditor(new JSpinner.NumberEditor(xCoord, "0.0"));//$NON-NLS-1$ xCoord.addChangeListener(this); xCoord.setName(LABEL_X); constraint.gridx++; pGeneral.add(xCoord, constraint); constraint.gridx = 0; constraint.gridy++; pGeneral.add(new JLabel(LABEL_Y), constraint); model = new SpinnerNumberModel(0,0,10000,0.1); yCoord = new JSpinner(model); yCoord.setEditor(new JSpinner.NumberEditor(yCoord, "0.0"));//$NON-NLS-1$ yCoord.addChangeListener(this); yCoord.setName(LABEL_Y); constraint.gridx = 1; pGeneral.add(yCoord, constraint); constraint.gridx = 0; constraint.gridy++; constraint.gridwidth = 1; pGeneral.add(new JLabel(LABEL_ROTATION), constraint); model = new SpinnerNumberModel(Figure.DEFAULT_ROTATION_ANGLE, -360, 360,0.1); rotationField = new JSpinner(model); rotationField.setEditor(new JSpinner.NumberEditor(rotationField, "0.0")); //$NON-NLS-1$ rotationField.setName(LaTeXDrawResources.LABEL_ROTATE); rotationField.addChangeListener(this); constraint.gridx = 1; pGeneral.add(rotationField, constraint); bordersButton = new ColorButton(LaTeXDrawResources.LABEL_COLOR_BUTTON, new ButtonIcon(Color.BLACK)); bordersButton.setActionCommand(LaTeXDrawResources.LABEL_COLOR_BUTTON); bordersButton.addActionListener(this); constraint.gridx = 0; constraint.gridy++; pGeneral.add(bordersButton, constraint); constraint.gridx=0; constraint.gridy++; pGeneral.add(new JLabel(LABEL_SIZE), constraint); sizeChoice = Text.getChoiceSize(); sizeChoice.setName(LABEL_SIZE); sizeChoice.addItemListener(this); constraint.gridx++; pGeneral.add(sizeChoice, constraint); constraint.gridx=0; constraint.gridy++; pGeneral.add(new JLabel(LABEL_FONT), constraint); fontChoice = Text.getChoiceFont(); fontChoice.setName(LABEL_FONT); fontChoice.addItemListener(this); constraint.gridx++; pGeneral.add(fontChoice, constraint); constraint.gridx=0; constraint.gridy++; opaqueCB = new JCheckBox(LABEL_OPAQUE_RB); opaqueCB.setActionCommand(LABEL_OPAQUE_RB); opaqueCB.addActionListener(this); opaqueCB.setToolTipText(LaTeXDrawLang.getString1_7("ParametersTextFrame.17")); //$NON-NLS-1$ opaqueCB.setSelected(Text.DEFAULT_IS_OPAQUE); pGeneral.add(opaqueCB, constraint); opacityColorButton = new ColorButton(LABEL_OPACITY_BUTTON, new ButtonIcon(Color.WHITE)); opacityColorButton.setActionCommand(LABEL_OPACITY_BUTTON); opacityColorButton.addActionListener(this); constraint.gridx++; pGeneral.add(opacityColorButton, constraint); pGeneral.setBorder(new CompoundBorder(new TitledBorder(null, TITLE_GENERAL, TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); tabbedPane.add(TITLE_TABBED_PANE_GENERAL, pGeneral); tabbedPane.add(LaTeXDrawLang.getString1_7("ParametersTextFrame.18"), createFramedBoxPanel()); //$NON-NLS-1$ BoxLayout bl = new BoxLayout(getContentPane(), BoxLayout.Y_AXIS); getContentPane().setLayout(bl); getContentPane().add(toolbar); getContentPane().add(glimpsePanelZoom); getContentPane().add(tabbedPane); getContentPane().add(pButton); pack(); setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2); setVisible(false); } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } /** * @return The panel which set the framed box(es) of the text. * @since 1.7 */ private JPanel createFramedBoxPanel() { JPanel fbP = new JPanel(new GridBagLayout()); fbP.setBorder(new CompoundBorder(new TitledBorder(null, LaTeXDrawLang.getString1_7("ParametersTextFrame.18"), //$NON-NLS-1$ TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); fbP.setPreferredSize(new Dimension(390, 280)); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 2; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.WEST; ButtonGroup shapeBox = new ButtonGroup(); framedBoxCB = new JCheckBox(LABEL_FRAMED_BOX_CB); framedBoxCB.setActionCommand(LABEL_FRAMED_BOX_CB); framedBoxCB.setToolTipText(LaTeXDrawLang.getString1_7("ParametersTextFrame.20")); //$NON-NLS-1$ framedBoxCB.setSelected(false); framedBoxCB.addActionListener(this); framedBoxCB.setEnabled(false); fbP.add(framedBoxCB, constraint); rectangleRB = new JRadioButton(LABEL_RECTANGLE_RB); rectangleRB.setActionCommand(LABEL_RECTANGLE_RB); rectangleRB.setToolTipText(LaTeXDrawLang.getString1_7("ParametersTextFrame.21")); //$NON-NLS-1$ rectangleRB.addActionListener(this); rectangleRB.setEnabled(false); rectangleRB.setSelected(true); constraint.gridwidth = 1; constraint.gridx=2; fbP.add(rectangleRB, constraint); shapeBox.add(rectangleRB); triangleRB = new JRadioButton(LABEL_TRIANGLE_RB); triangleRB.setActionCommand(LABEL_TRIANGLE_RB); triangleRB.setToolTipText(LaTeXDrawLang.getString1_7("ParametersTextFrame.22")); //$NON-NLS-1$ triangleRB.addActionListener(this); triangleRB.setEnabled(false); triangleRB.setSelected(true); constraint.gridx=3; fbP.add(triangleRB, constraint); shapeBox.add(triangleRB); constraint.gridy++; constraint.gridx=0; constraint.gridwidth = 2; //Fixes #1562954 ButtonGroup typeBox = new ButtonGroup(); simpleRB = new JRadioButton(LABEL_SINGLE_RB); simpleRB.setActionCommand(LABEL_SINGLE_RB); simpleRB.setToolTipText(LaTeXDrawLang.getString1_7("ParametersTextFrame.23")); //$NON-NLS-1$ simpleRB.addActionListener(this); simpleRB.setSelected(true); simpleRB.setEnabled(false); typeBox.add(simpleRB); fbP.add(simpleRB, constraint); ellipseRB = new JRadioButton(LABEL_ELLIPSE_RB); ellipseRB.setActionCommand(LABEL_ELLIPSE_RB); ellipseRB.setToolTipText(LaTeXDrawLang.getString1_7("ParametersTextFrame.24")); //$NON-NLS-1$ ellipseRB.addActionListener(this); ellipseRB.setEnabled(false); ellipseRB.setSelected(true); constraint.gridx=2; fbP.add(ellipseRB, constraint); shapeBox.add(ellipseRB); diamondRB = new JRadioButton(LABEL_DIAMOND_RB); diamondRB.setActionCommand(LABEL_DIAMOND_RB); diamondRB.setToolTipText(LaTeXDrawLang.getString1_7("ParametersTextFrame.25")); //$NON-NLS-1$ diamondRB.addActionListener(this); diamondRB.setEnabled(false); diamondRB.setSelected(true); constraint.gridx=3; fbP.add(diamondRB, constraint); shapeBox.add(diamondRB); constraint.gridy++; constraint.gridx=0; constraint.gridwidth = 2; multipleRB = new JRadioButton(LABEL_MULTIPLE_RB); multipleRB.setActionCommand(LABEL_MULTIPLE_RB); multipleRB.setToolTipText(LaTeXDrawLang.getString1_7("ParametersTextFrame.26")); //$NON-NLS-1$ multipleRB.addActionListener(this); multipleRB.setEnabled(false); typeBox.add(multipleRB); fbP.add(multipleRB, constraint); circleRB = new JRadioButton(LABEL_CIRCLE_RB); circleRB.setActionCommand(LABEL_CIRCLE_RB); circleRB.setToolTipText(LaTeXDrawLang.getString1_7("ParametersTextFrame.27")); //$NON-NLS-1$ circleRB.addActionListener(this); circleRB.setEnabled(false); circleRB.setSelected(true); constraint.gridx=2; constraint.gridwidth = 1; fbP.add(circleRB, constraint); shapeBox.add(circleRB); constraint.gridy++; constraint.gridx=0; addBox = new JButton(LABEL_ADD_BOX); addBox.setActionCommand(LABEL_ADD_BOX); addBox.addActionListener(this); addBox.setToolTipText(LaTeXDrawLang.getString1_7("ParametersTextFrame.28")); //$NON-NLS-1$ fbP.add(addBox, constraint); addBox.setEnabled(false); constraint.gridx+=2; constraint.gridwidth = 4; constraint.gridheight=3; boxes = new Vector(); boxesList = new JList(boxes); boxesList.setVisibleRowCount(5); boxesList.setEnabled(false); boxesList.addFocusListener(this); boxesList.addMouseListener(this); boxesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); boxesList.setName(LABEL_BOX_LIST); JScrollPane scrollPane = new JScrollPane(boxesList); Dimension dimension = new Dimension(250,100); scrollPane.setPreferredSize(dimension); scrollPane.setMinimumSize(dimension); scrollPane.setMaximumSize(dimension); fbP.add(scrollPane, constraint); constraint.gridx=0; constraint.gridheight=1; constraint.gridy++; constraint.gridwidth = 2; modifyBox = new JButton(LABEL_MODIFY_BOX); modifyBox.setActionCommand(LABEL_MODIFY_BOX); modifyBox.addActionListener(this); modifyBox.setToolTipText(LaTeXDrawLang.getString1_7("ParametersTextFrame.29")); //$NON-NLS-1$ fbP.add(modifyBox, constraint); modifyBox.setEnabled(false); constraint.gridy++; removeBox = new JButton(LABEL_REMOVE_BOX); removeBox.setActionCommand(LABEL_REMOVE_BOX); removeBox.addActionListener(this); removeBox.setToolTipText(LaTeXDrawLang.getString1_7("ParametersTextFrame.30")); //$NON-NLS-1$ fbP.add(removeBox, constraint); removeBox.setEnabled(false); constraint.gridy++; constraint.gridwidth = 1; fbP.add(new JLabel(LABEL_FRAME_SEP), constraint); constraint.gridx++; SpinnerModel model = new SpinnerNumberModel( PSTricksConstants.DEFAULT_FRAME_SEP*DrawContainer.DEFAULT_PIXPERCM,0,2000,1); frameSepField = new JSpinner(model); frameSepField.setToolTipText(LaTeXDrawLang.getString1_7("ParametersTextFrame.31")); //$NON-NLS-1$ frameSepField.setEditor(new JSpinner.NumberEditor(frameSepField, "0"));//$NON-NLS-1$ frameSepField.addChangeListener(this); frameSepField.setName(LABEL_FRAME_SEP); fbP.add(frameSepField, constraint); frameSepField.setEnabled(false); constraint.gridx++; boxSepCB = new JCheckBox(LABEL_BOX_SEP_CB); boxSepCB.setActionCommand(LABEL_BOX_SEP_CB); boxSepCB.setToolTipText(LaTeXDrawLang.getString1_7("ParametersTextFrame.32")); //$NON-NLS-1$ boxSepCB.setSelected(PSTricksConstants.DEFAULT_BOX_SEP); boxSepCB.addActionListener(this); fbP.add(boxSepCB, constraint); boxSepCB.setEnabled(false); constraint.gridx++; editBoxB = new JButton(LABEL_EDIT_BOX_B); editBoxB.setActionCommand(LABEL_EDIT_BOX_B); editBoxB.addActionListener(this); editBoxB.setToolTipText(LaTeXDrawLang.getString1_7("ParametersTextFrame.33")); //$NON-NLS-1$ fbP.add(editBoxB, constraint); editBoxB.setEnabled(false); return fbP; } @Override public void actionPerformed(ActionEvent e) { try { Object o = e.getSource(); Text t = (Text) glimpsePanel.getGlimpseFigure(); if(o instanceof AbstractButton) { String label = ((AbstractButton)o).getActionCommand(); if(label.equals(LABEL_ADD_BOX)) { if(textSelFrame==null) textSelFrame = new SelectTextFrame(this); textSelFrame.setVisible(true); int[] is = textSelFrame.getSelectedIndex(); String txt = textSelFrame.getSelectedText(); if(txt!=null && txt.length()>0 && is!=null && is.length==2) { FramedBox fb = new FramedBox(t); fb.setStart(is[0]); fb.setEnd(is[1]); if(t.addBox(fb)) { setModified(true); boxes.add(fb); int id = boxesList.getSelectedIndex(); frameSepField.setEnabled(id!=-1); boxSepCB.setEnabled(id!=-1); editBoxB.setEnabled(id!=-1); removeBox.setEnabled(id!=-1); modifyBox.setEnabled(id!=-1); rectangleRB.setEnabled(id!=-1); circleRB.setEnabled(id!=-1); ellipseRB.setEnabled(id!=-1); diamondRB.setEnabled(id!=-1); triangleRB.setEnabled(id!=-1); boxesList.updateUI(); glimpsePanel.repaint(); } } return; } if(label.equals(LABEL_REMOVE_BOX)) { Object selected = boxesList.getSelectedValue(); boxes.remove(selected); boxesList.updateUI(); boxesList.clearSelection(); if(selected instanceof FramedBox) t.removeBox((FramedBox)selected); setModified(true); frameSepField.setEnabled(false); boxSepCB.setEnabled(false); editBoxB.setEnabled(false); removeBox.setEnabled(false); modifyBox.setEnabled(false); rectangleRB.setEnabled(false); circleRB.setEnabled(false); ellipseRB.setEnabled(false); diamondRB.setEnabled(false); triangleRB.setEnabled(false); glimpsePanel.repaint(); return ; } if(label.equals(LABEL_MODIFY_BOX)) { if(textSelFrame==null) textSelFrame = new SelectTextFrame(this); Object selected = boxesList.getSelectedValue(); if(selected instanceof FramedBox) { FramedBox fb = (FramedBox)selected; int index = t.getMultipleBox().indexOf(fb); t.getMultipleBox().remove(index); textSelFrame.show(fb.getStart(), fb.getEnd()); int[] is = textSelFrame.getSelectedIndex(); t.getMultipleBox().add(index, fb); if(is!=null && is.length==2) { setModified(true); fb.setStart(is[0]); fb.setEnd(is[1]); glimpsePanel.repaint(); boxesList.updateUI(); } } return ; } if(label.equals(LABEL_OPAQUE_RB)) { setModified(true); t.setOpaque(opaqueCB.isSelected()); glimpsePanel.repaint(); return; } if(label.equals(LABEL_TRIANGLE_RB)) { if(simpleRB.isSelected()) t.getSimpleBox().setBoxType(FramedBox.BOX_TRIANGLE); else ((FramedBox)boxesList.getSelectedValue()).setBoxType(FramedBox.BOX_TRIANGLE); setModified(true); t.updateFramedBoxes(); t.updateBorders(); glimpsePanel.repaint(); return; } if(label.equals(LABEL_DIAMOND_RB)) { if(simpleRB.isSelected()) t.getSimpleBox().setBoxType(FramedBox.BOX_DIAMOND); else ((FramedBox)boxesList.getSelectedValue()).setBoxType(FramedBox.BOX_DIAMOND); setModified(true); t.updateFramedBoxes(); t.updateBorders(); glimpsePanel.repaint(); return; } if(label.equals(LABEL_RECTANGLE_RB)) { if(simpleRB.isSelected()) t.getSimpleBox().setBoxType(FramedBox.BOX_RECTANGLE); else ((FramedBox)boxesList.getSelectedValue()).setBoxType(FramedBox.BOX_RECTANGLE); setModified(true); t.updateFramedBoxes(); t.updateBorders(); glimpsePanel.repaint(); return; } if(label.equals(LABEL_ELLIPSE_RB)) { if(simpleRB.isSelected()) t.getSimpleBox().setBoxType(FramedBox.BOX_ELLIPSE); else ((FramedBox)boxesList.getSelectedValue()).setBoxType(FramedBox.BOX_ELLIPSE); setModified(true); t.updateFramedBoxes(); t.updateBorders(); glimpsePanel.repaint(); return; } if(label.equals(LABEL_CIRCLE_RB)) { if(simpleRB.isSelected()) t.getSimpleBox().setBoxType(FramedBox.BOX_CIRCLE); else ((FramedBox)boxesList.getSelectedValue()).setBoxType(FramedBox.BOX_CIRCLE); setModified(true); t.updateFramedBoxes(); t.updateBorders(); glimpsePanel.repaint(); return; } if(label.equals(LABEL_EDIT_BOX_B)) { Figure f; if(simpleRB.isSelected()) f = t.getSimpleBox().getBox(); else f = ((FramedBox)boxesList.getSelectedValue()).getBox(); if(rectangleRB.isSelected() || ellipseRB.isSelected()) { if(rectFrame==null) rectFrame = new ParametersEllipseRectangleFrame((JFrame)getParent(), drawPanel, false); rectFrame.setVisible(true, f, false, true); } else if(circleRB.isSelected()) { if(circleFrame==null) circleFrame = new ParametersCircleSquareFrame((JFrame)getParent(), drawPanel, false); circleFrame.setVisible(true, f, false, true); } else if(diamondRB.isSelected()) { if(diamondFrame==null) diamondFrame = new ParametersRhombusFrame((JFrame)getParent(), drawPanel, false); diamondFrame.setVisible(true, f, false, true); } else if(triangleRB.isSelected()) { if(triangleFrame==null) triangleFrame = new ParametersTriangleFrame((JFrame)getParent(), drawPanel, false); triangleFrame.setVisible(true, f, false, true); } if(multipleRB.isSelected()) t.updateFramedBoxes(); setModified(true); glimpsePanel.repaint(); return; } if(label.equals(LABEL_FRAMED_BOX_CB)) { boolean ok = framedBoxCB.isSelected(); int id = boxesList.getSelectedIndex(); boolean simple = simpleRB.isSelected(); setModified(true); opaqueCB.setEnabled(!ok); simpleRB.setEnabled(ok); boxesList.setEnabled(ok && !simple); multipleRB.setEnabled(ok); frameSepField.setEnabled(ok && ( simple || id!=-1)); boxSepCB.setEnabled(ok && id!=-1); editBoxB.setEnabled(ok && (simple || id!=-1)); addBox.setEnabled(ok && !simple); removeBox.setEnabled(ok && !simple && id!=-1); modifyBox.setEnabled(ok && !simple && id!=-1); rectangleRB.setEnabled(ok && (simple || id!=-1)); circleRB.setEnabled(ok && (simple || id!=-1)); ellipseRB.setEnabled(ok && (simple || id!=-1)); diamondRB.setEnabled(ok && (simple || id!=-1)); triangleRB.setEnabled(ok && (simple || id!=-1)); t.setHasFramedBox(ok); t.setHasSimpleFramedBox(simpleRB.isSelected()); if(simpleRB.isSelected()) { FramedBox fb = t.getSimpleBox(); fb.setBoxSep(boxSepCB.isSelected()); fb.setFrameSep(Double.valueOf(frameSepField.getValue().toString()).doubleValue()); if(rectangleRB.isSelected()) fb.setBoxType(FramedBox.BOX_RECTANGLE); else if(ellipseRB.isSelected()) fb.setBoxType(FramedBox.BOX_ELLIPSE); else if(circleRB.isSelected()) fb.setBoxType(FramedBox.BOX_CIRCLE); else if(diamondRB.isSelected()) fb.setBoxType(FramedBox.BOX_DIAMOND); else fb.setBoxType(FramedBox.BOX_TRIANGLE); } glimpsePanel.repaint(); return ; } if(label.equals(LABEL_BOLD)) { setModified(true); t.setIsBold(buttonBold.isSelected()); if(t.getSimpleBox()!=null) t.getSimpleBox().updateBoxSize(); glimpsePanel.repaint(); return ; } if(label.equals(LABEL_ITALIC)) { setModified(true); t.setIsItalic(buttonItalic.isSelected()); if(t.getSimpleBox()!=null) t.getSimpleBox().updateBoxSize(); glimpsePanel.repaint(); return ; } if(label.equals(LABEL_SINGLE_RB)) { setModified(true); frameSepField.setEnabled(true); boxSepCB.setEnabled(true); editBoxB.setEnabled(true); boxesList.setEnabled(false); addBox.setEnabled(false); removeBox.setEnabled(false); modifyBox.setEnabled(false); t.setHasSimpleFramedBox(true); FramedBox fb = t.getSimpleBox(); frameSepField.setValue(fb.getFrameSep()); boxSepCB.setEnabled(false); rectangleRB.setEnabled(true); circleRB.setEnabled(true); ellipseRB.setEnabled(true); diamondRB.setEnabled(true); triangleRB.setEnabled(true); int style = fb.getBoxType(); if(style==FramedBox.BOX_RECTANGLE) rectangleRB.setSelected(true); else if(style==FramedBox.BOX_CIRCLE) circleRB.setSelected(true); else if(style==FramedBox.BOX_ELLIPSE) ellipseRB.setSelected(true); else if(style==FramedBox.BOX_TRIANGLE) triangleRB.setSelected(true); else if(style==FramedBox.BOX_DIAMOND) diamondRB.setSelected(true); boxSepCB.setSelected(fb.isBoxSep()); frameSepField.setValue(fb.getFrameSep()); if(t.getSimpleBox()!=null) t.getSimpleBox().updateBoxSize(); glimpsePanel.repaint(); return ; } if(label.equals(LABEL_MULTIPLE_RB)) { int id = boxesList.getSelectedIndex(); setModified(true); frameSepField.setEnabled(id!=-1); boxSepCB.setEnabled(id!=-1); editBoxB.setEnabled(id!=-1); boxesList.setEnabled(true); addBox.setEnabled(true); removeBox.setEnabled(id!=-1); modifyBox.setEnabled(id!=-1); t.setHasSimpleFramedBox(false); rectangleRB.setEnabled(id!=-1); circleRB.setEnabled(id!=-1); ellipseRB.setEnabled(id!=-1); diamondRB.setEnabled(id!=-1); triangleRB.setEnabled(id!=-1); if(id!=-1) { FramedBox fb = (FramedBox)boxesList.getSelectedValue(); int style = fb.getBoxType(); if(style==FramedBox.BOX_RECTANGLE) rectangleRB.setSelected(true); else if(style==FramedBox.BOX_CIRCLE) circleRB.setSelected(true); else if(style==FramedBox.BOX_ELLIPSE) ellipseRB.setSelected(true); else if(style==FramedBox.BOX_TRIANGLE) triangleRB.setSelected(true); else if(style==FramedBox.BOX_DIAMOND) diamondRB.setSelected(true); boxSepCB.setSelected(fb.isBoxSep()); frameSepField.setValue(fb.getFrameSep()); } glimpsePanel.repaint(); return ; } if(label.equals(LABEL_BOX_SEP_CB)) { if(multipleRB.isSelected()) { setModified(true); FramedBox fb = (FramedBox)boxesList.getSelectedValue(); fb.setBoxSep(boxSepCB.isSelected()); t.updateFramedBoxes(); t.updateBorders(); glimpsePanel.repaint(); } return ; } if(label.equals(LABEL_OPACITY_BUTTON)) { Color c = JColorChooser.showDialog((Component) e.getSource(), LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.34"), //$NON-NLS-1$ ((ColorButton)o).getColor()); if(c!=null) { setModified(true); ((ColorButton)o).setColor(c); t.setOpacityColor(c); glimpsePanel.repaint(); } return ; } } super.actionPerformed(e); } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } @Override public void setFigureFrameField() { try { if(!(figure instanceof Text)) throw new ClassCastException(); Text t = (Text)figure; LaTeXDrawPoint2D p = t.getPosition(); opacityColorButton.setColor(t.getOpacityColor()); boxes.clear(); Text txt = (Text)glimpsePanel.glimpseFigure; for(FramedBox bf : txt.getMultipleBox()) boxes.add(bf); boxesList.clearSelection(); boxesList.updateUI(); framedBoxCB.setSelected(t.hasFramedBox()); framedBoxCB.setEnabled(t.getText().length()>0); simpleRB.setEnabled(framedBoxCB.isEnabled() && framedBoxCB.isSelected()); multipleRB.setEnabled(framedBoxCB.isEnabled() && framedBoxCB.isSelected()); simpleRB.setSelected(t.hasFramedBox() && t.hasSimpleFramedBox()); multipleRB.setSelected(t.hasSeveralBoxes()); frameSepField.setEnabled(framedBoxCB.isSelected() && simpleRB.isSelected()); boxSepCB.setEnabled(false); circleRB.setEnabled(framedBoxCB.isSelected() && simpleRB.isSelected()); rectangleRB.setEnabled(framedBoxCB.isSelected() && simpleRB.isSelected()); triangleRB.setEnabled(framedBoxCB.isSelected() && simpleRB.isSelected()); diamondRB.setEnabled(framedBoxCB.isSelected() && simpleRB.isSelected()); ellipseRB.setEnabled(framedBoxCB.isSelected() && simpleRB.isSelected()); editBoxB.setEnabled(framedBoxCB.isSelected() && simpleRB.isSelected()); frameSepField.removeChangeListener(this); if(t.hasFramedBox() && t.hasSimpleFramedBox()) frameSepField.setValue(t.getSimpleBox().getFrameSep()); else frameSepField.setValue(PSTricksConstants.DEFAULT_FRAME_SEP*Figure.PPC); frameSepField.addChangeListener(this); textField.setText(t.getText()); xCoord.setValue(p.x); yCoord.setValue(p.y); sizeChoice.setSelectedItem(t.getTextSize().getLabel()); buttonItalic.setSelected(t.isItalic()); buttonBold.setSelected(t.isBold()); fontChoice.setSelectedItem(t.getCurrentTextFont().getName()); if(t.getText().length()==0) buttonOk.setEnabled(false); else buttonOk.setEnabled(true); opaqueCB.setSelected(t.isOpaque()); opaqueCB.setEnabled(!t.hasFramedBox()); addBox.setEnabled(t.hasSeveralBoxes()); boxesList.setEnabled(t.hasSeveralBoxes()); if(t.hasSimpleFramedBox() && t.getSimpleBox()!=null) { int style = t.getSimpleBox().getBoxType(); if(style==FramedBox.BOX_RECTANGLE) rectangleRB.setSelected(true); else if(style==FramedBox.BOX_CIRCLE) circleRB.setSelected(true); else if(style==FramedBox.BOX_ELLIPSE) ellipseRB.setSelected(true); else if(style==FramedBox.BOX_TRIANGLE) triangleRB.setSelected(true); else if(style==FramedBox.BOX_DIAMOND) diamondRB.setSelected(true); } } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } @Override public void setDefaultsValues() { try { super.setDefaultsValues(); Text t = (Text)glimpsePanel.getGlimpseFigure(); t.setOpacityColor(Text.DEFAULT_OPACITY_COLOR); opacityColorButton.setColor(Text.DEFAULT_OPACITY_COLOR); fontChoice.setSelectedItem(Text.DEFAULT_TEXTFONT.getName()); buttonItalic.setSelected(Text.DEFAULT_ISITALIC); buttonBold.setSelected(Text.DEFAULT_ISBOLD); t.setIsBold(Text.DEFAULT_ISBOLD); t.setIsItalic(Text.DEFAULT_ISITALIC); t.setTextFont(Text.DEFAULT_TEXTFONT.getName()); t.setSize(Text.DEFAULT_SIZE.getLabel()); sizeChoice.setSelectedItem(Text.DEFAULT_SIZE.getLabel()); t.setSimpleBox(new FramedBox(t)); t.setHasFramedBox(Text.DEFAULT_HAS_BOX); framedBoxCB.setSelected(Text.DEFAULT_HAS_BOX); rectangleRB.setSelected(true); boxSepCB.setSelected(PSTricksConstants.DEFAULT_BOX_SEP); frameSepField.setValue(PSTricksConstants.DEFAULT_FRAME_SEP*Figure.PPC); opaqueCB.setSelected(Text.DEFAULT_IS_OPAQUE); boolean ok = framedBoxCB.isSelected(); int id = boxesList.getSelectedIndex(); boolean simple = simpleRB.isSelected(); opaqueCB.setEnabled(!ok); simpleRB.setEnabled(ok); boxesList.setEnabled(ok && !simple); multipleRB.setEnabled(ok); frameSepField.setEnabled(ok && ( simple || id!=-1)); boxSepCB.setEnabled(ok && id!=-1); editBoxB.setEnabled(ok && (simple || id!=-1)); addBox.setEnabled(ok && !simple && id!=-1); removeBox.setEnabled(ok && !simple && id!=-1); modifyBox.setEnabled(ok && !simple && id!=-1); rectangleRB.setEnabled(ok && (simple || id!=-1)); circleRB.setEnabled(ok && (simple || id!=-1)); ellipseRB.setEnabled(ok && (simple || id!=-1)); diamondRB.setEnabled(ok && (simple || id!=-1)); triangleRB.setEnabled(ok && (simple || id!=-1)); boxes.clear(); boxesList.updateUI(); t.setHasFramedBox(ok); t.setHasSimpleFramedBox(simpleRB.isSelected()); } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } @Override public void saveParameters() { super.saveParameters(); if(!(figure instanceof Text)) throw new ClassCastException(); Text t2 = (Text) glimpsePanel.getGlimpseFigure(); Text t = (Text)figure; LaTeXDrawPoint2D p = t.getPosition(); t.setOpacityColor(opacityColorButton.getColor()); p.x = Double.valueOf(xCoord.getValue().toString()); p.y = Double.valueOf(yCoord.getValue().toString()); t.setText(textField.getText()); t.setSize(sizeChoice.getSelectedItem().toString()); t.setIsBold(buttonBold.isSelected()); t.setIsItalic(buttonItalic.isSelected()); t.setTextFont(fontChoice.getSelectedItem().toString()); t.updateFontsBorders(); t.setOpaque(opaqueCB.isSelected()); t.setHasFramedBox(framedBoxCB.isSelected() && (simpleRB.isSelected() || !t2.getMultipleBox().isEmpty())); if(framedBoxCB.isSelected()) t.setHasSimpleFramedBox(simpleRB.isSelected()); if(t2.hasSimpleFramedBox()) { t2.getSimpleBox().setText(t); t.setSimpleBox(t2.getSimpleBox()); } if(t2.hasSeveralBoxes()) { t.removeAllBoxes(); if(!t2.getMultipleBox().isEmpty()) t.setHasFramedBox(true); for(FramedBox fb : t2.getMultipleBox()) t.addBox(fb); } t.updateBorders(); drawPanel.getFrameParent().setExportAsMenu(true); drawPanel.getDraw().updateBorders(); drawPanel.updateDraw(true); } @Override public void setVisible(boolean visible, Figure selected, boolean deleteOnCancel, boolean isFramedBox) { try { if(!(selected instanceof Text)) throw new ClassCastException(); super.setVisible(visible, selected, deleteOnCancel, isFramedBox); } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } @Override public void itemStateChanged(ItemEvent e) { try { Object o = e.getSource(); Text t = (Text) glimpsePanel.getGlimpseFigure(); if(o instanceof JComboBox) { String name = ((JComboBox)o).getName(); if(name.equals(LABEL_FONT)) { setModified(true); t.setTextFont(fontChoice.getSelectedItem().toString()); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_SIZE)) { setModified(true); t.setSize(sizeChoice.getSelectedItem().toString()); glimpsePanel.repaint(); return ; } } super.itemStateChanged(e); } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } @Override public void keyReleased(KeyEvent e) { try { Object o = e.getSource(); Text t = (Text)glimpsePanel.getGlimpseFigure(); if(o instanceof JTextField) { String name = ((JTextField)o).getName(); if(name.equals(LABEL_TEXT)) { if(multipleRB.isSelected()) { boxes.removeAllElements(); boxesList.updateUI(); t.getMultipleBox().removeAllElements(); t.getTextPos().removeAllElements(); editBoxB.setEnabled(false); circleRB.setEnabled(false); ellipseRB.setEnabled(false); rectangleRB.setEnabled(false); triangleRB.setEnabled(false); diamondRB.setEnabled(false); boxSepCB.setEnabled(false); frameSepField.setEnabled(false); modifyBox.setEnabled(false); removeBox.setEnabled(false); } setModified(true); t.setText(textField.getText()); buttonOk.setEnabled(textField.getText().length()!=0); framedBoxCB.setEnabled(textField.getText().length()!=0); if(t.getSimpleBox()!=null) t.getSimpleBox().updateBoxSize(); glimpsePanel.repaint(); return ; } } super.keyReleased(e); } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } @Override public void stateChanged(ChangeEvent e) { try { Object o = e.getSource(); Text t = (Text)glimpsePanel.getGlimpseFigure(); if(o instanceof JSpinner) { String name = ((JSpinner)o).getName(); if(name.equals(LABEL_X)) { setModified(true); t.setX(Double.valueOf(xCoord.getValue().toString()).doubleValue()); if(t.getSimpleBox()!=null) t.getSimpleBox().updateBoxSize(); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_Y)) { setModified(true); t.setY(Double.valueOf(yCoord.getValue().toString()).doubleValue()); if(t.getSimpleBox()!=null) t.getSimpleBox().updateBoxSize(); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_FRAME_SEP)) { double val = Double.valueOf(frameSepField.getValue().toString()).doubleValue(); if(simpleRB.isSelected()) { t.getSimpleBox().setFrameSep(val); t.getSimpleBox().updateBoxSize(); } else { ((FramedBox)boxesList.getSelectedValue()).setFrameSep(val); t.updateFramedBoxes(); } setModified(true); glimpsePanel.repaint(); return ; } } if(o instanceof JTextField) { String name = ((JTextField)o).getName(); if(name.equals(LABEL_TEXT)) { setModified(true); t.setText(textField.getText()); if(t.getSimpleBox()!=null) t.getSimpleBox().updateBoxSize(); glimpsePanel.repaint(); return ; } } super.stateChanged(e); } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } public void focusGained(FocusEvent e) { try { Object o = e.getSource(); if(o instanceof JList) { String name = ((JList)o).getName(); if(name.equals(LABEL_BOX_LIST)) { int id = boxesList.getSelectedIndex(); frameSepField.setEnabled(id!=-1); boxSepCB.setEnabled(id!=-1); editBoxB.setEnabled(id!=-1); removeBox.setEnabled(id!=-1); modifyBox.setEnabled(id!=-1); rectangleRB.setEnabled(id!=-1); circleRB.setEnabled(id!=-1); ellipseRB.setEnabled(id!=-1); diamondRB.setEnabled(id!=-1); triangleRB.setEnabled(id!=-1); return ; } } } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } public void focusLost(FocusEvent e) { try { Object o = e.getSource(); if(o instanceof JList) { String name = ((JList)o).getName(); if(name.equals(LABEL_BOX_LIST)) { int id = boxesList.getSelectedIndex(); frameSepField.setEnabled(id!=-1); boxSepCB.setEnabled(id!=-1); editBoxB.setEnabled(id!=-1); removeBox.setEnabled(id!=-1); modifyBox.setEnabled(id!=-1); return ; } } } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } public void mouseClicked(MouseEvent e) { // Nothing to do. } public void mouseEntered(MouseEvent e) { // Nothing to do. } public void mouseExited(MouseEvent e) { // Nothing to do. } public void mousePressed(MouseEvent e) { // Nothing to do. } public void mouseReleased(MouseEvent e) { Object o = e.getSource(); if(o instanceof JList && boxesList!=null) { Object selection = boxesList.getSelectedValue(); if(multipleRB.isSelected() && selection instanceof FramedBox) { FramedBox fb = (FramedBox)selection; int style = fb.getBoxType(); if(style==FramedBox.BOX_RECTANGLE) rectangleRB.setSelected(true); else if(style==FramedBox.BOX_CIRCLE) circleRB.setSelected(true); else if(style==FramedBox.BOX_ELLIPSE) ellipseRB.setSelected(true); else if(style==FramedBox.BOX_TRIANGLE) triangleRB.setSelected(true); else if(style==FramedBox.BOX_DIAMOND) diamondRB.setSelected(true); setModified(true); frameSepField.setValue(fb.getFrameSep()); boxSepCB.setSelected(fb.isBoxSep()); } } } } /** * This class defines a frame to select the text to box. * @since 1.7 * @author Arnaud BLOUIN */ class SelectTextFrame extends JDialog implements ActionListener, MouseListener { private static final long serialVersionUID = 1L; protected JButton buttonOk; /** This field allows the set the text */ protected JTextField textField; /** The frame of parameters. */ protected ParametersTextFrame textFrame; /** The framed box use to test the validity of the new box. */ protected FramedBox framedBox; /** Allows to display a message in the frame. */ protected JLabel msg; /** The position of the first selected character when the frame is displayed. */ protected int startPos; /** The position of the last selected character when the frame is displayed. */ protected int endPos; /** * The constructor. * @param frame The frame of parameters of a text. */ public SelectTextFrame(ParametersTextFrame frame) { super(frame, LaTeXDrawLang.getString1_7("ParametersTextFrame.34"), true); //$NON-NLS-1$ startPos = 0; endPos = 0; setResizable(false); textFrame = frame; framedBox = new FramedBox((Text)frame.glimpsePanel.getGlimpseFigure()); JPanel pButtons = new JPanel(); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); setLocation(dim.width*1/3, dim.height*1/3); JPanel pGeneral = new JPanel(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.WEST; pGeneral.add(new JLabel(LaTeXDrawLang.getString1_7("ParametersTextFrame.35")), constraint); //$NON-NLS-1$ textField = new JTextField(); textField.setColumns(40); textField.setPreferredSize(new Dimension(250, 20)); textField.setMinimumSize(new Dimension(250, 20)); textField.setName(ParametersTextFrame.LABEL_TEXT); textField.setText(textFrame.textField.getText()); textField.setEditable(false); textField.addMouseListener(this); constraint.gridy++; constraint.gridwidth = 5; pGeneral.add(textField, constraint); msg = new JLabel(" ");//$NON-NLS-1$ constraint.gridy++; pGeneral.add(msg, constraint); pGeneral.setBorder(new CompoundBorder(new TitledBorder(null, LaTeXDrawLang.getString1_7("ParametersTextFrame.36"), //$NON-NLS-1$ TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); pGeneral.setPreferredSize(new Dimension(270, 100)); buttonOk = new JButton(AbstractParametersFrame.LABEL_OK); JButton buttonCancel = new JButton(AbstractParametersFrame.LABEL_CANCEL); GridLayout gridButton = new GridLayout(1, 2); buttonOk.setActionCommand(AbstractParametersFrame.NAME_BUTTON_OK); buttonOk.setEnabled(false); buttonCancel.setActionCommand(AbstractParametersFrame.NAME_BUTTON_CANCEL); pButtons.setLayout(gridButton); pButtons.add(buttonOk); pButtons.add(buttonCancel); buttonOk.addActionListener(this); buttonCancel.addActionListener(this); pButtons.setPreferredSize(new Dimension(30, 30)); pButtons.setMaximumSize(new Dimension(30, 30)); getContentPane().setLayout(new BorderLayout()); getContentPane().add(pGeneral, BorderLayout.CENTER); getContentPane().add(pButtons, BorderLayout.SOUTH); setSize(270, 170); } /** * Allows to do actions when an event is created. */ public void actionPerformed(ActionEvent e) { try { Object o = e.getSource(); if(o instanceof JButton || o instanceof JCheckBox) { String label = ((AbstractButton)o).getActionCommand(); if(label.equals(AbstractParametersFrame.NAME_BUTTON_CANCEL)) { textField.select(0, 0); setVisible(false); return; } if(label.equals(AbstractParametersFrame.NAME_BUTTON_OK)) { setVisible(false); return; } return ; } } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } /** * @return The indexes (start and end) of the selected text. */ public int[] getSelectedIndex() { if(textField!=null) { String text = textField.getSelectedText(); if(text==null || text.length()==0) return null; int[] is = {textField.getSelectionStart(), textField.getSelectionEnd()}; return is; } return null; } /** * @return The selected text. */ public String getSelectedText() { if(textField==null) return null; return textField.getSelectedText(); } public void mouseClicked(MouseEvent e) { // Nothing to do. } public void mouseEntered(MouseEvent e) { // Nothing to do. } public void mouseExited(MouseEvent e) { // Nothing to do. } public void mousePressed(MouseEvent e) { // Nothing to do. } public void mouseReleased(MouseEvent e) { Object o = e.getSource(); if(o instanceof JTextField) { String text = textField.getSelectedText(); int start = textField.getSelectionStart(), end = textField.getSelectionEnd(); Text txt = (Text)textFrame.glimpsePanel.getGlimpseFigure(); framedBox.setStart(start); framedBox.setEnd(end); boolean overlap = framedBox.overlap(txt.getMultipleBox()); if(overlap) msg.setText(LaTeXDrawLang.getString1_7("ParametersTextFrame.37")); //$NON-NLS-1$ else msg.setText(" ");//$NON-NLS-1$ if(text==null || text.length()==0) msg.setText(" ");//$NON-NLS-1$ buttonOk.setEnabled(text!=null && text.length()>0 && !overlap); } } @Override public void setVisible(boolean ok) { if(ok) { textField.setText(((Text)textFrame.glimpsePanel.getGlimpseFigure()).getText()); textField.setSelectionStart(0); textField.setSelectionEnd(0); buttonOk.setEnabled(false); msg.setText(" ");//$NON-NLS-1$ } super.setVisible(ok); } /** * Allows to show the frame and define the selected text. * @param start The position of the first selected character. * @param end The position of the last selected character. */ public void show(int start, int end) { startPos = start; endPos = end; textField.select(start, end); buttonOk.setEnabled(start=0); setVisible(true); } @Override public void paint(Graphics g) { textField.select(startPos, endPos); buttonOk.setEnabled(startPos=0); super.paint(g); } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/ParametersAxeFrame.java0000644000000000000000000006223111347255510021672 0ustar package latexDraw.ui.dialog; import java.awt.*; import java.awt.event.ActionEvent; import javax.swing.*; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import latexDraw.figures.Axe; import latexDraw.figures.Figure; import latexDraw.figures.GridShape; import latexDraw.lang.LaTeXDrawLang; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.DrawPanel; /** * This class defines the frame allowing to modify axes.
*
* This file is part of LaTeXDraw.
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 08/17/06
* @author Arnaud BLOUIN
* @since 1.8
* @version 2.0.0
*/ public class ParametersAxeFrame extends AbstractGridShapeFrame { private static final long serialVersionUID = 1L; protected JCheckBox drawXLabel; protected JCheckBox drawYLabel; protected JCheckBox drawXTicks; protected JCheckBox drawYTicks; protected JCheckBox defineLabelDistCB; protected JComboBox axeShapeChoice; protected JComboBox ticksShapeChoice; protected JSpinner ticksSizeField; protected JSpinner labelXDistField; protected JSpinner labelYDistField; /** Allows to change the increment of the X labels. */ protected JSpinner labelXIncrement; /** Allows to change the increment of the Y labels. */ protected JSpinner labelYIncrement; /** Allows to change the origin of the X labels. */ protected JSpinner labelXOrigin; /** Allows to change the origin of the Y labels. */ protected JSpinner labelYOrigin; protected JCheckBox showOriginCB; public static final String LABEL_DRAW_X_LABELS = "dispXLab";//$NON-NLS-1$ public static final String LABEL_DEF_LABELS_DIST = "defDist";//$NON-NLS-1$ public static final String LABEL_DRAW_Y_LABELS = "dispYLab";//$NON-NLS-1$ public static final String LABEL_DRAW_X_TICKS = "dispXTicks";//$NON-NLS-1$ public static final String LABEL_DRAW_Y_TICKS = "dispYTicks";//$NON-NLS-1$ public static final String LABEL_Y_LABEL_DIST = "xLabSep";//$NON-NLS-1$ public static final String LABEL_X_LABEL_DIST = "yLabSep";//$NON-NLS-1$ public static final String LABEL_TICKS_SIZE_FIELD = "ticksSizeField";//$NON-NLS-1$ public static final String LABEL_LABEL_X_INCR = "labXInc";//$NON-NLS-1$ public static final String LABEL_LABEL_Y_INCR = "labYInc";//$NON-NLS-1$ public static final String LABEL_LABEL_X_ORIG = "labXOrig";//$NON-NLS-1$ public static final String LABEL_LABEL_Y_ORIG = "labYOrig";//$NON-NLS-1$ public static final String LABEL_SHOW_ORIGIN = "showOrig";//$NON-NLS-1$ public ParametersAxeFrame(Frame parent, DrawPanel d, boolean attachToMainFrame) { super(parent, d, attachToMainFrame); try { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JTabbedPane tabbedPane = new JTabbedPane(); JPanel pButton = createButtonsPanel(this); JPanel pGeneral = new JPanel(); JPanel pAxes = new JPanel(); JPanel pOther = new JPanel(new FlowLayout(FlowLayout.LEFT)); pAxes.setLayout(new BoxLayout(pAxes, BoxLayout.Y_AXIS)); JPanel positionP = createPositionPanel(false); pGeneral.setLayout(new BoxLayout(pGeneral, BoxLayout.Y_AXIS)); pGeneral.add(positionP); pGeneral.add(createBordersPanel(false)); pGeneral.add(pOther); pOther.add(new JLabel(LaTeXDrawLang.getString1_8("ParametersAxeFrame.0"))); //$NON-NLS-1$ axeShapeChoice = Axe.createAxeStyleChoice(); axeShapeChoice.addActionListener(this); pOther.add(axeShapeChoice); showOriginCB = new JCheckBox(LaTeXDrawLang.getString1_8("ParametersAxeFrame.1"), true); //$NON-NLS-1$ showOriginCB.setActionCommand(LABEL_SHOW_ORIGIN); showOriginCB.setName(LABEL_SHOW_ORIGIN); showOriginCB.addActionListener(this); pOther.add(showOriginCB); String axesS = LaTeXDrawLang.getString1_8("ParametersAxeFrame.2"); //$NON-NLS-1$ pOther.setBorder(new CompoundBorder(new TitledBorder(null, axesS, TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); pAxes.add(createLabelsPanel()); pAxes.add(createTicksPanel()); tabbedPane.addTab(TITLE_TABBED_PANE_GENERAL, pGeneral); tabbedPane.addTab(axesS, pAxes); tabbedPane.addTab(NAME_TABBEDPANE_ARROW, createArrowPanel(true, false)); BoxLayout bl = new BoxLayout(getContentPane(), BoxLayout.Y_AXIS); getContentPane().setLayout(bl); getContentPane().add(glimpsePanelZoom); getContentPane().add(tabbedPane); getContentPane().add(pButton); pack(); setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2); setVisible(false); }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } protected JPanel createLabelsPanel() { JPanel pLabels = new JPanel(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.WEST; drawXLabel = new JCheckBox(LaTeXDrawLang.getString1_8("ParametersAxeFrame.3"), true); //$NON-NLS-1$ drawXLabel.setActionCommand(LABEL_DRAW_X_LABELS); drawXLabel.setName(LABEL_DRAW_X_LABELS); drawXLabel.addActionListener(this); constraint.gridx=0; pLabels.add(drawXLabel, constraint); drawYLabel = new JCheckBox(LaTeXDrawLang.getString1_8("ParametersAxeFrame.4"), true); //$NON-NLS-1$ drawYLabel.setActionCommand(LABEL_DRAW_Y_LABELS); drawYLabel.setName(LABEL_DRAW_Y_LABELS); drawYLabel.addActionListener(this); constraint.gridx+=2; pLabels.add(drawYLabel, constraint); constraint.gridx = 0; constraint.gridy++; constraint.gridwidth=2; invertXLabelsCB = new JCheckBox(LABEL_ISXLABEL); invertXLabelsCB.setText(LABEL_ISXLABEL); invertXLabelsCB.setSelected(GridShape.DEFAULT_ISYLABELWEST); invertXLabelsCB.setActionCommand(LABEL_ISXLABEL); invertXLabelsCB.addActionListener(this); pLabels.add(invertXLabelsCB, constraint); constraint.gridx+=2; invertYLabelsCB = new JCheckBox(LABEL_ISYLABEL); invertYLabelsCB.setText(LABEL_ISYLABEL); invertYLabelsCB.setSelected(GridShape.DEFAULT_ISXLABELSOUTH); invertYLabelsCB.addActionListener(this); invertYLabelsCB.setActionCommand(LABEL_ISYLABEL); pLabels.add(invertYLabelsCB, constraint); constraint.gridx=0; constraint.gridy++; defineLabelDistCB = new JCheckBox(LABEL_DEF_LABELS_DIST); defineLabelDistCB.setText(LaTeXDrawLang.getString1_8("ParametersAxeFrame.5")); //$NON-NLS-1$ defineLabelDistCB.setSelected(false); defineLabelDistCB.addActionListener(this); defineLabelDistCB.setActionCommand(LABEL_DEF_LABELS_DIST); pLabels.add(defineLabelDistCB, constraint); constraint.gridwidth=1; constraint.gridx=0; constraint.gridy++; pLabels.add(new JLabel(LaTeXDrawLang.getString1_8("ParametersAxeFrame.6")), constraint); //$NON-NLS-1$ SpinnerModel model = new SpinnerNumberModel(0.01,0.01,1000,0.05); labelXDistField = new JSpinner(model); labelXDistField.setEditor(new JSpinner.NumberEditor(labelXDistField, "0.00"));//$NON-NLS-1$ labelXDistField.addChangeListener(this); labelXDistField.setName(LABEL_X_LABEL_DIST); labelXDistField.setEnabled(false); constraint.gridx++; pLabels.add(labelXDistField, constraint); constraint.gridx++; pLabels.add(new JLabel(LaTeXDrawLang.getString1_8("ParametersAxeFrame.7")), constraint); //$NON-NLS-1$ model = new SpinnerNumberModel(0.01,0.01,1000,0.05); labelYDistField = new JSpinner(model); labelYDistField.setEditor(new JSpinner.NumberEditor(labelYDistField, "0.00"));//$NON-NLS-1$ labelYDistField.addChangeListener(this); labelYDistField.setEnabled(false); labelYDistField.setName(LABEL_Y_LABEL_DIST); constraint.gridx++; pLabels.add(labelYDistField, constraint); constraint.gridx=0; constraint.gridy++; pLabels.add(new JLabel(LaTeXDrawLang.getString1_8("ParametersAxeFrame.8")), constraint); //$NON-NLS-1$ model = new SpinnerNumberModel(0.0001,0.0001,1000,1); labelXIncrement = new JSpinner(model); labelXIncrement.setEditor(new JSpinner.NumberEditor(labelXIncrement, "0.000"));//$NON-NLS-1$ labelXIncrement.addChangeListener(this); labelXIncrement.setName(LABEL_LABEL_X_INCR); constraint.gridx++; pLabels.add(labelXIncrement, constraint); constraint.gridx++; pLabels.add(new JLabel(LaTeXDrawLang.getString1_8("ParametersAxeFrame.9")), constraint); //$NON-NLS-1$ model = new SpinnerNumberModel(0.0001,0.0001,1000,1); labelYIncrement = new JSpinner(model); labelYIncrement.setEditor(new JSpinner.NumberEditor(labelYIncrement, "0.000"));//$NON-NLS-1$ labelYIncrement.addChangeListener(this); labelYIncrement.setName(LABEL_LABEL_Y_INCR); constraint.gridx++; pLabels.add(labelYIncrement, constraint); constraint.gridx=0; constraint.gridy++; pLabels.add(new JLabel(LaTeXDrawLang.getString1_8("ParametersAxeFrame.10")), constraint); //$NON-NLS-1$ model = new SpinnerNumberModel(1,-1000,1000,1); labelXOrigin = new JSpinner(model); labelXOrigin.setEditor(new JSpinner.NumberEditor(labelXOrigin, "0"));//$NON-NLS-1$ labelXOrigin.addChangeListener(this); labelXOrigin.setName(LABEL_LABEL_X_ORIG); constraint.gridx++; pLabels.add(labelXOrigin, constraint); constraint.gridx++; pLabels.add(new JLabel(LaTeXDrawLang.getString1_8("ParametersAxeFrame.11")), constraint); //$NON-NLS-1$ model = new SpinnerNumberModel(1,-1000,1000,1); labelYOrigin = new JSpinner(model); labelYOrigin.setEditor(new JSpinner.NumberEditor(labelYOrigin, "0"));//$NON-NLS-1$ labelYOrigin.addChangeListener(this); labelYOrigin.setName(LABEL_LABEL_Y_ORIG); constraint.gridx++; pLabels.add(labelYOrigin, constraint); pLabels.setBorder(new CompoundBorder(new TitledBorder(null, LaTeXDrawLang.getString1_8("ParametersAxeFrame.12"), //$NON-NLS-1$ TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); return pLabels; } protected JPanel createTicksPanel() { JPanel pTicks = new JPanel(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.WEST; pTicks.add(new JLabel(LaTeXDrawLang.getString1_8("ParametersAxeFrame.13")), constraint); //$NON-NLS-1$ SpinnerModel model = new SpinnerNumberModel(1,1,1000,0.5); ticksSizeField = new JSpinner(model); ticksSizeField.setEditor(new JSpinner.NumberEditor(ticksSizeField, "0.00"));//$NON-NLS-1$ ticksSizeField.addChangeListener(this); ticksSizeField.setName(LABEL_TICKS_SIZE_FIELD); constraint.gridx++; pTicks.add(ticksSizeField, constraint); constraint.gridx++; pTicks.add(new JLabel(LaTeXDrawLang.getString1_8("ParametersAxeFrame.14")), constraint); //$NON-NLS-1$ ticksShapeChoice = Axe.createTicksStyleChoice(); ticksShapeChoice.addActionListener(this); constraint.gridx++; pTicks.add(ticksShapeChoice, constraint); drawXTicks = new JCheckBox(LaTeXDrawLang.getString1_8("ParametersAxeFrame.15"), true); //$NON-NLS-1$ drawXTicks.setActionCommand(LABEL_DRAW_X_TICKS); drawXTicks.setName(LABEL_DRAW_X_TICKS); drawXTicks.addActionListener(this); constraint.gridx=0; constraint.gridy++; pTicks.add(drawXTicks, constraint); drawYTicks = new JCheckBox(LaTeXDrawLang.getString1_8("ParametersAxeFrame.16"), true); //$NON-NLS-1$ drawYTicks.setActionCommand(LABEL_DRAW_Y_TICKS); drawYTicks.setName(LABEL_DRAW_Y_TICKS); drawYTicks.addActionListener(this); constraint.gridx+=1; pTicks.add(drawYTicks, constraint); pTicks.setBorder(new CompoundBorder(new TitledBorder(null, LaTeXDrawLang.getString1_8("ParametersAxeFrame.17"), //$NON-NLS-1$ TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); return pTicks; } @Override public void setVisible(boolean visible, Figure selected, boolean deleteOnCancel, boolean isFramedBox) { try { if(!(selected instanceof Axe)) throw new ClassCastException(); super.setVisible(visible, selected, deleteOnCancel, isFramedBox); } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } @Override public void setFigureFrameField() { super.setFigureFrameField(); Axe a = (Axe)figure; int labelsDisplayed = a.getLabelsDisplayed(); int ticksDisplayed = a.getTicksDisplayed(); if(labelsDisplayed==Axe.LABELS_DISPLAYED_ALL_VALUE || labelsDisplayed==Axe.LABELS_DISPLAYED_X_VALUE) drawXLabel.setSelected(true); if(labelsDisplayed==Axe.LABELS_DISPLAYED_ALL_VALUE || labelsDisplayed==Axe.LABELS_DISPLAYED_Y_VALUE) drawYLabel.setSelected(true); if(ticksDisplayed==Axe.LABELS_DISPLAYED_ALL_VALUE || ticksDisplayed==Axe.LABELS_DISPLAYED_X_VALUE) drawXTicks.setSelected(true); if(ticksDisplayed==Axe.LABELS_DISPLAYED_ALL_VALUE || ticksDisplayed==Axe.LABELS_DISPLAYED_Y_VALUE) drawYTicks.setSelected(true); String style = a.getAxesStyleToken(); if(style.equals(PSTricksConstants.TOKEN_AXES_STYLE_AXES)) axeShapeChoice.setSelectedItem(Axe.LABEL_STYLE_AXE); else if(style.equals(PSTricksConstants.TOKEN_AXES_STYLE_FRAME)) axeShapeChoice.setSelectedItem(Axe.LABEL_STYLE_FRAME); else if(style.equals(PSTricksConstants.TOKEN_AXES_STYLE_NONE)) axeShapeChoice.setSelectedItem(Axe.LABEL_STYLE_NONE); style = a.getTicksStyleToken(); if(style.equals(PSTricksConstants.TOKEN_TICKS_STYLE_FULL)) ticksShapeChoice.setSelectedItem(Axe.LABEL_STYLE_TICKS_FULL); else if(style.equals(PSTricksConstants.TOKEN_TICKS_STYLE_BOTTOM)) ticksShapeChoice.setSelectedItem(Axe.LABEL_STYLE_TICKS_BOTTOM); else if(style.equals(PSTricksConstants.TOKEN_TICKS_STYLE_TOP)) ticksShapeChoice.setSelectedItem(Axe.LABEL_STYLE_TICKS_TOP); ticksSizeField.setValue(a.getTicksSize()); boolean ok = a.getDistLabelsX()!=0 || a.getDistLabelsY()!=0; defineLabelDistCB.setSelected(ok); labelXDistField.setEnabled(ok); labelYDistField.setEnabled(ok); labelXDistField.removeChangeListener(this); labelYDistField.removeChangeListener(this); labelXDistField.setValue(a.getDistLabelsX()==0 ? a.getIncrement().x : a.getDistLabelsX()); labelYDistField.setValue(a.getDistLabelsY()==0 ? a.getIncrement().y : a.getDistLabelsY()); labelXDistField.addChangeListener(this); labelYDistField.addChangeListener(this); labelXIncrement.setValue(a.getIncrement().x); labelYIncrement.setValue(a.getIncrement().y); labelXOrigin.setValue((int)a.getOrigin().x); labelYOrigin.setValue((int)a.getOrigin().y); showOriginCB.setSelected(a.isShowOrigin()); glimpsePanel.repaint(); } @Override public void setDefaultsValues() { super.setDefaultsValues(); drawXLabel.setSelected(true); drawYLabel.setSelected(true); drawXTicks.setSelected(true); drawYTicks.setSelected(true); Axe axe = (Axe)glimpsePanel.glimpseFigure; axe.setLabelsDisplayed(Axe.LABELS_DISPLAYED_ALL_VALUE); axeShapeChoice.setSelectedIndex(0); ticksShapeChoice.setSelectedIndex(0); ticksSizeField.setValue(PSTricksConstants.DEFAULT_TICKS_SIZE); defineLabelDistCB.setSelected(false); labelXDistField.setEnabled(false); labelYDistField.setEnabled(false); axe.setDistLabelsX(0); axe.setDistLabelsY(0); axe.setIncrementX(PSTricksConstants.DEFAULT_DX); axe.setIncrementY(PSTricksConstants.DEFAULT_DY); axe.setOriginX(PSTricksConstants.DEFAULT_OX); axe.setOriginY(PSTricksConstants.DEFAULT_OY); axe.setShowOrigin(PSTricksConstants.DEFAULT_SHOW_ORIGIN); axe.updateBorders(); glimpsePanel.repaint(); } @Override public void saveParameters() { super.saveParameters(); Axe a = (Axe)figure; double xVal = Float.valueOf(labelXDistField.getValue().toString()).doubleValue(); double yVal = Float.valueOf(labelYDistField.getValue().toString()).doubleValue(); if(drawXLabel.isSelected()) if(drawYLabel.isSelected()) a.setLabelsDisplayed(Axe.LABELS_DISPLAYED_ALL_VALUE); else a.setLabelsDisplayed(Axe.LABELS_DISPLAYED_X_VALUE); else if(drawYLabel.isSelected()) a.setLabelsDisplayed(Axe.LABELS_DISPLAYED_Y_VALUE); else a.setLabelsDisplayed(Axe.LABELS_DISPLAYED_NON_VALUE); if(drawXTicks.isSelected()) if(drawYTicks.isSelected()) a.setTicksDisplayed(Axe.LABELS_DISPLAYED_ALL_VALUE); else a.setTicksDisplayed(Axe.LABELS_DISPLAYED_X_VALUE); else if(drawYTicks.isSelected()) a.setTicksDisplayed(Axe.LABELS_DISPLAYED_Y_VALUE); else a.setTicksDisplayed(Axe.LABELS_DISPLAYED_NON_VALUE); String selected = axeShapeChoice.getSelectedItem().toString(); if(selected.equals(Axe.LABEL_STYLE_AXE)) a.setAxesStyle(Axe.AXES_STYLE_AXES_VALUE); else if(selected.equals(Axe.LABEL_STYLE_FRAME)) a.setAxesStyle(Axe.AXES_STYLE_FRAME_VALUE); else if(selected.equals(Axe.LABEL_STYLE_NONE)) a.setAxesStyle(Axe.AXES_STYLE_NONE_VALUE); selected = ticksShapeChoice.getSelectedItem().toString(); if(selected.equals(Axe.LABEL_STYLE_TICKS_FULL)) a.setTicksStyle(Axe.TICKS_STYLE_FULL_VALUE); else if(selected.equals(Axe.LABEL_STYLE_TICKS_TOP)) a.setTicksStyle(Axe.TICKS_STYLE_TOP_VALUE); else if(selected.equals(Axe.LABEL_STYLE_TICKS_BOTTOM)) a.setTicksStyle(Axe.TICKS_STYLE_BOTTOM_VALUE); a.setTicksSize(Float.valueOf(ticksSizeField.getValue().toString()).doubleValue()); a.setDistLabelsX(defineLabelDistCB.isSelected() ? xVal : 0); a.setDistLabelsY(defineLabelDistCB.isSelected() ? yVal : 0); a.setIncrementX(Float.valueOf(labelXIncrement.getValue().toString()).doubleValue()); a.setIncrementY(Float.valueOf(labelYIncrement.getValue().toString()).doubleValue()); a.setOriginX(Float.valueOf(labelXOrigin.getValue().toString()).intValue()); a.setOriginY(Float.valueOf(labelYOrigin.getValue().toString()).intValue()); a.setShowOrigin(showOriginCB.isSelected()); a.updateBorders(); drawPanel.getFrameParent().setExportAsMenu(true); drawPanel.getDraw().updateBorders(); drawPanel.updateDraw(true); } @Override public void actionPerformed(ActionEvent e) { try { Object o = e.getSource(); Axe a = (Axe)glimpsePanel.getGlimpseFigure(); if(o instanceof JCheckBox) { String label = ((JCheckBox)o).getActionCommand(); if(label.equals(LABEL_SHOW_ORIGIN)) { setModified(true); a.setShowOrigin(showOriginCB.isSelected()); glimpsePanel.repaint(); return ; } if(label.equals(LABEL_DEF_LABELS_DIST)) { double xVal = Float.valueOf(labelXDistField.getValue().toString()).doubleValue(); double yVal = Float.valueOf(labelYDistField.getValue().toString()).doubleValue(); boolean isSelected = defineLabelDistCB.isSelected(); setModified(true); labelXDistField.setEnabled(isSelected); labelYDistField.setEnabled(isSelected); a.setDistLabelsX(isSelected ? xVal : 0); a.setDistLabelsY(isSelected ? yVal : 0); a.updateBorders(); glimpsePanel.repaint(); return ; } if(label.equals(LABEL_DRAW_X_LABELS) || label.equals(LABEL_DRAW_Y_LABELS)) { if(drawXLabel.isSelected()) if(drawYLabel.isSelected()) a.setLabelsDisplayed(Axe.LABELS_DISPLAYED_ALL_VALUE); else a.setLabelsDisplayed(Axe.LABELS_DISPLAYED_X_VALUE); else if(drawYLabel.isSelected()) a.setLabelsDisplayed(Axe.LABELS_DISPLAYED_Y_VALUE); else a.setLabelsDisplayed(Axe.LABELS_DISPLAYED_NON_VALUE); setModified(true); glimpsePanel.repaint(); return ; } if(label.equals(LABEL_DRAW_X_TICKS) || label.equals(LABEL_DRAW_Y_TICKS)) { if(drawXTicks.isSelected()) if(drawYTicks.isSelected()) a.setTicksDisplayed(Axe.LABELS_DISPLAYED_ALL_VALUE); else a.setTicksDisplayed(Axe.LABELS_DISPLAYED_X_VALUE); else if(drawYTicks.isSelected()) a.setTicksDisplayed(Axe.LABELS_DISPLAYED_Y_VALUE); else a.setTicksDisplayed(Axe.LABELS_DISPLAYED_NON_VALUE); setModified(true); glimpsePanel.repaint(); return ; } } if(o instanceof JComboBox) { String label = ((JComboBox)o).getActionCommand(); if(label.equals(Axe.ACTION_CMD_AXE_STYLE_CHOICE)) { String selected = axeShapeChoice.getSelectedItem().toString(); if(selected.equals(Axe.LABEL_STYLE_AXE)) a.setAxesStyle(Axe.AXES_STYLE_AXES_VALUE); else if(selected.equals(Axe.LABEL_STYLE_FRAME)) a.setAxesStyle(Axe.AXES_STYLE_FRAME_VALUE); else if(selected.equals(Axe.LABEL_STYLE_NONE)) a.setAxesStyle(Axe.AXES_STYLE_NONE_VALUE); setModified(true); boolean ok = selected.equals(Axe.LABEL_STYLE_AXE); arrow1Choice.setEnabled(ok); arrow2Choice.setEnabled(ok); glimpsePanel.repaint(); return ; } if(label.equals(Axe.ACTION_CMD_TICKS_STYLE_CHOICE)) { String selected = ticksShapeChoice.getSelectedItem().toString(); if(selected.equals(Axe.LABEL_STYLE_TICKS_FULL)) a.setTicksStyle(Axe.TICKS_STYLE_FULL_VALUE); else if(selected.equals(Axe.LABEL_STYLE_TICKS_TOP)) a.setTicksStyle(Axe.TICKS_STYLE_TOP_VALUE); else if(selected.equals(Axe.LABEL_STYLE_TICKS_BOTTOM)) a.setTicksStyle(Axe.TICKS_STYLE_BOTTOM_VALUE); setModified(true); glimpsePanel.repaint(); return ; } return ; } } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } super.actionPerformed(e); } @Override public void stateChanged(ChangeEvent e) { try { Object o = e.getSource(); Axe a = (Axe)glimpsePanel.getGlimpseFigure(); if(o instanceof JSpinner) { String name = ((JSpinner)o).getName(); if(name.equals(LABEL_TICKS_SIZE_FIELD)) { setModified(true); a.setTicksSize(Float.valueOf(ticksSizeField.getValue().toString()).doubleValue()); a.updateBorders(); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_LABEL_X_INCR)) { setModified(true); a.setIncrementX(Float.valueOf(labelXIncrement.getValue().toString()).doubleValue()); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_LABEL_Y_INCR)) { setModified(true); a.setIncrementY(Float.valueOf(labelYIncrement.getValue().toString()).doubleValue()); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_LABEL_X_ORIG)) { setModified(true); a.setOriginX(Float.valueOf(labelXOrigin.getValue().toString()).intValue()); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_LABEL_Y_ORIG)) { setModified(true); a.setOriginY(Float.valueOf(labelYOrigin.getValue().toString()).intValue()); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_X_LABEL_DIST)) { setModified(true); a.setDistLabelsX(Float.valueOf(labelXDistField.getValue().toString()).doubleValue()); a.updateBorders(); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_Y_LABEL_DIST)) { setModified(true); a.setDistLabelsY(Float.valueOf(labelYDistField.getValue().toString()).doubleValue()); a.updateBorders(); glimpsePanel.repaint(); return ; } } } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } super.stateChanged(e); } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/ParametersEllipseRectangleFrame.java0000644000000000000000000003257111347255510024403 0ustar package latexDraw.ui.dialog; import java.awt.*; import java.awt.event.ActionEvent; import javax.swing.*; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import latexDraw.figures.Ellipse; import latexDraw.figures.Figure; import latexDraw.figures.LaTeXDrawRectangle; import latexDraw.lang.LaTeXDrawLang; import latexDraw.ui.DrawPanel; import latexDraw.util.LaTeXDrawPoint2D; /** * This class defines the frame which allows to change the parameters of ellipses and rectangles.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class ParametersEllipseRectangleFrame extends AbstractParametersFrame { private static final long serialVersionUID = 1L; /** Allows to change the x-coordinates of the centre of the figure */ protected JSpinner centerXField; /** Allows to change the y-coordinates of the centre of the figure */ protected JSpinner centerYField; /** Allows to change the radius of the width of the ellipse */ protected JSpinner widthRadiusField; /** Allows to change the radius of the height of the ellipse */ protected JSpinner heightRadiusField; /** Allows to set if the rectangle will be round (only for rectangle */ protected JCheckBox isRound; /** Allows to change the angle of the round corner. */ protected JSpinner frameArcField; /** The panel containing to set the roundness of the figure. */ protected JPanel roundPanel; /** * The constructor by default * @param p The drawPanel */ public ParametersEllipseRectangleFrame(Frame parent, DrawPanel p, boolean attachToMainFrame) { super(parent, p, attachToMainFrame); try { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JTabbedPane tabbedPane = new JTabbedPane(); JPanel pButton = createButtonsPanel(this); JPanel pGeneral = new JPanel(); pGeneral.setLayout(new BoxLayout(pGeneral, BoxLayout.Y_AXIS)); JPanel coordP = new JPanel(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.CENTER; coordP.add(new JLabel(LABEL_CENTER_X), constraint); SpinnerModel model = new SpinnerNumberModel(0,0,10000,0.1); centerXField = new JSpinner(model); centerXField.setEditor(new JSpinner.NumberEditor(centerXField, "0.0"));//$NON-NLS-1$ centerXField.addChangeListener(this); centerXField.setName(LABEL_CENTER_X); constraint.gridx = 1; coordP.add(centerXField, constraint); constraint.gridx++; coordP.add(new JLabel(LABEL_CENTER_Y), constraint); model = new SpinnerNumberModel(0,0,10000,0.1); centerYField = new JSpinner(model); centerYField.setEditor(new JSpinner.NumberEditor(centerYField, "0.0"));//$NON-NLS-1$ centerYField.addChangeListener(this); centerYField.setName(LABEL_CENTER_Y); constraint.gridx++; coordP.add(centerYField, constraint); constraint.gridx = 0; constraint.gridy++; coordP.add(new JLabel(LABEL_WIDTH), constraint); model = new SpinnerNumberModel(0.1,0.1,10000,0.1); widthRadiusField = new JSpinner(model); widthRadiusField.setEditor(new JSpinner.NumberEditor(widthRadiusField, "0.0"));//$NON-NLS-1$ widthRadiusField.addChangeListener(this); widthRadiusField.setName(LABEL_WIDTH); constraint.gridx++; coordP.add(widthRadiusField, constraint); constraint.gridx++; coordP.add(new JLabel(LABEL_HEIGHT), constraint); model = new SpinnerNumberModel(0.1,0.1,10000,0.1); heightRadiusField = new JSpinner(model); heightRadiusField.setEditor(new JSpinner.NumberEditor(heightRadiusField, "0.0"));//$NON-NLS-1$ heightRadiusField.addChangeListener(this); heightRadiusField.setName(LABEL_HEIGHT); constraint.gridx++; coordP.add(heightRadiusField, constraint); constraint.gridx = 0; constraint.gridy++; coordP.add(new JLabel(LABEL_ROTATION), constraint); constraint.gridx++; coordP.add(rotationField, constraint); coordP.setBorder(new CompoundBorder(new TitledBorder(null, LABEL_POSITION_DIMENSIONS, TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); pGeneral.add(coordP); pGeneral.add(createBordersPanel(true)); pGeneral.add(createDoubleLinePanel()); pGeneral.add(createFillPanel()); JPanel pOther = new JPanel(); pOther.setLayout(new BoxLayout(pOther, BoxLayout.Y_AXIS)); pOther.add(createHatchingPanel()); pOther.add(createShadowPanel()); pOther.add(createGradientPanel()); roundPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); isRound = new JCheckBox(LABEL_ISROUND); isRound.addActionListener(this); isRound.setActionCommand(LABEL_ISROUND); roundPanel.add(isRound); roundPanel.add(new JLabel(LABEL_ROUND_CORNER)); model = new SpinnerNumberModel(LaTeXDrawRectangle.DEFAULT_FRAME_ARC, 0.01, 1,0.05); frameArcField = new JSpinner(model); frameArcField.setName(LABEL_ROUND_CORNER); frameArcField.setEditor(new JSpinner.NumberEditor(frameArcField, "0.00"));//$NON-NLS-1$ frameArcField.addChangeListener(this); frameArcField.setEnabled(false); roundPanel.add(frameArcField); roundPanel.setBorder(new CompoundBorder(new TitledBorder(null, LaTeXDrawLang.getString1_7("AbstractParametersFrame.6"), //$NON-NLS-1$ TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); pOther.add(roundPanel); tabbedPane.addTab(TITLE_TABBED_PANE_GENERAL, pGeneral); tabbedPane.addTab(TITLE_TABBED_PANE_OTHERS, pOther); BoxLayout bl = new BoxLayout(getContentPane(), BoxLayout.Y_AXIS); getContentPane().setLayout(bl); getContentPane().add(glimpsePanelZoom); getContentPane().add(tabbedPane); getContentPane().add(pButton); pack(); setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2); setVisible(false); }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } @Override public void actionPerformed(ActionEvent e) { try { Object o = e.getSource(); Figure f = glimpsePanel.getGlimpseFigure(); if(o instanceof JCheckBox) { String label = ((JCheckBox)o).getActionCommand(); if(label.equals(LABEL_ISROUND)) { setModified(true); ((LaTeXDrawRectangle)f).setIsRound(isRound.isSelected()); frameArcField.setEnabled(isRound.isSelected()); glimpsePanel.repaint(); return ; } } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } super.actionPerformed(e); } @Override public void setFigureFrameField() { LaTeXDrawPoint2D NW = figure.getTheNWPoint(), SE = figure.getTheSEPoint(); centerXField.setValue((NW.x+SE.x)/2.); centerYField.setValue((NW.y+SE.y)/2.); widthRadiusField.setValue((SE.x-NW.x)/2.); heightRadiusField.setValue((SE.y-NW.y)/2.); if(figure instanceof LaTeXDrawRectangle) { isRound.setSelected(((LaTeXDrawRectangle)figure).isRound()); frameArcField.setEnabled(isRound.isSelected()); frameArcField.setValue(((LaTeXDrawRectangle)figure).getFrameArc()); roundPanel.setVisible(true); } else roundPanel.setVisible(false); } @Override public void setDefaultsValues() { super.setDefaultsValues(); if(figure instanceof LaTeXDrawRectangle) { isRound.setSelected(LaTeXDrawRectangle.DEFAULT_ISROUND); frameArcField.setValue(LaTeXDrawRectangle.DEFAULT_FRAME_ARC); ((LaTeXDrawRectangle)glimpsePanel.getGlimpseFigure()).setIsRound(LaTeXDrawRectangle.DEFAULT_ISROUND); } } @Override public void stateChanged(ChangeEvent e) { try { Object o = e.getSource(); Figure f = glimpsePanel.getGlimpseFigure(); if(o instanceof JSpinner) { String name = ((JSpinner)o).getName(); if(name.equals(LABEL_ROUND_CORNER)) { if(f instanceof LaTeXDrawRectangle) { ((LaTeXDrawRectangle)f).setFrameArc(Double.valueOf(frameArcField.getValue().toString()).doubleValue()); setModified(true); glimpsePanel.repaint(); } return ; } LaTeXDrawPoint2D p1,p2,p3,p4; float widthRadius = Float.valueOf(widthRadiusField.getValue().toString()).floatValue(); float heightRadius = Float.valueOf(heightRadiusField.getValue().toString()).floatValue(); float x = Float.valueOf(centerXField.getValue().toString()).floatValue(); float y = Float.valueOf(centerYField.getValue().toString()).floatValue(); if(figure instanceof Ellipse) { Ellipse el = (Ellipse)f; p1 = el.getBordersPoint(0); p2 = el.getBordersPoint(1); p3 = el.getBordersPoint(2); p4 = el.getBordersPoint(3); } else { LaTeXDrawRectangle r = (LaTeXDrawRectangle)f; p1 = r.getPoint(0); p2 = r.getPoint(1); p3 = r.getPoint(2); p4 = r.getPoint(3); } if(name.equals(LABEL_CENTER_X)) { p1.x = x - widthRadius; p2.x = x + widthRadius; p3.x = x - widthRadius; p4.x = x + widthRadius; f.updateShape(); setModified(true); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_CENTER_Y)) { p1.y = y - heightRadius; p2.y = y - heightRadius; p3.y = y + heightRadius; p4.y = y + heightRadius; f.updateShape(); setModified(true); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_HEIGHT)) { p1.y = y - heightRadius; p2.y = y - heightRadius; p3.y = y + heightRadius; p4.y = y + heightRadius; f.updateShape(); setModified(true); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_WIDTH)) { p1.x = x - widthRadius; p2.x = x + widthRadius; p3.x = x - widthRadius; p4.x = x + widthRadius; f.updateShape(); setModified(true); glimpsePanel.repaint(); return ; } } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } super.stateChanged(e); } @Override public void saveParameters() { super.saveParameters(); LaTeXDrawPoint2D p1,p2,p3,p4; if(figure instanceof Ellipse) { Ellipse e = (Ellipse)figure; p1 = e.getBordersPoint(0); p2 = e.getBordersPoint(1); p3 = e.getBordersPoint(2); p4 = e.getBordersPoint(3); } else { LaTeXDrawRectangle r = (LaTeXDrawRectangle)figure; p1 = r.getPoint(0); p2 = r.getPoint(1); p3 = r.getPoint(2); p4 = r.getPoint(3); ((LaTeXDrawRectangle)figure).setIsRound(isRound.isSelected()); ((LaTeXDrawRectangle)figure).setFrameArc( Double.valueOf(frameArcField.getValue().toString()).doubleValue()); } float widthRadius = Float.valueOf(widthRadiusField.getValue().toString()).floatValue(); float heightRadius = Float.valueOf(heightRadiusField.getValue().toString()).floatValue(); float x = Float.valueOf(centerXField.getValue().toString()).floatValue(); float y = Float.valueOf(centerYField.getValue().toString()).floatValue(); p1.x = x - widthRadius; p2.x = x + widthRadius; p3.x = x - widthRadius; p4.x = x + widthRadius; p1.y = y - heightRadius; p2.y = y - heightRadius; p3.y = y + heightRadius; p4.y = y + heightRadius; if(figure instanceof Ellipse) ((Ellipse)figure).getBorders().updateNSEWDelimitors(); else ((LaTeXDrawRectangle)figure).updateNSEWDelimitors(); figure.updateShape(); drawPanel.getDraw().updateBorders(); drawPanel.updateDraw(true); } @Override public void setVisible(boolean visible, Figure selected, boolean deleteOnCancel, boolean isFramedBox) { try { if(!(selected instanceof Ellipse || selected instanceof LaTeXDrawRectangle)) throw new IllegalArgumentException(); if(isFramedBox) { centerXField.setEnabled(false); centerYField.setEnabled(false); widthRadiusField.setEnabled(false); heightRadiusField.setEnabled(false); } super.setVisible(visible, selected, deleteOnCancel, isFramedBox); }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/ParametersCircleSquareFrame.java0000644000000000000000000003066711347255510023547 0ustar package latexDraw.ui.dialog; import java.awt.*; import java.awt.event.ActionEvent; import javax.swing.*; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import latexDraw.figures.Circle; import latexDraw.figures.Figure; import latexDraw.figures.LaTeXDrawRectangle; import latexDraw.figures.Square; import latexDraw.lang.LaTeXDrawLang; import latexDraw.ui.DrawPanel; import latexDraw.util.LaTeXDrawPoint2D; /** * This class defines the frame which allows to change the parameters of circles and squares.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class ParametersCircleSquareFrame extends AbstractParametersFrame { private static final long serialVersionUID = 1L; /** Allows to change the x-coordinates of the centre of the figure */ protected JSpinner centerXField; /** Allows to change the y-coordinates of the centre of the figure */ protected JSpinner centerYField; /** Allows to change the radius of the circle */ protected JSpinner radiusField; /** Allows to set if the square will be round (only for square) */ protected JCheckBox isRound; /** The panel containing to set the roundness of the figure. */ protected JPanel roundPanel; /** Allows to change the angle of the round corner. */ protected JSpinner frameArcField; /** * The constructor by default */ public ParametersCircleSquareFrame(Frame parent, DrawPanel p, boolean attachToMainFrame) { super(parent, p, attachToMainFrame); try { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JPanel pButton = createButtonsPanel(this); JPanel pGeneral = new JPanel(); pGeneral.setLayout(new BoxLayout(pGeneral, BoxLayout.Y_AXIS)); JTabbedPane tabbedPane = new JTabbedPane(); JPanel coordP = new JPanel(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.CENTER; coordP.add(new JLabel(LABEL_CENTER_X) , constraint); SpinnerModel model = new SpinnerNumberModel(0,0,10000,0.1); centerXField = new JSpinner(model); centerXField.setEditor(new JSpinner.NumberEditor(centerXField, "0.0"));//$NON-NLS-1$ centerXField.addChangeListener(this); centerXField.setName(LABEL_CENTER_X); constraint.gridx++; coordP.add(centerXField, constraint); constraint.gridx++; coordP.add(new JLabel(LABEL_CENTER_Y), constraint); model = new SpinnerNumberModel(0,0,10000,0.1); centerYField = new JSpinner(model); centerYField.setEditor(new JSpinner.NumberEditor(centerYField, "0.0"));//$NON-NLS-1$ centerYField.addChangeListener(this); centerYField.setName(LABEL_CENTER_Y); constraint.gridx++; coordP.add(centerYField, constraint); constraint.gridx = 0; constraint.gridy++; coordP.add(new JLabel(LABEL_RADIUS), constraint); model = new SpinnerNumberModel(0.1,0.1,10000,0.1); radiusField = new JSpinner(model); radiusField.setEditor(new JSpinner.NumberEditor(radiusField, "0.0"));//$NON-NLS-1$ radiusField.addChangeListener(this); radiusField.setName(LABEL_RADIUS); constraint.gridx++; coordP.add(radiusField, constraint); constraint.gridx = 0; constraint.gridy++; coordP.add(new JLabel(LABEL_ROTATION), constraint); constraint.gridx++; coordP.add(rotationField, constraint); coordP.setBorder(new CompoundBorder(new TitledBorder(null, LABEL_POSITION_DIMENSIONS, TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); pGeneral.add(coordP); pGeneral.add(createBordersPanel(true)); pGeneral.add(createDoubleLinePanel()); pGeneral.add(createFillPanel()); JPanel pOther = new JPanel(); pOther.setLayout(new BoxLayout(pOther, BoxLayout.Y_AXIS)); pOther.add(createHatchingPanel()); pOther.add(createShadowPanel()); pOther.add(createGradientPanel()); roundPanel = new JPanel(); roundPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); isRound = new JCheckBox(LABEL_ISROUND); isRound.addActionListener(this); isRound.setActionCommand(LABEL_ISROUND); roundPanel.add(isRound); roundPanel.add(new JLabel(LABEL_ROUND_CORNER)); model = new SpinnerNumberModel(LaTeXDrawRectangle.DEFAULT_FRAME_ARC, 0.01, 1,0.05); frameArcField = new JSpinner(model); frameArcField.setName(LABEL_ROUND_CORNER); frameArcField.setEditor(new JSpinner.NumberEditor(frameArcField, "0.00"));//$NON-NLS-1$ frameArcField.addChangeListener(this); frameArcField.setEnabled(false); roundPanel.add(frameArcField); roundPanel.setBorder(new CompoundBorder(new TitledBorder(null, LaTeXDrawLang.getString1_7("AbstractParametersFrame.6"), //$NON-NLS-1$ TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); pOther.add(roundPanel); tabbedPane.addTab(TITLE_TABBED_PANE_GENERAL, pGeneral); tabbedPane.addTab(TITLE_TABBED_PANE_OTHERS, pOther); BoxLayout bl = new BoxLayout(getContentPane(), BoxLayout.Y_AXIS); getContentPane().setLayout(bl); getContentPane().add(glimpsePanelZoom); getContentPane().add(tabbedPane); getContentPane().add(pButton); pack(); setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2); setVisible(false); } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } @Override public void actionPerformed(ActionEvent e) { try { Object o = e.getSource(); Figure f = glimpsePanel.getGlimpseFigure(); if(o instanceof JCheckBox) { String label = ((JCheckBox)o).getActionCommand(); if(label.equals(LABEL_ISROUND)) { ((Square)f).setIsRound(isRound.isSelected()); frameArcField.setEnabled(isRound.isSelected()); setModified(true); glimpsePanel.repaint(); return ; } } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } super.actionPerformed(e); } @Override public void stateChanged(ChangeEvent e) { try { Object o = e.getSource(); Figure f = glimpsePanel.getGlimpseFigure(); if(o instanceof JSpinner) { String name = ((JSpinner)o).getName(); if(name.equals(LABEL_ROUND_CORNER)) { if(f instanceof Square) { ((Square)f).setFrameArc(Double.valueOf(frameArcField.getValue().toString()).doubleValue()); setModified(true); glimpsePanel.repaint(); } return ; } LaTeXDrawPoint2D p1, p2, p3, p4; if(figure instanceof Circle) { Circle c = (Circle)f; p1 = c.getBordersPoint(0); p2 = c.getBordersPoint(1); p3 = c.getBordersPoint(2); p4 = c.getBordersPoint(3); } else { Square s = (Square)f; p1 = s.getPoint(0); p2 = s.getPoint(1); p3 = s.getPoint(2); p4 = s.getPoint(3); } if(name.equals(LABEL_CENTER_X)) { double radius = Double.valueOf(radiusField.getValue().toString()); double x = Double.valueOf(centerXField.getValue().toString()); p1.x = x - radius; p2.x = x + radius; p3.x = x - radius; p4.x = x + radius; f.updateShape(); setModified(true); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_CENTER_Y)) { double radius = Double.valueOf(radiusField.getValue().toString()); double y = Double.valueOf(centerYField.getValue().toString()); p1.y = y - radius; p2.y = y - radius; p3.y = y + radius; p4.y = y + radius; f.updateShape(); setModified(true); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_RADIUS)) { double radius = Double.valueOf(radiusField.getValue().toString()); double y = Double.valueOf(centerYField.getValue().toString()); double x = Double.valueOf(centerXField.getValue().toString()); p1.x = x - radius; p2.x = x + radius; p3.x = x - radius; p4.x = x + radius; p1.y = y - radius; p2.y = y - radius; p3.y = y + radius; p4.y = y + radius; f.updateShape(); setModified(true); glimpsePanel.repaint(); return ; } } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } super.stateChanged(e); } @Override public void saveParameters() { super.saveParameters(); LaTeXDrawPoint2D p1, p2, p3, p4; float radius = Float.valueOf(radiusField.getValue().toString()).floatValue(); float x = Float.valueOf(centerXField.getValue().toString()).floatValue(); float y = Float.valueOf(centerYField.getValue().toString()).floatValue(); if(figure instanceof Circle) { Circle c = (Circle)figure; p1 = c.getBordersPoint(0); p2 = c.getBordersPoint(1); p3 = c.getBordersPoint(2); p4 = c.getBordersPoint(3); } else { Square s = (Square)figure; p1 = s.getPoint(0); p2 = s.getPoint(1); p3 = s.getPoint(2); p4 = s.getPoint(3); ((Square)figure).setIsRound(isRound.isSelected()); ((Square)figure).setWidth(radius*2); ((Square)figure).setFrameArc( Double.valueOf(frameArcField.getValue().toString()).doubleValue()); } p1.x = x - radius; p2.x = x + radius; p3.x = x - radius; p4.x = x + radius; p1.y = y - radius; p2.y = y - radius; p3.y = y + radius; p4.y = y + radius; figure.updateShape(); drawPanel.getDraw().updateBorders(); drawPanel.updateDraw(true); } @Override public void setFigureFrameField() { LaTeXDrawPoint2D NW, SE; NW = figure.getTheNWPoint(); SE = figure.getTheSEPoint(); centerXField.removeChangeListener(this); centerXField.setValue((NW.x+SE.x)/2.); centerXField.addChangeListener(this); centerYField.removeChangeListener(this); centerYField.setValue((NW.y+SE.y)/2.); centerYField.addChangeListener(this); radiusField.removeChangeListener(this); radiusField.setValue((SE.x-NW.x)/2.); radiusField.addChangeListener(this); if(figure instanceof Square) { isRound.setSelected(((Square)figure).isRound()); frameArcField.setEnabled(isRound.isSelected()); frameArcField.setValue(((Square)figure).getFrameArc()); roundPanel.setVisible(true); } else roundPanel.setVisible(false); } @Override public void setDefaultsValues() { super.setDefaultsValues(); if(figure instanceof Square) { isRound.setSelected(LaTeXDrawRectangle.DEFAULT_ISROUND); ((Square)glimpsePanel.getGlimpseFigure()).setIsRound(LaTeXDrawRectangle.DEFAULT_ISROUND); } else isRound.setVisible(false); } @Override public void setVisible(boolean visible, Figure selected, boolean deleteOnCancel, boolean isFramedBox) { try { if(!(selected instanceof Circle || selected instanceof Square)) throw new IllegalArgumentException(); if(isFramedBox) { centerXField.setEnabled(false); centerYField.setEnabled(false); radiusField.setEnabled(false); } super.setVisible(visible, selected, deleteOnCancel, isFramedBox); }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/ParametersRhombusFrame.java0000644000000000000000000002367311347255510022603 0ustar package latexDraw.ui.dialog; import java.awt.*; import javax.swing.*; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import latexDraw.figures.Figure; import latexDraw.figures.Rhombus; import latexDraw.ui.DrawPanel; import latexDraw.util.LaTeXDrawPoint2D; /** * This class defines the frame which allows to change the parameters of rhombus.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class ParametersRhombusFrame extends AbstractParametersFrame { private static final long serialVersionUID = 1L; /** Allows to change the x-coordinates of the centre of the figure */ protected JSpinner centerXField; /** Allows to change the y-coordinates of the centre of the figure */ protected JSpinner centerYField; /** Allows to change the width of the triangle */ protected JSpinner widthField; /** Allows to change the height of the triangle */ protected JSpinner heightField; /** * The constructor by default */ public ParametersRhombusFrame(Frame parent, DrawPanel p, boolean attachToMainFrame) { super(parent, p, attachToMainFrame); try { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JTabbedPane tabbedPane = new JTabbedPane(); JPanel pButton = createButtonsPanel(this); JPanel pGeneral = new JPanel(); pGeneral.setLayout(new BoxLayout(pGeneral, BoxLayout.Y_AXIS)); JPanel coordP = new JPanel(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.CENTER; coordP.add(new JLabel(LABEL_CENTER_X), constraint); SpinnerModel model = new SpinnerNumberModel(0,0,10000,0.1); centerXField = new JSpinner(model); centerXField.setEditor(new JSpinner.NumberEditor(centerXField, "0.0"));//$NON-NLS-1$ centerXField.addChangeListener(this); centerXField.setName(LABEL_CENTER_X); constraint.gridx++; coordP.add(centerXField, constraint); constraint.gridx++; coordP.add(new JLabel(LABEL_CENTER_Y), constraint); model = new SpinnerNumberModel(0,0,10000,0.1); centerYField = new JSpinner(model); centerYField.setEditor(new JSpinner.NumberEditor(centerYField, "0.0"));//$NON-NLS-1$ centerYField.addChangeListener(this); centerYField.setName(LABEL_CENTER_Y); constraint.gridx++; coordP.add(centerYField, constraint); constraint.gridx = 0; constraint.gridy++; coordP.add(new JLabel(LABEL_WIDTH), constraint); model = new SpinnerNumberModel(0.1,0.1,10000,0.1); widthField = new JSpinner(model); widthField.setEditor(new JSpinner.NumberEditor(widthField, "0.0"));//$NON-NLS-1$ widthField.addChangeListener(this); widthField.setName(LABEL_WIDTH); constraint.gridx++; coordP.add(widthField, constraint); constraint.gridx++; coordP.add(new JLabel(LABEL_HEIGHT), constraint); model = new SpinnerNumberModel(0.1,0.1,10000,0.1); heightField = new JSpinner(model); heightField.setEditor(new JSpinner.NumberEditor(heightField, "0.0"));//$NON-NLS-1$ heightField.addChangeListener(this); heightField.setName(LABEL_HEIGHT); constraint.gridx++; coordP.add(heightField, constraint); constraint.gridx = 0; constraint.gridy++; coordP.add(new JLabel(LABEL_ROTATION), constraint); constraint.gridx++; coordP.add(rotationField, constraint); coordP.setBorder(new CompoundBorder(new TitledBorder(null, LABEL_POSITION_DIMENSIONS, TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); pGeneral.add(coordP); pGeneral.add(createBordersPanel(true)); pGeneral.add(createDoubleLinePanel()); pGeneral.add(createFillPanel()); JPanel pOther = new JPanel(); pOther.setLayout(new BoxLayout(pOther, BoxLayout.Y_AXIS)); pOther.add(createShadowPanel()); pOther.add(createGradientPanel()); pOther.add(createHatchingPanel()); tabbedPane.addTab(TITLE_TABBED_PANE_GENERAL, pGeneral); tabbedPane.addTab(TITLE_TABBED_PANE_OTHERS, pOther); BoxLayout bl = new BoxLayout(getContentPane(), BoxLayout.Y_AXIS); getContentPane().setLayout(bl); getContentPane().add(glimpsePanelZoom); getContentPane().add(tabbedPane); getContentPane().add(pButton); pack(); setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2); setVisible(false); } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } @Override public void saveParameters() { super.saveParameters(); Rhombus r = (Rhombus)figure; LaTeXDrawPoint2D p1 = r.getPoint(0), p2 = r.getPoint(1), p3 = r.getPoint(2), p4 = r.getPoint(3); float demiWidth = (float) (Float.valueOf(widthField.getValue().toString()).floatValue()/2.); float demiHeight = (float) (Float.valueOf(heightField.getValue().toString()).floatValue()/2.); float x = Float.valueOf(centerXField.getValue().toString()).floatValue(); float y = Float.valueOf(centerYField.getValue().toString()).floatValue(); p1.y = y - demiHeight; p2.y = y - demiHeight; p3.y = y + demiHeight; p4.y = y + demiHeight; p1.x = x - demiWidth; p2.x = x + demiWidth; p3.x = x - demiWidth; p4.x = x + demiWidth; r.updateShape(); r.getBorders().updateNSEWDelimitors(); drawPanel.getDraw().updateBorders(); drawPanel.updateDraw(true); } @Override public void setFigureFrameField() { Rhombus r = (Rhombus)figure; Rhombus r2 = (Rhombus) glimpsePanel.getGlimpseFigure(); LaTeXDrawPoint2D NW = r.getTheNWPoint(), SE = r.getTheSEPoint(); centerXField.removeChangeListener(this); centerYField.removeChangeListener(this); widthField.removeChangeListener(this); heightField.removeChangeListener(this); centerXField.setValue((NW.x+SE.x)/2.); centerYField.setValue((NW.y+SE.y)/2.); widthField.setValue(SE.x-NW.x); heightField.setValue(SE.y-NW.y); centerXField.addChangeListener(this); centerYField.addChangeListener(this); widthField.addChangeListener(this); heightField.addChangeListener(this); for(int i=0; i *
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 02/13/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class BatchConvertFrame extends JFrame implements ActionListener, ListSelectionListener, Runnable { private static final long serialVersionUID = 1L; /** The label of the frame */ public static final String TITLE_FRAME = LaTeXDrawLang.getString1_6("LaTeXDrawFrame.2"); //$NON-NLS-1$ /** The model of the list (Useful to add element to the list) */ private BatchConvertListModel listModel; /** The list of pictures of folders to convert */ private JList list; /** Allows to know if the user want to overwrite the existing files */ private JCheckBox overwriteCB; private JCheckBox sameDirCB; /** Allows to choose the format of the new pictures */ private JComboBox formatList; /** Allows to add severals pictures */ private JButton addFilesB; /** Allows to remove a line of the list */ private JButton removeB; /** Allows to remove of the lines of the list */ private JButton removeAllB; /** Allows to set the path of the output directory */ private JTextField pathField; /** Allows to select the path of the output directory */ private JButton pathSelectB; /** The file chooser of paths selections */ private JFileChooser dirChooser; /** The file chooser of pictures selections */ private JFileChooser picturesChooser; /** Allows to start the conversion */ private JButton beginB; /** Allows to cancel the conversion */ private JButton stopB; /** Allows to close the frame */ private JButton closeB; /** Allows to know if the scan of folders must be recursive */ private JCheckBox recursiveCB; /** The thread of the conversion */ private transient Thread thread; /** Allows to stop the thread which convert the pictures */ private boolean stopThread; protected String pathSelectFigure; /** The label of the JCheckBox recursiveCB */ public static final String LABEL_RECURSIVE = LaTeXDrawLang.getString1_6("BatchConvertFrame.1"); //$NON-NLS-1$ /** The label of the button addFilesB */ public static final String LABEL_ADD_FILES = LaTeXDrawLang.getString1_6("BatchConvertFrame.2"); //$NON-NLS-1$ /** The label of the button removeB */ public static final String LABEL_REMOVE = LaTeXDrawLang.getString1_7("ParametersTextFrame.13"); //$NON-NLS-1$ /** The label of the button removeAllB */ public static final String LABEL_REMOVE_ALL = LaTeXDrawLang.getString1_6("BatchConvertFrame.4"); //$NON-NLS-1$ /** The label of the checkbox overwrite */ public static final String LABEL_OVERWRITE = LaTeXDrawLang.getString1_6("BatchConvertFrame.5"); //$NON-NLS-1$ public static final String LABEL_SAME_DIR = LaTeXDrawLang.getString1_7("BatchConvertFrame.0"); //$NON-NLS-1$ /** The label of the button pathSelectB */ public static final String LABEL_SEL_PATH = LaTeXDrawLang.getString1_6("BatchConvertFrame.6"); //$NON-NLS-1$ /** The label of the button formatList */ public static final String LABEL_FORMAT_LIST = LaTeXDrawLang.getString1_6("BatchConvertFrame.7"); //$NON-NLS-1$ /** The label of the button beginB */ public static final String LABEL_BEGIN = LaTeXDrawLang.getString1_6("BatchConvertFrame.8"); //$NON-NLS-1$ /** The second label of the button beginB */ public static final String LABEL_STOP = LaTeXDrawLang.getString1_6("BatchConvertFrame.9"); //$NON-NLS-1$ /** The label of the button closeB */ public static final String LABEL_CLOSE = LaTeXDrawLang.getString1_8("LaTeXDrawFrame.23"); //$NON-NLS-1$ /** The name of the list */ public static final String NAME_LIST = LaTeXDrawLang.getString1_6("BatchConvertFrame.11"); //$NON-NLS-1$ /** * The constructor by default */ public BatchConvertFrame() { try { setIconImage(LaTeXDrawResources.copyIcon.getImage()); stopThread = true; Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); setTitle(TITLE_FRAME); dirChooser = null; picturesChooser = null; pathSelectFigure = null; JPanel buttonListPanel = new JPanel(); JPanel panelTmp = new JPanel(); panelTmp.setLayout(new BoxLayout(panelTmp, BoxLayout.Y_AXIS)); buttonListPanel.setLayout(new BoxLayout(buttonListPanel, BoxLayout.X_AXIS)); addFilesB = new JButton(LABEL_ADD_FILES, LaTeXDrawResources.plusIcon); removeB = new JButton(LABEL_REMOVE, LaTeXDrawResources.minusIcon); removeAllB = new JButton(LABEL_REMOVE_ALL, LaTeXDrawResources.minusIcon); addFilesB.setActionCommand(LABEL_ADD_FILES); removeB.setActionCommand(LABEL_REMOVE); removeAllB.setActionCommand(LABEL_REMOVE_ALL); addFilesB.addActionListener(this); removeB.addActionListener(this); removeAllB.addActionListener(this); removeB.setEnabled(false); removeAllB.setEnabled(false); panelTmp.add(addFilesB); panelTmp.add(removeB); panelTmp.add(removeAllB); buttonListPanel.add(panelTmp); JPanel listPanel = new JPanel(); list = new JList(); list.setCellRenderer(new BatchConvertListCellRenderer()); list.addListSelectionListener(this); list.setName(NAME_LIST); listModel = new BatchConvertListModel(); list.setModel(listModel); list.setVisibleRowCount(10); JScrollPane scrollPane = new JScrollPane(list); listPanel.add(scrollPane); JPanel topPanel = new JPanel(new BorderLayout()); topPanel.add(listPanel, BorderLayout.CENTER); topPanel.add(buttonListPanel, BorderLayout.EAST); JPanel formatPanel = new JPanel(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.HORIZONTAL; constraint.anchor = GridBagConstraints.EAST; formatPanel.add(new JLabel(LaTeXDrawLang.getString1_6("BatchConvertFrame.14")),constraint); //$NON-NLS-1$ formatList = new JComboBox(); formatList.setActionCommand(LABEL_FORMAT_LIST); formatList.addItem(LaTeXDrawResources.EPS_EXTENSION); formatList.addItem(LaTeXDrawResources.JPG_EXTENSION); formatList.addItem(LaTeXDrawResources.BMP_EXTENSION); formatList.addItem(LaTeXDrawResources.PNG_EXTENSION); formatList.addItem(LaTeXDrawResources.PPM_EXTENSION); formatList.setSelectedIndex(0); formatList.setPreferredSize(new Dimension(300, 30)); formatList.setSize(new Dimension(300, 30)); formatList.setMaximumSize(new Dimension(300, 30)); formatList.setMinimumSize(new Dimension(300, 30)); constraint.gridx = 1; constraint.gridwidth = 6; formatPanel.add(formatList,constraint); overwriteCB = new JCheckBox(LABEL_OVERWRITE); overwriteCB.setActionCommand(LABEL_OVERWRITE); pathSelectB = new JButton(LaTeXDrawResources.openIcon); pathSelectB.setActionCommand(LABEL_SEL_PATH); pathSelectB.addActionListener(this); pathSelectB.setMaximumSize(new Dimension(40,40)); pathSelectB.setPreferredSize(new Dimension(40,40)); pathField = new JTextField(); pathField.setEditable(false); pathField.setText(LaTeXDrawFrame.getPathExport()); pathField.setMinimumSize(new Dimension(300,40)); pathField.setPreferredSize(new Dimension(300,40)); sameDirCB = new JCheckBox(LABEL_SAME_DIR); sameDirCB.setActionCommand(LABEL_SAME_DIR); sameDirCB.addActionListener(this); constraint.fill = GridBagConstraints.NONE; JPanel pathPanel = new JPanel(new GridBagLayout()); constraint.gridx = 0; constraint.gridwidth = 6; pathPanel.add(pathField, constraint); constraint.gridx = 6; constraint.gridwidth = 1; pathPanel.add(pathSelectB, constraint); JPanel optPanel = new JPanel(new GridLayout(4,1)); optPanel.add(formatPanel); optPanel.add(pathPanel); optPanel.add(overwriteCB); optPanel.add(sameDirCB); JPanel ctrlPanel = new JPanel(new GridLayout(1, 3)); closeB = new JButton(LABEL_CLOSE); beginB = new JButton(LABEL_BEGIN); stopB = new JButton(LABEL_STOP); beginB.setEnabled(false); stopB.setEnabled(false); closeB.addActionListener(this); beginB.addActionListener(this); stopB.addActionListener(this); closeB.setActionCommand(LABEL_CLOSE); beginB.setActionCommand(LABEL_BEGIN); stopB.setActionCommand(LABEL_STOP); ctrlPanel.add(beginB); ctrlPanel.add(stopB); ctrlPanel.add(closeB); ctrlPanel.setPreferredSize(new Dimension(280, 40)); ctrlPanel.setMaximumSize(new Dimension(280, 40)); BoxLayout bl = new BoxLayout(getContentPane(), BoxLayout.Y_AXIS); getContentPane().setLayout(bl); getContentPane().add(topPanel); getContentPane().add(optPanel); getContentPane().add(ctrlPanel); pack(); setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2); setVisible(false); }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if(o instanceof AbstractButton) { String cmd = ((AbstractButton)o).getActionCommand(); if(cmd==null) return; if(cmd.equals(LABEL_SAME_DIR)) { if(sameDirCB.isSelected()) { pathField.setEnabled(false); pathSelectB.setEnabled(false); } else { pathField.setEnabled(true); pathSelectB.setEnabled(true); } return ; } if(cmd.equals(LABEL_CLOSE)) { setVisible(false); return ; } if(cmd.equals(LABEL_BEGIN)) { if(thread==null) { int i, size = listModel.getSize(); for(i=0; i0) { removeAllB.setEnabled(true); beginB.setEnabled(true); } return; } if(cmd.equals(LABEL_REMOVE)) { listModel.removeElementAt(list.getSelectedIndex()); list.updateUI(); if(listModel.getSize()==0) { removeAllB.setEnabled(false); beginB.setEnabled(false); } removeB.setEnabled(false); } if(cmd.equals(LABEL_REMOVE_ALL)) { listModel.removeAllElements(); list.updateUI(); if(listModel.getSize()==0) removeAllB.setEnabled(false); removeB.setEnabled(false); beginB.setEnabled(false); } if(cmd.equals(LABEL_SEL_PATH)) { if(dirChooser==null) { dirChooser = new JFileChooser(); dirChooser.setApproveButtonText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.171")); //$NON-NLS-1$ dirChooser.setDialogTitle(LaTeXDrawLang.getString1_6("BatchConvertFrame.12")); //$NON-NLS-1$ dirChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); dirChooser.setMultiSelectionEnabled(false); } dirChooser.setCurrentDirectory(new File(pathField.getText())); dirChooser.showSaveDialog(this); File file = dirChooser.getSelectedFile(); if(file!=null) if(file.isDirectory()) pathField.setText(file.getPath()); return; } return ; }// if(o instanceof JButton) } /** * Converts the pictures. * @throws InterruptedException If the user cancel the conversion. */ public void convert() throws InterruptedException { try { int i, size = listModel.getSize(); for(i=0; i *
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 02/14/06
* @author Arnaud BLOUIN
* 1.9.2
*/ class BatchConvertListModel extends AbstractListModel { private static final long serialVersionUID = 1L; /** The element of the list */ Vector elements; /** * The constructor by default */ public BatchConvertListModel() { elements = new Vector(); } /** * @return the elements */ public Vector getElements() { return elements; } /** * Allows to remove all the elements of the list */ public void removeAllElements() { elements.removeAllElements(); } /** * Allows to remove an element at the position id in the list * @param id The position of the element to remove from the list */ public void removeElementAt(int id) { if(id<0 || id>elements.size()) return ; elements.remove(id); } /** * Allows to change the icon of an element of the list * @param ok : 1, the 'ok' icon
0 : the 'err' icon
else: the 'empty' icon * @param id The position of the element in the list */ public void changeIconLabel(int ok, int id) { if(id>=0 && id0: the 'err' icon
else : the 'empty' icon */ public void addElement(String txt, int ok) { JLabel label = new JLabel(txt); if(ok==1) label.setIcon(LaTeXDrawResources.okIcon); else if(ok==0) label.setIcon(LaTeXDrawResources.errIcon); else label.setIcon(LaTeXDrawResources.emptyIcon); elements.add(label); } /** * Allows to get the size of the list */ public int getSize() { return elements.size(); } /** * Allows to get an element of the list * @param id The position of the element in the list */ public Object getElementAt(int id) { if(id<0 || id>elements.size()) return null; return elements.elementAt(id); } } /** * This is the renderer of the cells of the list of the batch conversion frame.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 02/14/06
* @author Arnaud BLOUIN
* 1.9.2
*/ class BatchConvertListCellRenderer extends DefaultListCellRenderer { private static final long serialVersionUID = 1L; @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component retValue; if(value instanceof JLabel) { retValue = super.getListCellRendererComponent( list, ((JLabel)value).getText(), index, isSelected, cellHasFocus); setIcon(((JLabel)value).getIcon()); } else { retValue = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); setIcon(LaTeXDrawResources.emptyIcon); } return retValue; } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/AddCommentsFrame.java0000644000000000000000000001132111347255510021321 0ustar package latexDraw.ui.dialog; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; import latexDraw.lang.LaTeXDrawLang; import latexDraw.ui.CodePanel; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.ui.components.CopyPasteMenu; import latexDraw.util.LaTeXDrawResources; /** * This frame allows the user to add comments to his current drawing
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 06/03/07
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class AddCommentsFrame extends JFrame implements ActionListener { private static final long serialVersionUID = 1L; /** The label of the button "ok" of the frame addCommentsFrame */ public static final String LABEL_FRAME_ADDCOMMENTS_OK = "ADDCOMMENTS_OK";//$NON-NLS-1$ /** The label of the button "Cancel" of the frame addCommentsFrame */ public static final String LABEL_FRAME_ADDCOMMENTS_CANCEL = "ADDCOMMENTS_CANCEL";//$NON-NLS-1$ /** The title of the frame */ public static final String TITLE = LaTeXDrawLang.getOthersString("CodePanel.updateCode"); //$NON-NLS-1$ /** The main frame of the program */ protected LaTeXDrawFrame mainFrame; /** This editor allows to write comments */ protected JEditorPane editorAddComments; protected CopyPasteMenu copyMenu; public AddCommentsFrame(LaTeXDrawFrame frame) { try { setIconImage(LaTeXDrawResources.commentIcon.getImage()); mainFrame = frame; Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); setTitle(TITLE); setLocation(dim.width*1/3, dim.height*1/4); // Creation of the panel which contains the editor // and creation of the panel which contains the buttons JPanel pGeneral = new JPanel(new BorderLayout()), pButton = new JPanel(new BorderLayout()); JButton buttonOk = new JButton(AbstractParametersFrame.LABEL_OK), buttonCancel = new JButton(AbstractParametersFrame.LABEL_CANCEL); editorAddComments = new JEditorPane(); copyMenu = new CopyPasteMenu(editorAddComments); buttonOk.setActionCommand(LABEL_FRAME_ADDCOMMENTS_OK); buttonCancel.setActionCommand(LABEL_FRAME_ADDCOMMENTS_CANCEL); buttonOk.addActionListener(this); buttonCancel.addActionListener(this); // The scroller of the editor JScrollPane scrollPane = new JScrollPane(editorAddComments); scrollPane.setVerticalScrollBarPolicy( ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); GridLayout gridButton = new GridLayout(1, 2); editorAddComments.setText("");//$NON-NLS-1$ pButton.setLayout(gridButton); pButton.add(buttonOk); pButton.add(buttonCancel); pGeneral.add(scrollPane, BorderLayout.CENTER); pGeneral.add(pButton, BorderLayout.SOUTH); // Creation of the frame getContentPane().add(pGeneral); setSize(340, 250); setVisible(false); editorAddComments.addMouseListener(copyMenu); }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } @Override public void setVisible(boolean visible) { super.setVisible(visible); if(visible) { CodePanel codePanel = mainFrame.getCodePanel(); editorAddComments.setText(codePanel.getCommentsWithoutTag()); } else mainFrame.requestFocus(); } public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if(o instanceof JButton) { String label = ((JButton)o).getActionCommand(); if(label == LABEL_FRAME_ADDCOMMENTS_CANCEL) { setVisible(false); return ; } if(label == LABEL_FRAME_ADDCOMMENTS_OK) { CodePanel codePanel; try { codePanel = mainFrame.getCodePanel(); codePanel.setComments(editorAddComments.getText()); codePanel.updateText(); mainFrame.setIsModified(true); }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } setVisible(false); return; } } // if JButton } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/ParametersDotFrame.java0000644000000000000000000002432411347255510021704 0ustar package latexDraw.ui.dialog; import java.awt.*; import java.awt.event.ItemEvent; import javax.swing.*; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import latexDraw.figures.Dot; import latexDraw.figures.Figure; import latexDraw.lang.LaTeXDrawLang; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.DrawPanel; import latexDraw.ui.components.ButtonIcon; import latexDraw.ui.components.ColorButton; import latexDraw.ui.components.LaTeXDrawComboBox; import latexDraw.util.LaTeXDrawPoint2D; import latexDraw.util.LaTeXDrawResources; /** * This class defines the frame which allows to change the parameters of dots.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class ParametersDotFrame extends AbstractParametersFrame { private static final long serialVersionUID = 1L; /** Allows to change the x-coordinates of the centre of the figure */ protected JSpinner centerXField; /** Allows to change the y-coordinates of the centre of the figure */ protected JSpinner centerYField; /** Allows to change the y-coordinates of the width of the figure */ protected JSpinner widthField; /** The list of the styles of dots */ protected LaTeXDrawComboBox dotChoice; /** * The constructor by default */ public ParametersDotFrame(Frame parent, DrawPanel p, boolean attachToMainFrame) { super(parent, p, attachToMainFrame); try { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JPanel pButton = createButtonsPanel(this); JPanel pGeneral = new JPanel(); pGeneral.setLayout(new BoxLayout(pGeneral, BoxLayout.Y_AXIS)); JPanel pParams = new JPanel(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.CENTER; pParams.add(new JLabel(LABEL_CENTER_X), constraint); SpinnerModel model = new SpinnerNumberModel(0,0,10000,0.1); centerXField = new JSpinner(model); centerXField.setEditor(new JSpinner.NumberEditor(centerXField, "0.0"));//$NON-NLS-1$ centerXField.addChangeListener(this); centerXField.setName(LABEL_CENTER_X); constraint.gridx = 1; constraint.gridwidth = 1; pParams.add(centerXField, constraint); constraint.gridx = 0; constraint.gridy = 1; constraint.gridwidth = 1; pParams.add(new JLabel(LABEL_CENTER_Y), constraint); model = new SpinnerNumberModel(0,0,10000,0.1); centerYField = new JSpinner(model); centerYField.setEditor(new JSpinner.NumberEditor(centerYField, "0.0"));//$NON-NLS-1$ centerYField.addChangeListener(this); centerYField.setName(LABEL_CENTER_Y); constraint.gridx = 1; constraint.gridwidth = 1; pParams.add(centerYField, constraint); constraint.gridx = 0; constraint.gridy++; constraint.gridwidth = 1; pParams.add(new JLabel(LABEL_WIDTH), constraint); model = new SpinnerNumberModel(0.1,0.1,10000,0.1); widthField = new JSpinner(model); widthField.setEditor(new JSpinner.NumberEditor(widthField, "0.0"));//$NON-NLS-1$ widthField.addChangeListener(this); widthField.setName(LABEL_WIDTH); constraint.gridx = 1; constraint.gridwidth = 1; pParams.add(widthField, constraint); constraint.gridx = 0; constraint.gridy++; constraint.gridwidth = 1; pParams.add(new JLabel(LABEL_ROTATION), constraint); model = new SpinnerNumberModel(Figure.DEFAULT_ROTATION_ANGLE, -360, 360,0.1); rotationField = new JSpinner(model); rotationField.setEditor(new JSpinner.NumberEditor(rotationField, "0.0"));//$NON-NLS-1$ rotationField.addChangeListener(this); rotationField.setName(LaTeXDrawResources.LABEL_ROTATE); constraint.gridx = 1; constraint.gridwidth = 1; pParams.add(rotationField, constraint); bordersButton = new ColorButton(LaTeXDrawResources.LABEL_COLOR_BUTTON, new ButtonIcon(Color.BLACK)); bordersButton.setText(LaTeXDrawResources.LABEL_COLOR_BUTTON); bordersButton.setActionCommand(LaTeXDrawResources.LABEL_COLOR_BUTTON); bordersButton.addActionListener(this); constraint.gridx = 0; constraint.gridy++; pParams.add(bordersButton, constraint); constraint.gridx = 1; constraint.gridwidth = 1; pParams.add(new JLabel(LaTeXDrawLang.getDialogFrameString("ParametersDotFrame.0")), constraint); //$NON-NLS-1$ dotChoice = Dot.createDotStyleChoice(); dotChoice.setName(LaTeXDrawResources.CHOICE_DOT_NAME); dotChoice.setSelectedItem(PSTricksConstants.LINE_NONE_STYLE); dotChoice.addItemListener(this); constraint.gridx = 2; constraint.gridwidth = 1; pParams.add(dotChoice, constraint); pParams.setBorder(new CompoundBorder(new TitledBorder(null, TITLE_GENERAL, TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); pGeneral.add(pParams); pGeneral.add(createFillPanel()); hatchChoice.setVisible(false); BoxLayout bl = new BoxLayout(getContentPane(), BoxLayout.Y_AXIS); getContentPane().setLayout(bl); getContentPane().add(glimpsePanelZoom); getContentPane().add(pGeneral); getContentPane().add(pButton); filledCheckBox.setVisible(false); pack(); setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2); setVisible(false); }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } @Override public void saveParameters() { super.saveParameters(); Dot d = (Dot)figure; float x = Float.valueOf(centerXField.getValue().toString()).floatValue(); float y = Float.valueOf(centerYField.getValue().toString()).floatValue(); JLabel label = (JLabel) dotChoice.getSelectedItem(); d.setCurrentStyle(label.getText()); d.setWidth(Float.valueOf(widthField.getValue().toString()).floatValue()); d.getCenter().x = x; d.getCenter().y = y; d.updateDelimitor(); d.updateShape(); drawPanel.getDraw().updateBorders(); drawPanel.updateDraw(true); } @Override public void setFigureFrameField() { Dot d = (Dot)figure; LaTeXDrawPoint2D center = d.getCenter(); dotChoice.setSelectedItem(d.getCurrentStyle()); centerXField.setValue(center.x); centerYField.setValue(center.y); widthField.setValue((double)d.getWidth()); interiorButton.setEnabled(d.canBeFilled()); if(d.canBeFilled()) interiorButton.setColor(d.getInteriorColor()); } @Override public void setDefaultsValues() { try { super.setDefaultsValues(); dotChoice.setSelectedItem(Dot.DEFAULT_DOT_STYLE); widthField.setValue(Dot.DEFAULT_WIDTH); interiorButton.setEnabled(glimpsePanel.glimpseFigure.canBeFilled()); interiorButton.setColor(Figure.DEFAULT_INTERIOR_COL); }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } @Override public void setVisible(boolean visible, Figure selected, boolean deleteOnCancel, boolean isFramedBox) { try { if(!(selected instanceof Dot)) throw new ClassCastException(); super.setVisible(visible, selected, deleteOnCancel, isFramedBox); }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } @Override public void stateChanged(ChangeEvent e) { try { Object o = e.getSource(); Dot f = (Dot) glimpsePanel.getGlimpseFigure(); if(o instanceof JSpinner) { String name = ((JSpinner)o).getName(); if(name.equals(LABEL_CENTER_X)) { setModified(true); f.getCenter().x = Float.valueOf(centerXField.getValue().toString()).floatValue(); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_CENTER_Y)) { setModified(true); f.getCenter().y = Float.valueOf(centerYField.getValue().toString()).floatValue(); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_WIDTH)) { setModified(true); f.setWidth(Float.valueOf(widthField.getValue().toString()).floatValue()); glimpsePanel.repaint(); return ; } } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } super.stateChanged(e); } @Override public void itemStateChanged(ItemEvent e) { try { Dot f = (Dot) glimpsePanel.getGlimpseFigure(); Object o = e.getSource(); if(o instanceof LaTeXDrawComboBox) { if(((LaTeXDrawComboBox)o).getName().equals(LaTeXDrawResources.CHOICE_DOT_NAME)) { JLabel l = (JLabel) ((LaTeXDrawComboBox)o).getSelectedItem(); f.setCurrentStyle(l.getText()); interiorButton.setEnabled(f.canBeFilled()); if(f.canBeFilled()) { interiorButton.setColor(f.getInteriorColor()); interiorButton.repaint(); } setModified(true); glimpsePanel.repaint(); return ; } } } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } super.itemStateChanged(e); } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/ParametersPolygonJoinedLinesFrame.java0000644000000000000000000002200111347255510024717 0ustar package latexDraw.ui.dialog; import java.awt.*; import java.awt.event.ItemEvent; import javax.swing.*; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import latexDraw.figures.Figure; import latexDraw.figures.LaTeXDrawPolygon; import latexDraw.lang.LaTeXDrawLang; import latexDraw.ui.DrawPanel; import latexDraw.util.LaTeXDrawPoint2D; import latexDraw.util.LaTeXDrawResources; /** * This class defines the frame which allows to change the parameters of polygons.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class ParametersPolygonJoinedLinesFrame extends AbstractParametersFrame { private static final long serialVersionUID = 1L; /** Allows to select the point to change */ protected JComboBox pointChoice; /** The X-coordinates of the polygon */ protected double xs[]; /** The Y-coordinates of the polygon */ protected double ys[]; /** The number of points of the polygon */ protected int nbPoints; /** Allows to set the X-coordinate of a point */ protected JSpinner xCoord; /** Allows to set the Y-coordinate of a point */ protected JSpinner yCoord; public static final String LABEL_CHOICE_PTS = "ptChoice"; //$NON-NLS-1$ /** * The constructor by default */ public ParametersPolygonJoinedLinesFrame(Frame parent, DrawPanel p, boolean withoutArrow, boolean attachToMainFrame) { super(parent, p, attachToMainFrame); try { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JTabbedPane tabbedPane = new JTabbedPane(); JPanel pButton = createButtonsPanel(this); JPanel pGeneral = new JPanel(); pGeneral.setLayout(new BoxLayout(pGeneral, BoxLayout.Y_AXIS)); pGeneral.add(createPositionPanel()); pGeneral.add(createBordersPanel(false)); pGeneral.add(createFillPanel()); pGeneral.add(createHatchingPanel()); JPanel pOther = new JPanel(); pOther.setLayout(new BoxLayout(pOther, BoxLayout.Y_AXIS)); pOther.add(createShadowPanel()); pOther.add(createGradientPanel()); pOther.add(createDoubleLinePanel()); tabbedPane.addTab(TITLE_TABBED_PANE_GENERAL, pGeneral); if(!withoutArrow) { tabbedPane.addTab(NAME_TABBEDPANE_ARROW, createArrowPanel(true, false)); updateEnableParamsArrow(); } tabbedPane.addTab(TITLE_TABBED_PANE_OTHERS, pOther); BoxLayout bl = new BoxLayout(getContentPane(), BoxLayout.Y_AXIS); getContentPane().setLayout(bl); getContentPane().add(glimpsePanelZoom); getContentPane().add(tabbedPane); getContentPane().add(pButton); pack(); setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2); setVisible(false); } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } /** * @return A panel allowing to change the coordinates of the points of the polygon. * @since 1.9 */ protected JPanel createPositionPanel() { JPanel coordP = new JPanel(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.CENTER; coordP.add(new JLabel(LaTeXDrawLang.getDialogFrameString("ParametersPolygonFrame.1")) //$NON-NLS-1$ , constraint); pointChoice = new JComboBox(); pointChoice.addItemListener(this); pointChoice.setName(LABEL_CHOICE_PTS); constraint.gridx++; coordP.add(pointChoice, constraint); constraint.gridx=0; constraint.gridy++; coordP.add(new JLabel(LABEL_X), constraint); SpinnerModel model = new SpinnerNumberModel(0,0,10000,0.1); xCoord = new JSpinner(model); xCoord.setEditor(new JSpinner.NumberEditor(xCoord, "0.0"));//$NON-NLS-1$ xCoord.addChangeListener(this); xCoord.setName(LABEL_X); constraint.gridx++; coordP.add(xCoord, constraint); constraint.gridx++; coordP.add(new JLabel(LABEL_Y), constraint); model = new SpinnerNumberModel(0,0,10000,0.1); yCoord = new JSpinner(model); yCoord.setEditor(new JSpinner.NumberEditor(yCoord, "0.0"));//$NON-NLS-1$ yCoord.addChangeListener(this); yCoord.setName(LABEL_Y); constraint.gridx++; coordP.add(yCoord, constraint); constraint.gridx = 0; constraint.gridy++; coordP.add(new JLabel(LABEL_ROTATION), constraint); constraint.gridx++; coordP.add(rotationField, constraint); coordP.setBorder(new CompoundBorder(new TitledBorder(null, LABEL_POSITION_DIMENSIONS, TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); return coordP; } @Override public void setFigureFrameField() { LaTeXDrawPolygon p = ((LaTeXDrawPolygon)figure); nbPoints = p.getNbPoints(); xs = new double[nbPoints]; ys = new double[nbPoints]; LaTeXDrawPoint2D pt; pointChoice.removeItemListener(this); pointChoice.removeAllItems(); pointChoice.addItemListener(this); // We copy all points for(int i=0; i *
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class ParametersDrawFrame extends AbstractParametersFrame { private static final long serialVersionUID = 1L; /** Allows to change the x-coordinates of the North-West point */ protected JSpinner NWX; /** Allows to change the y-coordinates of the North-West point */ protected JSpinner NWY; /** Allows to change the x-coordinates of the North-West point */ protected JSpinner SEX; /** Allows to change the y-coordinates of the North-West point */ protected JSpinner SEY; /** The label of the item NWX */ public static final String LABEL_NWX = LaTeXDrawLang.getDialogFrameString("ParametersDrawFrame.0"); //$NON-NLS-1$ /** The label of the item NWY */ public static final String LABEL_NWY = LaTeXDrawLang.getDialogFrameString("ParametersDrawFrame.1"); //$NON-NLS-1$ /** The label of the item SEX */ public static final String LABEL_SEX = LaTeXDrawLang.getDialogFrameString("ParametersDrawFrame.2"); //$NON-NLS-1$ /** The label of the item SEY */ public static final String LABEL_SEY = LaTeXDrawLang.getDialogFrameString("ParametersDrawFrame.3"); //$NON-NLS-1$ public ParametersDrawFrame(Frame parent, DrawPanel d, boolean attachToMainFrame) { super(parent, d, attachToMainFrame); try { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); setLocation(dim.width*1/3, dim.height*1/5); String add = " :";//$NON-NLS-1$ JPanel pButton = createButtonsPanel(this); JPanel pGeneral = new JPanel(); pGeneral.setLayout(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.CENTER; pGeneral.add(new JLabel(LABEL_NWX+add), constraint); SpinnerModel model = new SpinnerNumberModel(0,0,10000,0.1); NWX = new JSpinner(model); NWX.setEditor(new JSpinner.NumberEditor(NWX, "0.0"));//$NON-NLS-1$ NWX.addChangeListener(this); NWX.setName(LABEL_NWX); constraint.gridx++; pGeneral.add(NWX, constraint); constraint.gridx++; pGeneral.add(new JLabel(LABEL_NWY+add), constraint); model = new SpinnerNumberModel(0,0,10000,0.1); NWY = new JSpinner(model); NWY.setEditor(new JSpinner.NumberEditor(NWY, "0.0"));//$NON-NLS-1$ NWY.addChangeListener(this); NWY.setName(LABEL_NWY); constraint.gridx++; pGeneral.add(NWY, constraint); constraint.gridx=0; constraint.gridy++; pGeneral.add(new JLabel(LABEL_SEX+add), constraint); model = new SpinnerNumberModel(0,0,10000,0.1); SEX = new JSpinner(model); SEX.setEditor(new JSpinner.NumberEditor(SEX, "0.0"));//$NON-NLS-1$ SEX.addChangeListener(this); SEX.setName(LABEL_SEX); constraint.gridx++; pGeneral.add(SEX, constraint); constraint.gridx++; pGeneral.add(new JLabel(LABEL_SEY+add), constraint); model = new SpinnerNumberModel(0,0,10000,0.1); SEY = new JSpinner(model); SEY.setEditor(new JSpinner.NumberEditor(SEY, "0.0"));//$NON-NLS-1$ SEY.addChangeListener(this); SEY.setName(LABEL_SEY); constraint.gridx++; pGeneral.add(SEY, constraint); constraint.gridx = 0; constraint.gridy++; pGeneral.add(new JLabel(LABEL_ROTATION), constraint); model = new SpinnerNumberModel(Figure.DEFAULT_ROTATION_ANGLE, -360, 360,0.1); rotationField = new JSpinner(model); rotationField.setEditor(new JSpinner.NumberEditor(rotationField, "0.0"));//$NON-NLS-1$ rotationField.addChangeListener(this); rotationField.setName(LaTeXDrawResources.LABEL_ROTATE); constraint.gridx = 1; pGeneral.add(rotationField, constraint); JPanel panel = new JPanel(); panel.setLayout(new GridLayout(2,1)); panel.add(glimpsePanelZoom); panel.add(pGeneral); getContentPane().setLayout(new BorderLayout()); getContentPane().add(panel, BorderLayout.CENTER); getContentPane().add(pButton, BorderLayout.SOUTH); setSize(440, 470); setVisible(false); setResizable(false); }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } @Override public void stateChanged(ChangeEvent e) { try { Object o = e.getSource(); Draw f = (Draw)glimpsePanel.getGlimpseFigure(); if(o instanceof JSpinner) { String name = ((JSpinner)o).getName(); LaTeXDrawRectangle borders = f.getBorders(); LaTeXDrawPoint2D NW = borders.getTheNWPoint(); LaTeXDrawPoint2D SE = borders.getTheSEPoint(); if(name.equals(LABEL_NWX)) { float newVal = Float.valueOf(NWX.getValue().toString()); setModified(true); if(newVal!=(float)NW.x) { f.rescaleX(NW.x, newVal, Math.abs((newVal-SE.x)/(NW.x-SE.x)), borders); glimpsePanel.repaint(); ((SpinnerNumberModel)SEX.getModel()).setMinimum(NW.x); } return ; } if(name.equals(LABEL_NWY)) { float newVal = Float.valueOf(NWY.getValue().toString()); setModified(true); if(newVal!=(float)NW.y) { f.rescaleY(NW.y, newVal, Math.abs((newVal-SE.y)/(NW.y-SE.y)), borders); glimpsePanel.repaint(); ((SpinnerNumberModel)SEY.getModel()).setMinimum(NW.y); } return ; } if(name.equals(LABEL_SEX)) { float newVal = Float.valueOf(SEX.getValue().toString()); setModified(true); if(newVal!=(float)SE.x) { f.rescaleX(SE.x, newVal, Math.abs((newVal-NW.x)/(SE.x-NW.x)), borders); glimpsePanel.repaint(); ((SpinnerNumberModel)NWX.getModel()).setMaximum(SE.x); } return ; } if(name.equals(LABEL_SEY)) { float newVal = Float.valueOf(SEY.getValue().toString()); setModified(true); if(newVal!=(float)SE.y) { f.rescaleY(SE.y, newVal, Math.abs((newVal-NW.y)/(SE.y-NW.y)), borders); glimpsePanel.repaint(); ((SpinnerNumberModel)NWY.getModel()).setMinimum(SE.y); } return ; } } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } super.stateChanged(e); } @Override public void saveParameters() { if(!(figure instanceof Draw)) throw new ClassCastException(); LaTeXDrawRectangle borders = figure.getBorders(); LaTeXDrawPoint2D NW = borders.getTheNWPoint(); LaTeXDrawPoint2D SE = borders.getTheSEPoint(); float newVal = Float.valueOf(NWX.getValue().toString()).floatValue(); figure.rescaleX(NW.x, newVal, Math.abs((newVal-SE.x)/(NW.x-SE.x)), borders); newVal = Float.valueOf(NWY.getValue().toString()).floatValue(); figure.rescaleY(NW.y, newVal, Math.abs((newVal-SE.y)/(NW.y-SE.y)), borders); newVal = Float.valueOf(SEX.getValue().toString()).floatValue(); figure.rescaleX(SE.x, newVal, Math.abs((newVal-NW.x)/(SE.x-NW.x)), borders); newVal = Float.valueOf(SEY.getValue().toString()).floatValue(); figure.rescaleY(SE.y, newVal, Math.abs((newVal-NW.y)/(SE.y-NW.y)), borders); ((Draw)figure).updateBorders(); ((Draw)figure).updateGravityCenter(); super.saveParameters(); } @Override public void setVisible(boolean visible, Figure selected, boolean deleteOnCancel, boolean isFramedBox) { try { if(!(selected instanceof Draw)) throw new ClassCastException(); super.setVisible(visible, selected, deleteOnCancel, isFramedBox); } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } @Override public void setFigureFrameField() { LaTeXDrawPoint2D NW = figure.getTheNWPoint(), SE = figure.getTheSEPoint(); NWX.setValue((float)NW.x); ((SpinnerNumberModel)NWX.getModel()).setMaximum(SE.x); SEX.setValue((float)SE.x); ((SpinnerNumberModel)SEX.getModel()).setMinimum(NW.x); NWY.setValue((float)NW.y); ((SpinnerNumberModel)NWY.getModel()).setMaximum(SE.y); SEY.setValue((float)SE.y); ((SpinnerNumberModel)SEY.getModel()).setMinimum(NW.y); } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/DrawPropertiesFrame.java0000644000000000000000000004157311347255510022111 0ustar package latexDraw.ui.dialog; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import latexDraw.lang.LaTeXDrawLang; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.CodePanel; import latexDraw.ui.DrawContainer; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.ui.components.LaTeXDrawComboBox; import latexDraw.ui.components.XScale; import latexDraw.util.LaTeXDrawResources; /** * This class defines the frame which allows to set the parameters of the drawing (not the figure.draw)
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class DrawPropertiesFrame extends JFrame implements ActionListener { private static final long serialVersionUID = 1L; /** Allows to choice the unit of length (for the field pixel/unit) */ private LaTeXDrawComboBox unitChoice; /** The field which allows to change the number of pixels per * unit of length */ private JSpinner pixelsPerUnitField; /** The main frame of the program */ private LaTeXDrawFrame parentFrame; /** The former unit selected */ private String formerUnitChoice; /** Allows to set the caption of the drawing */ private JTextField captionField; /** Allows to set the label of the drawing */ private JTextField labelField; /** Allows to place the figure in a page containing only floats */ private JRadioButton onlyWithFloatsCB; /** Allows to place the drawing at the top of the page */ private JRadioButton topCB; /** Allows to put the drawing at the bottom of the page */ private JRadioButton bottomCB; /** Allows to put the drawing following the code position */ private JRadioButton hereCB; /** Obligates to put the drawing following the code position */ private JRadioButton HERECB; /** Allows to put the drawing at the default position */ private JRadioButton defaultPositionCB; /** Obligates to put the drawing following the code position */ private JRadioButton centerHoriCB; /** Allows to put the drawing at the default position */ private JRadioButton defaultPositionHoriCB; /** The list of the packages of the current drawing. */ private JTextArea packagesDrawing; /** The list of the packages contained in the preferences. */ private JTextArea packagesList; /** The label of the label field */ public static final String LABEL_LABEL = LaTeXDrawLang.getDialogFrameString("DrawPropertiesFrame.0"); //$NON-NLS-1$ /** The label of the caption field */ public static final String LABEL_CAPTION = LaTeXDrawLang.getDialogFrameString("DrawPropertiesFrame.1"); //$NON-NLS-1$ /** The name of the pixelsPerUnitField JFormattedTextField */ public final static String NAME_PIXELS_FIELD = "pixelsPerUnitField";//$NON-NLS-1$ /** The name of the button ok */ public static final String NAME_BUTTON_OK = "BUTTON_OK";//$NON-NLS-1$ /** The name of the button cancel */ public static final String NAME_BUTTON_CANCEL = "BUTTON_CANCEL";//$NON-NLS-1$ /** The title of the frame */ public static final String TITLE = LaTeXDrawLang.getDialogFrameString("DrawPropertiesFrame.2"); //$NON-NLS-1$ public static final String LABEL_UNIT_PER = LaTeXDrawLang.getDialogFrameString("DrawPropertiesFrame.3"); //$NON-NLS-1$ public static final String ACTION_CMD_UNITCHOICE = "unitChoice"; //$NON-NLS-1$ public static final String LABEL_ONLYFLOATCB = LaTeXDrawLang.getDialogFrameString("DrawPropertiesFrame.5"); //$NON-NLS-1$ public static final String LABEL_TOP = LaTeXDrawLang.getDialogFrameString("DrawPropertiesFrame.6"); //$NON-NLS-1$ public static final String LABEL_BOTTOM = LaTeXDrawLang.getDialogFrameString("DrawPropertiesFrame.7"); //$NON-NLS-1$ public static final String LABEL_HERE = LaTeXDrawLang.getDialogFrameString("DrawPropertiesFrame.8"); //$NON-NLS-1$ public static final String LABEL_HERE_HERE = LaTeXDrawLang.getDialogFrameString("DrawPropertiesFrame.9"); //$NON-NLS-1$ public static final String LABEL_DEFAULT_POSITION = AbstractParametersFrame.LABEL_DEFAULT; public static final String LABEL_CENTER = LaTeXDrawLang.getDialogFrameString("DrawPropertiesFrame.10"); //$NON-NLS-1$ public static final String TITLE_BORDERS_PLACEMENT_VERT = LaTeXDrawLang.getDialogFrameString("DrawPropertiesFrame.11"); //$NON-NLS-1$ public static final String TITLE_BORDERS_PLACEMENT_HORI = LaTeXDrawLang.getDialogFrameString("DrawPropertiesFrame.12"); //$NON-NLS-1$ /** * The constructor by default */ public DrawPropertiesFrame(LaTeXDrawFrame frame) { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); parentFrame = frame; setIconImage(LaTeXDrawResources.drawingPropIcon.getImage()); formerUnitChoice = XScale.DEFAULT_UNIT; setTitle(TITLE); JTabbedPane tabbedPane = new JTabbedPane(); JButton buttonOk = new JButton(AbstractParametersFrame.LABEL_OK), buttonCancel = new JButton(AbstractParametersFrame.LABEL_CANCEL); buttonOk.setActionCommand(NAME_BUTTON_OK); buttonCancel.setActionCommand(NAME_BUTTON_CANCEL); buttonOk.addActionListener(this); buttonCancel.addActionListener(this); JPanel pButton = new JPanel(); pButton.add(buttonOk); pButton.add(buttonCancel); pButton.setPreferredSize(new Dimension(500, 40)); pButton.setMaximumSize(new Dimension(500, 40)); tabbedPane.addTab(LaTeXDrawLang.getDialogFrameString("PreferencesFrame.general"), createPanelGenParameters()); tabbedPane.addTab("Packages", createPanelPackages()); BoxLayout bl = new BoxLayout(getContentPane(), BoxLayout.Y_AXIS); getContentPane().setLayout(bl); getContentPane().add(tabbedPane); getContentPane().add(pButton); pack(); setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2); setVisible(false); } private JPanel createPanelPackages() { JPanel pkgP = new JPanel(); JSplitPane pane = new JSplitPane(); packagesDrawing = new JTextArea(); packagesList = new JTextArea(); JScrollPane sp1 = new JScrollPane(packagesDrawing); JScrollPane sp2 = new JScrollPane(packagesList); JPanel p1 = new JPanel(); JPanel p2 = new JPanel(); packagesList.setEditable(false); p1.setBorder(new CompoundBorder(new TitledBorder(null, "Document packages", TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(5,5,5,5))); p2.setBorder(new CompoundBorder(new TitledBorder(null, "Packages from preferences", TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(5,5,5,5))); p1.setLayout(new BoxLayout(p1, BoxLayout.X_AXIS)); p2.setLayout(new BoxLayout(p2, BoxLayout.X_AXIS)); pkgP.setLayout(new BoxLayout(pkgP, BoxLayout.X_AXIS)); packagesList.setToolTipText("These packages come from your preferences file.
They are not used for the drawing."); packagesDrawing.setToolTipText("Include into this list the packages you need to compile the drawing, e.g. :
\\usepackage[frenchb]{babel}
\\usepackage[utf8]{inputenc}
You can also copy/paste the packages you already saved in your preferences displayed on the right."); p1.add(sp1); p2.add(sp2); pane.setLeftComponent(p1); pane.setRightComponent(p2); pane.setDividerLocation(230); pkgP.add(pane); return pkgP; } protected void setPackagesLists() { packagesList.setText(parentFrame.getLatexIncludes()); packagesDrawing.setText(parentFrame.getCodePanel().getDocumentPackages()); } private JPanel createPanelGenParameters() { JPanel pGeneral = new JPanel(); pGeneral.setLayout(new BoxLayout(pGeneral, BoxLayout.Y_AXIS)); JPanel placementPanel = new JPanel(); placementPanel.setLayout(new GridLayout(6, 1)); ButtonGroup group = new ButtonGroup(); onlyWithFloatsCB = new JRadioButton(LABEL_ONLYFLOATCB); onlyWithFloatsCB.setName(CodePanel.TOKEN_VERT_FLOATS_PAGE); placementPanel.add(onlyWithFloatsCB); group.add(onlyWithFloatsCB); hereCB = new JRadioButton(LABEL_HERE); hereCB.setName(CodePanel.TOKEN_VERT_HERE); placementPanel.add(hereCB); group.add(hereCB); HERECB = new JRadioButton(LABEL_HERE_HERE); placementPanel.add(HERECB); group.add(HERECB); topCB = new JRadioButton(LABEL_TOP); placementPanel.add(topCB); group.add(topCB); bottomCB = new JRadioButton(LABEL_BOTTOM); placementPanel.add(bottomCB); group.add(bottomCB); defaultPositionCB = new JRadioButton(LABEL_DEFAULT_POSITION); placementPanel.add(defaultPositionCB); group.add(defaultPositionCB); placementPanel.setBorder(new CompoundBorder(new TitledBorder(null, TITLE_BORDERS_PLACEMENT_VERT, TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(5,5,5,5))); pGeneral.add(placementPanel); JPanel placementHoriPanel = new JPanel(); placementHoriPanel.setLayout(new GridLayout(2, 1)); group = new ButtonGroup(); centerHoriCB = new JRadioButton(LABEL_CENTER); placementHoriPanel.add(centerHoriCB); group.add(centerHoriCB); defaultPositionHoriCB = new JRadioButton(LABEL_DEFAULT_POSITION); placementHoriPanel.add(defaultPositionHoriCB); group.add(defaultPositionHoriCB); placementHoriPanel.setBorder(new CompoundBorder(new TitledBorder(null, TITLE_BORDERS_PLACEMENT_HORI, TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(5,5,5,5))); pGeneral.add(placementHoriPanel); JPanel pPpc = new JPanel(new FlowLayout(FlowLayout.LEFT)); SpinnerModel model = new SpinnerNumberModel(parentFrame.getDrawPanel().getPixelsPerCm(),1,100000,1); pixelsPerUnitField = new JSpinner(model); pixelsPerUnitField.setEditor(new JSpinner.NumberEditor(pixelsPerUnitField, "0"));//$NON-NLS-1$ pixelsPerUnitField.setToolTipText(LaTeXDrawLang.getDialogFrameString("DrawPropertiesFrame.13")); //$NON-NLS-1$ pixelsPerUnitField.setName(NAME_PIXELS_FIELD); pixelsPerUnitField.setMaximumSize(new Dimension(50,30)); pPpc.add(pixelsPerUnitField); pPpc.add(new JLabel(LABEL_UNIT_PER)); unitChoice = new LaTeXDrawComboBox(); unitChoice.addItem(XScale.LABEL_CM); unitChoice.addItem(XScale.LABEL_INCH); unitChoice.setSelectedItem(XScale.DEFAULT_UNIT); unitChoice.setPreferredSize(new Dimension(65,30)); unitChoice.setMaximumSize(new Dimension(65,30)); unitChoice.setMinimumSize(new Dimension(65,30)); unitChoice.setActionCommand(ACTION_CMD_UNITCHOICE); unitChoice.addActionListener(this); pPpc.add(unitChoice); JPanel pCaption = new JPanel(new FlowLayout(FlowLayout.LEFT)); pCaption.add(new JLabel(LABEL_CAPTION)); captionField = new JTextField(); captionField.setMinimumSize(new Dimension(200, 25)); captionField.setPreferredSize(new Dimension(200, 25)); pCaption.add(captionField); JPanel pLabel = new JPanel(new FlowLayout(FlowLayout.LEFT)); pLabel.add(new JLabel(LABEL_LABEL)); labelField = new JTextField(); labelField.setMinimumSize(new Dimension(200, 25)); labelField.setPreferredSize(new Dimension(200, 25)); pLabel.add(labelField); pGeneral.add(pPpc); pGeneral.add(pCaption); pGeneral.add(pLabel); return pGeneral; } public void actionPerformed(ActionEvent e) { Object o = e.getSource(); try { if(o instanceof JButton) { String label = ((JButton)o).getActionCommand(); if(label == NAME_BUTTON_CANCEL) { super.setVisible(false); return; } if(label == NAME_BUTTON_OK) { saveProperties(); parentFrame.getDrawPanel().repaint(); setVisible(false); return; } } if(o instanceof LaTeXDrawComboBox) { if(((LaTeXDrawComboBox)o).getActionCommand().equals(ACTION_CMD_UNITCHOICE)) { if(!formerUnitChoice.equals(unitChoice.getSelectedItem().toString())) { float pixf = Float.valueOf(pixelsPerUnitField.getValue().toString()); if(unitChoice.getSelectedItem().toString().equals(XScale.LABEL_CM)) pixelsPerUnitField.setValue((int)(pixf*PSTricksConstants.INCH_VAL_CM)); else pixelsPerUnitField.setValue((int)(pixf/PSTricksConstants.INCH_VAL_CM+1)); formerUnitChoice = unitChoice.getSelectedItem().toString(); } return ; } } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } /** * Initialise the values of the item of the frame */ public void setProperties() { try { DrawContainer draw = parentFrame.getDrawPanel().getDraw(); setPackagesLists(); unitChoice.setSelectedItem(draw.getUnitForPixelsPerCm()); int pix = draw.getPixelsPerCm(); if(unitChoice.getSelectedItem().toString().equals(XScale.LABEL_CM)) pixelsPerUnitField.setValue(pix); else pixelsPerUnitField.setValue((int)(pix/PSTricksConstants.INCH_VAL_CM+1)); CodePanel codePanel = parentFrame.getCodePanel(); String currentVertPosition = codePanel.getPositionVertToken(); String currentHoriPosition = codePanel.getPositionHoriToken(); if(currentVertPosition.equals(CodePanel.TOKEN_VERT_FLOATS_PAGE)) onlyWithFloatsCB.setSelected(true); else if(currentVertPosition.equals(CodePanel.TOKEN_VERT_BOTTOM)) bottomCB.setSelected(true); else if(currentVertPosition.equals(CodePanel.TOKEN_VERT_HERE)) hereCB.setSelected(true); else if(currentVertPosition.equals(CodePanel.TOKEN_VERT_HERE_HERE)) HERECB.setSelected(true); else if(currentVertPosition.equals(CodePanel.TOKEN_VERT_TOP)) topCB.setSelected(true); else defaultPositionCB.setSelected(true); if(currentHoriPosition.equals(CodePanel.TOKEN_HORI_CENTER_START)) centerHoriCB.setSelected(true); else defaultPositionHoriCB.setSelected(true); captionField.setText(codePanel.getCaption()); labelField.setText(codePanel.getLabel()); }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } @Override public void setVisible(boolean visible) { if(visible) setProperties(); super.setVisible(visible); } /** * Saves the properties */ public void saveProperties() { try { DrawContainer draw = parentFrame.getDrawPanel().getDraw(); CodePanel codePanel = parentFrame.getCodePanel(); float pixf = Float.valueOf(pixelsPerUnitField.getValue().toString()); int pix = (int)pixf; if(((String)unitChoice.getSelectedItem()).equals(XScale.LABEL_INCH)) pix*=PSTricksConstants.INCH_VAL_CM; parentFrame.setUnitForPixelsPerCm(unitChoice.getSelectedItem().toString()); draw.setPixelsPerCm(pix); codePanel.setLabel(labelField.getText()); codePanel.setCaption(captionField.getText()); if(onlyWithFloatsCB.isSelected()) codePanel.setPositionVertToken(CodePanel.TOKEN_VERT_FLOATS_PAGE); else if(HERECB.isSelected()) codePanel.setPositionVertToken(CodePanel.TOKEN_VERT_HERE_HERE); else if(hereCB.isSelected()) codePanel.setPositionVertToken(CodePanel.TOKEN_VERT_HERE); else if(topCB.isSelected()) codePanel.setPositionVertToken(CodePanel.TOKEN_VERT_TOP); else if(bottomCB.isSelected()) codePanel.setPositionVertToken(CodePanel.TOKEN_VERT_BOTTOM); else if(defaultPositionCB.isSelected()) codePanel.setPositionVertToken(CodePanel.TOKEN_HORI_VERT_DEFAULT); if(centerHoriCB.isSelected()) codePanel.setPositionHoriToken(CodePanel.TOKEN_HORI_CENTER_START); else codePanel.setPositionHoriToken(CodePanel.TOKEN_HORI_VERT_DEFAULT); codePanel.setDocumentPackages(packagesDrawing.getText()); parentFrame.getDrawPanel().setIsModified(true); parentFrame.getDrawPanel().updateCode(); }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/ParametersLineFrame.java0000644000000000000000000002071711347255510022047 0ustar package latexDraw.ui.dialog; import java.awt.*; import javax.swing.*; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import latexDraw.figures.Figure; import latexDraw.figures.Line; import latexDraw.lang.LaTeXDrawLang; import latexDraw.ui.DrawPanel; import latexDraw.util.LaTeXDrawPoint2D; /** * This class defines the frame which allows to change the parameters of lines.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class ParametersLineFrame extends AbstractParametersFrame { private static final long serialVersionUID = 1L; /** The left X-coordinates field */ protected JSpinner leftXField; /** The left Y-coordinates field */ protected JSpinner leftYField; /** The right X-coordinates field */ protected JSpinner rightXField; /** The right Y-coordinates field */ protected JSpinner rightYField; /** The label of the left X-coordinate choice */ public static final String LABEL_LEFTX = "X left";//$NON-NLS-1$ /** The label of the left Y-coordinate choice */ public static final String LABEL_LEFTY = "Y left";//$NON-NLS-1$ /** The label of the right X-coordinate choice */ public static final String LABEL_RIGHTX = "X right";//$NON-NLS-1$ /** The label of the right Y-coordinate choice */ public static final String LABEL_RIGHTY = "Y right";//$NON-NLS-1$ /** * The constructor by default */ public ParametersLineFrame(Frame parent, DrawPanel p, boolean attachToMainFrame) { super(parent, p, attachToMainFrame); try { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JPanel pButton = createButtonsPanel(this); JTabbedPane tabbedPane = new JTabbedPane(); JPanel pGeneral = new JPanel(); pGeneral.setLayout(new BoxLayout(pGeneral, BoxLayout.Y_AXIS)); JPanel coordP = new JPanel(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.CENTER; coordP.add(new JLabel(LaTeXDrawLang.getDialogFrameString("ParametersLineFrame.0")) //$NON-NLS-1$ , constraint); SpinnerModel model = new SpinnerNumberModel(0,0,10000,0.1); leftXField = new JSpinner(model); leftXField.setEditor(new JSpinner.NumberEditor(leftXField, "0.0"));//$NON-NLS-1$ leftXField.addChangeListener(this); leftXField.setName(LABEL_LEFTX); constraint.gridx = 1; coordP.add(leftXField, constraint); constraint.gridx++; coordP.add(new JLabel(LaTeXDrawLang.getDialogFrameString("ParametersLineFrame.1")), constraint); //$NON-NLS-1$ model = new SpinnerNumberModel(0,0,10000,0.1); leftYField = new JSpinner(model); leftYField.setEditor(new JSpinner.NumberEditor(leftYField, "0.0"));//$NON-NLS-1$ leftYField.addChangeListener(this); leftYField.setName(LABEL_LEFTY); constraint.gridx++; coordP.add(leftYField, constraint); constraint.gridx = 0; constraint.gridy++; coordP.add(new JLabel(LaTeXDrawLang.getDialogFrameString("ParametersLineFrame.2")), constraint); //$NON-NLS-1$ model = new SpinnerNumberModel(0,0,10000,0.1); rightXField = new JSpinner(model); rightXField.setEditor(new JSpinner.NumberEditor(rightXField, "0.0"));//$NON-NLS-1$ rightXField.addChangeListener(this); rightXField.setName(LABEL_RIGHTX); constraint.gridx++; coordP.add(rightXField, constraint); constraint.gridx++; coordP.add(new JLabel(LaTeXDrawLang.getDialogFrameString("ParametersLineFrame.3")), constraint); //$NON-NLS-1$ model = new SpinnerNumberModel(0,0,10000,0.1); rightYField = new JSpinner(model); rightYField.setEditor(new JSpinner.NumberEditor(rightYField, "0.0"));//$NON-NLS-1$ rightYField.addChangeListener(this); rightYField.setName(LABEL_RIGHTY); constraint.gridx++; coordP.add(rightYField, constraint); constraint.gridx = 0; constraint.gridy++; coordP.add(new JLabel(LABEL_ROTATION), constraint); constraint.gridx++; coordP.add(rotationField, constraint); coordP.setBorder(new CompoundBorder(new TitledBorder(null, LABEL_POSITION_DIMENSIONS, TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); pGeneral.add(coordP); pGeneral.add(createBordersPanel(false)); pGeneral.add(createDoubleLinePanel()); pGeneral.add(createShadowPanel()); tabbedPane.add(LABEL_GENERAL, pGeneral); tabbedPane.addTab(TITLE_TABBED_PANE_GENERAL, pGeneral); tabbedPane.addTab(NAME_TABBEDPANE_ARROW, createArrowPanel(false, true)); BoxLayout bl = new BoxLayout(getContentPane(), BoxLayout.Y_AXIS); getContentPane().setLayout(bl); getContentPane().add(glimpsePanelZoom); getContentPane().add(tabbedPane); getContentPane().add(pButton); pack(); setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2); setVisible(false); } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } @Override public void setFigureFrameField() { Line l = (Line)figure; LaTeXDrawPoint2D pt1 = l.getPt1(), pt2 = l.getPt2(); leftYField.setValue(pt1.y); rightYField.setValue(pt2.y); leftXField.setValue(pt1.x); rightXField.setValue(pt2.x); } @Override public void stateChanged(ChangeEvent e) { try { Object o = e.getSource(); Line l = (Line) glimpsePanel.getGlimpseFigure(); if(o instanceof JSpinner) { String name = ((JSpinner)o).getName(); LaTeXDrawPoint2D p1 = l.getPt1(), p2 = l.getPt2(); if(name.equals(LABEL_LEFTX)) { setModified(true); p1.x = Double.valueOf(leftXField.getValue().toString()).doubleValue(); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_LEFTY)) { setModified(true); p1.y = Double.valueOf(leftYField.getValue().toString()).doubleValue(); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_RIGHTX)) { setModified(true); p2.x = Double.valueOf(rightXField.getValue().toString()).doubleValue(); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_RIGHTY)) { setModified(true); p2.y = Double.valueOf(rightYField.getValue().toString()).doubleValue(); glimpsePanel.repaint(); return ; } } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } super.stateChanged(e); } @Override public void saveParameters() { Line l = (Line)figure; LaTeXDrawPoint2D p1 = l.getPt1(), p2 = l.getPt2(); p1.x = Double.valueOf(leftXField.getValue().toString()).doubleValue(); p2.x = Double.valueOf(rightXField.getValue().toString()).doubleValue(); p1.y = Double.valueOf(leftYField.getValue().toString()).doubleValue(); p2.y = Double.valueOf(rightYField.getValue().toString()).doubleValue(); super.saveParameters(); } @Override public void setVisible(boolean visible, Figure selected, boolean deleteOnCancel, boolean isFramedBox) { try { if(!(selected instanceof Line)) throw new ClassCastException(); super.setVisible(visible, selected, deleteOnCancel, isFramedBox); } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/ParametersBezierCurveFrame.java0000644000000000000000000005120211347255510023376 0ustar package latexDraw.ui.dialog; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ItemEvent; import javax.swing.*; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import latexDraw.figures.BezierCurve; import latexDraw.figures.Figure; import latexDraw.lang.LaTeXDrawLang; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.DrawPanel; import latexDraw.ui.components.LaTeXDrawComboBox; import latexDraw.util.LaTeXDrawPoint2D; /** * This class defines the frame which allows to modify a Bézier curve.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class ParametersBezierCurveFrame extends ParametersPolygonJoinedLinesFrame { private static final long serialVersionUID = 1L; /** Allows to show or to hide the control points of the Bézier curve */ protected JCheckBox showPointsCB; /** The current X-coordinates of the control point field */ protected JSpinner xFirstCtrlField; /** The current Y-coordinates of the control point field */ protected JSpinner yFirstCtrlField; /** The right X-coordinates field */ protected JSpinner xSecondCtrlField; /** The right Y-coordinates field */ protected JSpinner ySecondCtrlField; protected LaTeXDrawComboBox closingChoice; protected JCheckBox openCB; protected JButton equilibrateB; protected JSpinner equilibrateValueF; protected JCheckBox moveAll; public static final String LABEL_EQUILIBRATE_FIELD = "equilibrateF";//$NON-NLS-1$ public static final String LABEL_EQUILIBRATE = "equilibrateB";//$NON-NLS-1$ /** The label of the first X-coordinate of the control point of the current point. */ public static final String LABEL_CTRLPTS_FIRST_X = "firstCtrlX";//$NON-NLS-1$ /** The label of the first Y-coordinate of the control point of the current point. */ public static final String LABEL_CTRLPTS_FIRST_Y = "firstCtrlY";//$NON-NLS-1$ /** The label of the first X-coordinate of the control point of the current point. */ public static final String LABEL_CTRLPTS_SECOND_X = "sndCtrlX";//$NON-NLS-1$ /** The label of the first Y-coordinate of the control point of the current point. */ public static final String LABEL_CTRLPTS_SECOND_Y = "sndCtrlY";//$NON-NLS-1$ public static final String ACTION_CMD_OPENCB = "openCB";//$NON-NLS-1$ public static final String ACTION_CMD_MOVE_ALL = "moveAll";//$NON-NLS-1$ /** * The constructor by default. */ public ParametersBezierCurveFrame(Frame parent, DrawPanel d, boolean attachToMainFrame) { super(parent, d, false, attachToMainFrame); try { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JPanel pButton = createButtonsPanel(this); JPanel pGeneral = new JPanel(); JTabbedPane tabbedPane = new JTabbedPane(); pGeneral.setLayout(new BoxLayout(pGeneral, BoxLayout.Y_AXIS)); pGeneral.add(createPositionPanel()); pGeneral.add(createBordersPanel(false)); JPanel panel2 = new JPanel(); panel2.setLayout(new BoxLayout(panel2, BoxLayout.Y_AXIS)); JPanel showP = new JPanel(new FlowLayout(FlowLayout.LEFT)); showPointsCB = new JCheckBox(LABEL_SHOWPOINTCB); showPointsCB.addActionListener(this); showPointsCB.setActionCommand(LABEL_SHOWPOINTCB); showP.add(showPointsCB); panel2.add(showP); JPanel closeP = new JPanel(new FlowLayout(FlowLayout.LEFT)); openCB = new JCheckBox(LaTeXDrawLang.getString1_9("ParametersAkinPointsFrame.1")); //$NON-NLS-1$ openCB.setActionCommand(ACTION_CMD_OPENCB); openCB.setName(ACTION_CMD_OPENCB); openCB.addActionListener(this); closeP.add(openCB); closeP.add(new JLabel(LaTeXDrawLang.getString1_9("ParametersAkinPointsFrame.2"))); //$NON-NLS-1$ closingChoice = BezierCurve.createTypeChoice(); closingChoice.addItemListener(this); closeP.add(closingChoice); panel2.add(closeP); JPanel equilibrateP = new JPanel(new FlowLayout(FlowLayout.LEFT)); equilibrateB = new JButton(LaTeXDrawLang.getString1_9("ParametersBezierCurveFrame.2")); //$NON-NLS-1$ equilibrateB.setToolTipText(LaTeXDrawLang.getString1_9("ParametersBezierCurveFrame.3")); //$NON-NLS-1$ equilibrateB.setActionCommand(LABEL_EQUILIBRATE); equilibrateB.addActionListener(this); equilibrateP.add(equilibrateB); panel2.add(equilibrateP); equilibrateP.add(new JLabel(LaTeXDrawLang.getString1_9("ParametersBezierCurveFrame.4"))); //$NON-NLS-1$ SpinnerModel model = new SpinnerNumberModel(BezierCurve.DEFAULT_EQUILIBRATE_GAP, 1, 1000, 1); equilibrateValueF = new JSpinner(model); equilibrateValueF.setToolTipText(LaTeXDrawLang.getString1_9("ParametersBezierCurveFrame.5")); //$NON-NLS-1$ equilibrateValueF.setEditor(new JSpinner.NumberEditor(equilibrateValueF, "0"));//$NON-NLS-1$ equilibrateValueF.addChangeListener(this); equilibrateValueF.setName(LABEL_EQUILIBRATE_FIELD); equilibrateValueF.setMaximumSize(new Dimension(100, 40)); equilibrateP.add(equilibrateValueF); pGeneral.add(panel2); panel2.setBorder(new CompoundBorder(new TitledBorder(null, TITLE_TABBED_PANE_OTHERS, TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); JPanel pOther = new JPanel(); pOther.setLayout(new BoxLayout(pOther, BoxLayout.Y_AXIS)); pOther.add(createShadowPanel()); pOther.add(createFillPanel()); pOther.add(createHatchingPanel()); pOther.add(createGradientPanel()); pOther.add(createDoubleLinePanel()); tabbedPane.addTab(TITLE_TABBED_PANE_GENERAL, pGeneral); tabbedPane.addTab(TITLE_TABBED_PANE_OTHERS, pOther); tabbedPane.addTab(NAME_TABBEDPANE_ARROW, createArrowPanel(true, false)); BoxLayout bl = new BoxLayout(getContentPane(), BoxLayout.Y_AXIS); getContentPane().removeAll(); getContentPane().setLayout(bl); getContentPane().add(glimpsePanelZoom); getContentPane().add(tabbedPane); getContentPane().add(pButton); pack(); setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2); setVisible(false); }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } @Override protected JPanel createPositionPanel() { super.createPositionPanel(); JPanel coordP = new JPanel(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.CENTER; coordP.add(new JLabel(LaTeXDrawLang.getDialogFrameString("ParametersPolygonFrame.1")), constraint); //$NON-NLS-1$ constraint.gridx++; coordP.add(pointChoice, constraint); moveAll = new JCheckBox(LaTeXDrawLang.getDialogFrameString("ParamsBC.0")); //$NON-NLS-1$ moveAll.setName(ACTION_CMD_MOVE_ALL); moveAll.setActionCommand(ACTION_CMD_MOVE_ALL); moveAll.setToolTipText(LaTeXDrawLang.getDialogFrameString("ParamsBC.1")); //$NON-NLS-1$ moveAll.setSelected(true); constraint.gridx++; coordP.add(moveAll, constraint); constraint.gridx=0; constraint.gridy++; coordP.add(new JLabel(LABEL_X), constraint); constraint.gridx++; coordP.add(xCoord, constraint); constraint.gridx++; coordP.add(new JLabel(LABEL_Y), constraint); constraint.gridx++; coordP.add(yCoord, constraint); constraint.gridx=0; constraint.gridy++; coordP.add(new JLabel(LaTeXDrawLang.getString1_9("ParametersBezierCurveFrame.6")), constraint); //$NON-NLS-1$ SpinnerModel model = new SpinnerNumberModel(0,0,10000,0.1); xFirstCtrlField = new JSpinner(model); xFirstCtrlField.setEditor(new JSpinner.NumberEditor(xFirstCtrlField, "0.0"));//$NON-NLS-1$ xFirstCtrlField.addChangeListener(this); xFirstCtrlField.setName(LABEL_CTRLPTS_FIRST_X); constraint.gridx++; coordP.add(xFirstCtrlField, constraint); constraint.gridx++; coordP.add(new JLabel(LaTeXDrawLang.getString1_9("ParametersBezierCurveFrame.7")), constraint); //$NON-NLS-1$ model = new SpinnerNumberModel(0,0,10000,0.1); yFirstCtrlField = new JSpinner(model); yFirstCtrlField.setEditor(new JSpinner.NumberEditor(yFirstCtrlField, "0.0"));//$NON-NLS-1$ yFirstCtrlField.addChangeListener(this); yFirstCtrlField.setName(LABEL_CTRLPTS_FIRST_Y); constraint.gridx++; coordP.add(yFirstCtrlField, constraint); constraint.gridx=0; constraint.gridy++; coordP.add(new JLabel(LaTeXDrawLang.getString1_9("ParametersBezierCurveFrame.8")), constraint); //$NON-NLS-1$ model = new SpinnerNumberModel(0,0,10000,0.1); xSecondCtrlField = new JSpinner(model); xSecondCtrlField.setEditor(new JSpinner.NumberEditor(xSecondCtrlField, "0.0"));//$NON-NLS-1$ xSecondCtrlField.addChangeListener(this); xSecondCtrlField.setName(LABEL_CTRLPTS_SECOND_X); constraint.gridx++; coordP.add(xSecondCtrlField, constraint); constraint.gridx++; coordP.add(new JLabel(LaTeXDrawLang.getString1_9("ParametersBezierCurveFrame.9")), constraint); //$NON-NLS-1$ model = new SpinnerNumberModel(0,0,10000,0.1); ySecondCtrlField = new JSpinner(model); ySecondCtrlField.setEditor(new JSpinner.NumberEditor(ySecondCtrlField, "0.0"));//$NON-NLS-1$ ySecondCtrlField.addChangeListener(this); ySecondCtrlField.setName(LABEL_CTRLPTS_SECOND_Y); constraint.gridx++; coordP.add(ySecondCtrlField, constraint); constraint.gridx = 0; constraint.gridy++; coordP.add(new JLabel(LABEL_ROTATION), constraint); constraint.gridx++; coordP.add(rotationField, constraint); coordP.setBorder(new CompoundBorder(new TitledBorder(null, LABEL_POSITION_DIMENSIONS, TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); return coordP; } @Override public void setVisible(boolean visible, Figure selected, boolean deleteOnCancel, boolean isFramedBox) { try { if(!(selected instanceof BezierCurve)) throw new ClassCastException(); super.setVisible(visible, selected, deleteOnCancel, isFramedBox); }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } @Override public void setDefaultsValues() { try { super.setDefaultsValues(); showPointsCB.setSelected(BezierCurve.DEFAULT_SHOWPOINTS); ((BezierCurve)glimpsePanel.glimpseFigure).setShowPoints(BezierCurve.DEFAULT_SHOWPOINTS); closingChoice.setSelectedItem(String.valueOf(BezierCurve.DEFAULT_CLOSE_TYPE)); openCB.setSelected(BezierCurve.DEFAULT_OPEN); equilibrateValueF.setValue(BezierCurve.DEFAULT_EQUILIBRATE_GAP); glimpsePanel.repaint(); }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } @Override public void saveParameters() { super.saveParameters(); BezierCurve bc1 = (BezierCurve)figure; BezierCurve bc2 = (BezierCurve)glimpsePanel.glimpseFigure; int i, size = bc1.getNbPoints(); for(i=0; i *
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class ParametersTriangleFrame extends AbstractParametersFrame { private static final long serialVersionUID = 1L; /** Allows to change the x-coordinates of the centre of the figure */ protected JSpinner baseCenterXField; /** Allows to change the y-coordinates of the centre of the figure */ protected JSpinner baseCenterYField; /** Allows to change the width of the triangle */ protected JSpinner widthField; /** Allows to change the height of the triangle */ protected JSpinner heightField; /** * The constructor by default */ public ParametersTriangleFrame(Frame parent, DrawPanel p, boolean attachToMainFrame) { super(parent, p, attachToMainFrame); try { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JTabbedPane tabbedPane = new JTabbedPane(); JPanel pButton = createButtonsPanel(this); JPanel pGeneral = new JPanel(); pGeneral.setLayout(new BoxLayout(pGeneral, BoxLayout.Y_AXIS)); JPanel coordP = new JPanel(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.CENTER; coordP.add(new JLabel(LaTeXDrawLang.getDialogFrameString("ParametersTriangleFrame.0")), constraint); //$NON-NLS-1$ SpinnerModel model = new SpinnerNumberModel(0,0,10000,0.1); baseCenterXField = new JSpinner(model); baseCenterXField.setEditor(new JSpinner.NumberEditor(baseCenterXField, "0.0"));//$NON-NLS-1$ baseCenterXField.addChangeListener(this); baseCenterXField.setName(LABEL_CENTER_X); constraint.gridx = 1; coordP.add(baseCenterXField, constraint); constraint.gridx++; coordP.add(new JLabel(LaTeXDrawLang.getDialogFrameString("ParametersTriangleFrame.1")), constraint); //$NON-NLS-1$ model = new SpinnerNumberModel(0,0,10000,0.1); baseCenterYField = new JSpinner(model); baseCenterYField.setEditor(new JSpinner.NumberEditor(baseCenterYField, "0.0"));//$NON-NLS-1$ baseCenterYField.addChangeListener(this); baseCenterYField.setName(LABEL_CENTER_Y); constraint.gridx++; coordP.add(baseCenterYField, constraint); model = new SpinnerNumberModel(Figure.DEFAULT_ROTATION_ANGLE, -360, 360,0.1); rotationField = new JSpinner(model); rotationField.setEditor(new JSpinner.NumberEditor(rotationField, "0.0")); //$NON-NLS-1$ rotationField.setName(LaTeXDrawResources.LABEL_ROTATE); rotationField.addChangeListener(this); rotationField.setName(LaTeXDrawResources.LABEL_ROTATE); constraint.gridx = 1; constraint.gridwidth = 1; coordP.add(rotationField, constraint); constraint.gridx = 0; constraint.gridy++; coordP.add(new JLabel(LABEL_WIDTH), constraint); model = new SpinnerNumberModel(0.1,0.1,10000,0.1); widthField = new JSpinner(model); widthField.setEditor(new JSpinner.NumberEditor(widthField, "0.0"));//$NON-NLS-1$ widthField.addChangeListener(this); widthField.setName(LABEL_WIDTH); constraint.gridx++; coordP.add(widthField, constraint); constraint.gridx++; coordP.add(new JLabel(LABEL_HEIGHT), constraint); model = new SpinnerNumberModel(0.1,0.1,10000,0.1); heightField = new JSpinner(model); heightField.setEditor(new JSpinner.NumberEditor(heightField, "0.0"));//$NON-NLS-1$ heightField.addChangeListener(this); heightField.setName(LABEL_HEIGHT); constraint.gridx++; coordP.add(heightField, constraint); constraint.gridx = 0; constraint.gridy++; coordP.add(new JLabel(LABEL_ROTATION), constraint); constraint.gridx++; coordP.add(rotationField, constraint); coordP.setBorder(new CompoundBorder(new TitledBorder(null, LABEL_POSITION_DIMENSIONS, TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); pGeneral.add(coordP); pGeneral.add(createBordersPanel(true)); pGeneral.add(createDoubleLinePanel()); pGeneral.add(createFillPanel()); JPanel pOther = new JPanel(); pOther.setLayout(new BoxLayout(pOther, BoxLayout.Y_AXIS)); pOther.add(createShadowPanel()); pOther.add(createGradientPanel()); pOther.add(createHatchingPanel()); tabbedPane.addTab(TITLE_TABBED_PANE_GENERAL, pGeneral); tabbedPane.addTab(TITLE_TABBED_PANE_OTHERS, pOther); BoxLayout bl = new BoxLayout(getContentPane(), BoxLayout.Y_AXIS); getContentPane().setLayout(bl); getContentPane().add(glimpsePanelZoom); getContentPane().add(tabbedPane); getContentPane().add(pButton); pack(); setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2); setVisible(false); } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } @Override public void saveParameters() { super.saveParameters(); Triangle t = (Triangle)figure; LaTeXDrawPoint2D p1 = t.getPoint(0), p2 = t.getPoint(1), p3 = t.getPoint(2), p4 = t.getPoint(3); double width = Double.valueOf(widthField.getValue().toString()).doubleValue(); double height = Double.valueOf(heightField.getValue().toString()).doubleValue(); double x = Double.valueOf(baseCenterXField.getValue().toString()).doubleValue(); double y = Double.valueOf(baseCenterYField.getValue().toString()).doubleValue(); if(p1.y *
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class ParametersArcFrame extends AbstractParametersFrame { private static final long serialVersionUID = 1L; /** Allows to change the x-coordinates of the centre of the figure */ protected JSpinner centerXField; /** Allows to change the y-coordinates of the centre of the figure */ protected JSpinner centerYField; /** Allows to change the radius of the circle */ protected JSpinner radiusField; /** Allows to set the start angle of the arc */ protected JSpinner startAngle; /** Allows to set the end angle of the arc */ protected JSpinner endAngle; /** This choice allows to choice the kind of the arc */ protected JComboBox arcChoice; /** Allows to display the points of the arc */ protected JCheckBox showPointCB; /** The label of the start angle field */ public static final String LABEL_START_ANGLE = LaTeXDrawLang.getDialogFrameString("ParametersArcFrame.0"); //$NON-NLS-1$ /** The label of the end angle field */ public static final String LABEL_END_ANGLE = LaTeXDrawLang.getDialogFrameString("ParametersArcFrame.1"); //$NON-NLS-1$ public static final String NAME_TABBEDPANE_GENERAL = LABEL_GENERAL; /** * The constructor by default * @param p The panel containing the drawing */ public ParametersArcFrame(Frame parent, DrawPanel p, boolean attachToMainFrame) { super(parent, p, attachToMainFrame); try { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); JTabbedPane tabbedPane = new JTabbedPane(); JPanel pButton = createButtonsPanel(this); JPanel pGeneral = new JPanel(); pGeneral.setLayout(new BoxLayout(pGeneral, BoxLayout.Y_AXIS)); JPanel coordP = new JPanel(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.CENTER; coordP.add(new JLabel(LABEL_CENTER_X), constraint); SpinnerModel model = new SpinnerNumberModel(0,0,10000,0.1); centerXField = new JSpinner(model); centerXField.setEditor(new JSpinner.NumberEditor(centerXField, "0.0"));//$NON-NLS-1$ centerXField.addChangeListener(this); constraint.gridx = 1; centerXField.setName(LABEL_CENTER_X); coordP.add(centerXField, constraint); constraint.gridx = 3; coordP.add(new JLabel(LABEL_CENTER_Y), constraint); model = new SpinnerNumberModel(0,0,10000,0.1); centerYField = new JSpinner(model); centerYField.setEditor(new JSpinner.NumberEditor(centerYField, "0.0"));//$NON-NLS-1$ centerYField.addChangeListener(this); constraint.gridx = 4; centerYField.setName(LABEL_CENTER_Y); coordP.add(centerYField, constraint); constraint.gridx = 0; constraint.gridy++; coordP.add(new JLabel(LABEL_RADIUS), constraint); model = new SpinnerNumberModel(0.1,0.1,10000,0.1); radiusField = new JSpinner(model); radiusField.setEditor(new JSpinner.NumberEditor(radiusField, "0.0"));//$NON-NLS-1$ radiusField.addChangeListener(this); constraint.gridx = 1; radiusField.setName(LABEL_RADIUS); coordP.add(radiusField, constraint); constraint.gridx = 0; constraint.gridy++; coordP.add(new JLabel(LABEL_ROTATION), constraint); constraint.gridx++; coordP.add(rotationField, constraint); coordP.setBorder(new CompoundBorder(new TitledBorder(null, LABEL_POSITION_DIMENSIONS, TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); JPanel arcP = new JPanel(new GridBagLayout()); constraint.gridx=0; constraint.gridy=0; arcP.add(new JLabel(LaTeXDrawLang.getDialogFrameString("ParametersArcFrame.2")), constraint); //$NON-NLS-1$ constraint.gridx++; arcChoice = Arc.createArcChoice(this); arcP.add(arcChoice, constraint); constraint.gridy++; constraint.gridx = 0; arcP.add(new JLabel(LABEL_START_ANGLE), constraint); constraint.gridx++; model = new SpinnerNumberModel(0,-360,360,0.1); startAngle = new JSpinner(model); startAngle.setEditor(new JSpinner.NumberEditor(startAngle, "0.0"));//$NON-NLS-1$ startAngle.addChangeListener(this); startAngle.setName(LABEL_START_ANGLE); arcP.add(startAngle, constraint); constraint.gridx++; arcP.add(new JLabel(LABEL_END_ANGLE), constraint); constraint.gridx++; model = new SpinnerNumberModel(0,-360,360,0.1); endAngle = new JSpinner(model); endAngle.setEditor(new JSpinner.NumberEditor(endAngle, "0.0"));//$NON-NLS-1$ endAngle.addChangeListener(this); endAngle.setName(LABEL_END_ANGLE); arcP.add(endAngle, constraint); arcP.setBorder(new CompoundBorder(new TitledBorder(null, LaTeXDrawLang.getOthersString("Arc.arc"), //$NON-NLS-1$ TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); pGeneral.add(coordP); pGeneral.add(createBordersPanel(false)); pGeneral.add(createFillPanel()); pGeneral.add(arcP); JPanel showP = new JPanel(new BorderLayout()); showPointCB = new JCheckBox(LABEL_SHOWPOINTCB); showPointCB.addActionListener(this); showPointCB.setActionCommand(LABEL_SHOWPOINTCB); showP.add(showPointCB); showP.setBorder(new CompoundBorder(new TitledBorder(null, TITLE_TABBED_PANE_OTHERS, TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); JPanel pOther = new JPanel(); pOther.setLayout(new BoxLayout(pOther, BoxLayout.Y_AXIS)); pOther.add(createShadowPanel()); pOther.add(createGradientPanel()); pOther.add(createHatchingPanel()); pOther.add(showP); tabbedPane.addTab(TITLE_TABBED_PANE_GENERAL, pGeneral); tabbedPane.addTab(NAME_TABBEDPANE_ARROW, createArrowPanel(true, false)); tabbedPane.addTab(TITLE_TABBED_PANE_OTHERS, pOther); BoxLayout bl = new BoxLayout(getContentPane(), BoxLayout.Y_AXIS); getContentPane().setLayout(bl); getContentPane().add(glimpsePanelZoom); getContentPane().add(tabbedPane); getContentPane().add(pButton); pack(); setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2); setVisible(false); } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } @Override public void actionPerformed(ActionEvent e) { Object o = e.getSource(); try { if(o instanceof JCheckBox) { String label = ((JCheckBox)o).getActionCommand(); if(label.equals(LABEL_SHOWPOINTCB)) { setModified(true); ((Arc)glimpsePanel.glimpseFigure).setShowPoints(showPointCB.isSelected()); glimpsePanel.repaint(); return ; } } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } super.actionPerformed(e); } @Override public void saveParameters() { super.saveParameters(); LaTeXDrawPoint2D p1, p2, p3, p4; Arc a = (Arc)figure; p1 = a.getBordersPoint(0); p2 = a.getBordersPoint(1); p3 = a.getBordersPoint(2); p4 = a.getBordersPoint(3); float radius = Float.valueOf(radiusField.getValue().toString()); float x = Float.valueOf(centerXField.getValue().toString()); float y = Float.valueOf(centerYField.getValue().toString()); float start = Float.valueOf(startAngle.getValue().toString()); float end = Float.valueOf(endAngle.getValue().toString()); String type = (String)arcChoice.getSelectedItem(); p1.x = x - radius; p2.x = x + radius; p3.x = x - radius; p4.x = x + radius; p1.y = y - radius; p2.y = y - radius; p3.y = y + radius; p4.y = y + radius; ((Arc)figure).setStartAngle(Math.toRadians(start)); ((Arc)figure).setEndAngle(Math.toRadians(end)); ((Arc)figure).setType(type); ((Arc)figure).updateCenterStartEndDelimitors(); ((Arc)figure).setShowPoints(showPointCB.isSelected()); figure.updateShape(); drawPanel.getDraw().updateBorders(); drawPanel.updateDraw(true); } @Override public void setFigureFrameField() { LaTeXDrawPoint2D NW, SE; NW = figure.getTheNWPoint(); SE = figure.getTheSEPoint(); radiusField.setValue((SE.x-NW.x)/2.); centerXField.setValue((NW.x+SE.x)/2.); centerYField.setValue((NW.y+SE.y)/2.); startAngle.setValue(Math.toDegrees(((Arc)figure).getStartAngle())); endAngle.setValue(Math.toDegrees(((Arc)figure).getEndAngle())); arcChoice.setSelectedItem(((Arc)figure).getTypeName()); showPointCB.setSelected(((Arc)figure).isShowPoints()); } @Override public void setVisible(boolean visible, Figure selected, boolean deleteOnCancel, boolean isFramedBox) { try { if(!(selected instanceof Arc)) throw new ClassCastException(); super.setVisible(visible, selected, deleteOnCancel, isFramedBox); } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } @Override public void setDefaultsValues() { super.setDefaultsValues(); try { Arc a = (Arc)glimpsePanel.getGlimpseFigure(); startAngle.setValue(Math.toDegrees(Arc.DEFAULT_STARTANGLE)); endAngle.setValue(Math.toDegrees(Arc.DEFAULT_ENDANGLE)); arcChoice.setSelectedItem(Arc.DEFAULT_TYPE); a.setEndAngle(Arc.DEFAULT_ENDANGLE); a.setStartAngle(Arc.DEFAULT_STARTANGLE); a.setShowPoints(Arc.DEFAULT_SHOWPOINTS); showPointCB.setSelected(Arc.DEFAULT_SHOWPOINTS); a.setShowPoints(Arc.DEFAULT_SHOWPOINTS); glimpsePanel.repaint(); } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } @Override public void stateChanged(ChangeEvent e) { try { Object o = e.getSource(); Arc f = (Arc) glimpsePanel.getGlimpseFigure(); if(o instanceof JSpinner) { String name = ((JSpinner)o).getName(); double v = Double.valueOf(((JSpinner)o).getValue().toString()).doubleValue(); if(name.equals(LABEL_START_ANGLE)) { setModified(true); f.setStartAngle(Math.toRadians(v)); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_END_ANGLE)) { setModified(true); f.setEndAngle(Math.toRadians(v)); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_CENTER_X)) { setModified(true); LaTeXDrawPoint2D p1, p2, p3, p4; p1 = f.getBordersPoint(0); p2 = f.getBordersPoint(1); p3 = f.getBordersPoint(2); p4 = f.getBordersPoint(3); double radius = Double.valueOf(radiusField.getValue().toString()).doubleValue(); p1.x = v - radius; p2.x = v + radius; p3.x = v - radius; p4.x = v + radius; f.updateGravityCenter(); f.updateShape(); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_CENTER_Y)) { setModified(true); LaTeXDrawPoint2D p1, p2, p3, p4; p1 = f.getBordersPoint(0); p2 = f.getBordersPoint(1); p3 = f.getBordersPoint(2); p4 = f.getBordersPoint(3); double radius = Double.valueOf(radiusField.getValue().toString()).doubleValue(); p1.y = v - radius; p2.y = v - radius; p3.y = v + radius; p4.y = v + radius; f.updateGravityCenter(); f.updateShape(); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_RADIUS)) { setModified(true); LaTeXDrawPoint2D p1, p2, p3, p4; p1 = f.getBordersPoint(0); p2 = f.getBordersPoint(1); p3 = f.getBordersPoint(2); p4 = f.getBordersPoint(3); double y = Double.valueOf(centerYField.getValue().toString()).doubleValue(); double x = Double.valueOf(centerXField.getValue().toString()).doubleValue(); p1.x = x - v; p2.x = x + v; p3.x = x - v; p4.x = x + v; p1.y = y - v; p2.y = y - v; p3.y = y + v; p4.y = y + v; glimpsePanel.repaint(); return ; } } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } super.stateChanged(e); } @Override public void itemStateChanged(ItemEvent e) { try { Arc f = (Arc) glimpsePanel.getGlimpseFigure(); Object o = e.getSource(); if(o instanceof JComboBox) { String name = ((JComboBox)o).getName(); if(name.equals(Arc.LABEL_ARCCHOICE)) { if(((String)((JComboBox)o).getSelectedItem()).equals(Arc.TYPE_ARC)) { arrow1Choice.setEnabled(true); arrow2Choice.setEnabled(true); } else { arrow1Choice.setEnabled(false); arrow2Choice.setEnabled(false); } updateEnableParamsArrow(); setModified(true); f.setType(((JComboBox)o).getSelectedItem().toString()); glimpsePanel.repaint(); return ; } } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } super.itemStateChanged(e); } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/AbstractGridShapeFrame.java0000644000000000000000000004162011347255510022462 0ustar package latexDraw.ui.dialog; import java.awt.Dimension; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import javax.swing.*; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import latexDraw.figures.Figure; import latexDraw.figures.GridShape; import latexDraw.lang.LaTeXDrawLang; import latexDraw.ui.DrawPanel; import latexDraw.util.LaTeXDrawPoint2D; import latexDraw.util.LaTeXDrawResources; /** * This class defines the frame which allows to modify a grid
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 08/17/06
* @author Arnaud BLOUIN
* @since 1.8
* @version 2.0.0
*/ public abstract class AbstractGridShapeFrame extends AbstractParametersFrame { private static final long serialVersionUID = 1L; /** Allows to change the minimum value of X */ protected JSpinner xGridStart; /** Allows to change the minimum value of Y */ protected JSpinner yGridStart; /** Allows to change the maximum value of X */ protected JSpinner xGridEnd; /** Allows to change the maximum value of Y */ protected JSpinner yGridEnd; /** Allows to change the X-origin */ protected JSpinner xOrigin; /** Allows to change the Y-origin */ protected JSpinner yOrigin; /** This field allows the set the X-coordinate of position of the grid * (the south-west point) */ protected JSpinner xPosition; /** This field allows the set the Y-coordinate of position of the grid * (the south-west point) */ protected JSpinner yPosition; /** Allows to know if we must draw the labels */ protected JCheckBox invertXLabelsCB; /** Allows to know if we must draw the labels */ protected JCheckBox invertYLabelsCB; /** The label of the invertXLabelsCB */ public static final String LABEL_ISXLABEL = LaTeXDrawLang.getString1_6("ParametersGridFrame.0"); //$NON-NLS-1$ /** The label of the invertYLabelsCB */ public static final String LABEL_ISYLABEL = LaTeXDrawLang.getString1_6("ParametersGridFrame.1"); //$NON-NLS-1$ /** The label of the yOrigin item */ public static final String LABEL_YORIGIN = LaTeXDrawLang.getDialogFrameString("ParametersGridFrame.0"); //$NON-NLS-1$ /** The label of the xOrigin item */ public static final String LABEL_XORIGIN = LaTeXDrawLang.getDialogFrameString("ParametersGridFrame.1"); //$NON-NLS-1$ /** The label of the gridLabelsColor item */ public static final String LABEL_LABELSCOLOR = LaTeXDrawLang.getDialogFrameString("ParametersGridFrame.2"); //$NON-NLS-1$ /** The label of the xGridEnd item */ public static final String LABEL_XGRIDEND = LaTeXDrawLang.getDialogFrameString("ParametersGridFrame.11"); //$NON-NLS-1$ /** The label of the xGridStart item */ public static final String LABEL_XGRIDSTART = LaTeXDrawLang.getDialogFrameString("ParametersGridFrame.12"); //$NON-NLS-1$ /** The label of the yGridEnd item */ public static final String LABEL_YGRIDEND = LaTeXDrawLang.getDialogFrameString("ParametersGridFrame.13"); //$NON-NLS-1$ /** The label of the yGridStart item */ public static final String LABEL_YGRIDSTART = LaTeXDrawLang.getDialogFrameString("ParametersGridFrame.14"); //$NON-NLS-1$ protected AbstractGridShapeFrame(Frame parent, DrawPanel d, boolean attachToMainFrame) { super(parent, d, attachToMainFrame); } protected JPanel createPositionPanel(boolean withOrigin) { JPanel coordP = new JPanel(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.CENTER; coordP.add(new JLabel(LABEL_X), constraint); SpinnerModel model = new SpinnerNumberModel(0,0,10000,0.1); xPosition = new JSpinner(model); xPosition.setEditor(new JSpinner.NumberEditor(xPosition, "0.0"));//$NON-NLS-1$ xPosition.addChangeListener(this); xPosition.setName(LABEL_X); constraint.gridx++; coordP.add(xPosition, constraint); constraint.gridx++; coordP.add(new JLabel(LABEL_Y), constraint); model = new SpinnerNumberModel(0,0,10000,0.1); yPosition = new JSpinner(model); yPosition.setEditor(new JSpinner.NumberEditor(yPosition, "0.0"));//$NON-NLS-1$ yPosition.addChangeListener(this); yPosition.setName(LABEL_Y); constraint.gridx++; coordP.add(yPosition, constraint); constraint.gridx = 0; constraint.gridy++; coordP.add(new JLabel(LABEL_XGRIDSTART), constraint); model = new SpinnerNumberModel(0,-10000,10000,1); xGridStart = new JSpinner(model); xGridStart.setEditor(new JSpinner.NumberEditor(xGridStart, "0"));//$NON-NLS-1$ xGridStart.addChangeListener(this); xGridStart.setName(LABEL_XGRIDSTART); constraint.gridx++; coordP.add(xGridStart, constraint); constraint.gridx++; coordP.add(new JLabel(LABEL_YGRIDSTART), constraint); model = new SpinnerNumberModel(0,-10000,10000,1); yGridStart = new JSpinner(model); yGridStart.setEditor(new JSpinner.NumberEditor(yGridStart, "0"));//$NON-NLS-1$ yGridStart.addChangeListener(this); yGridStart.setName(LABEL_YGRIDSTART); constraint.gridx++; coordP.add(yGridStart, constraint); constraint.gridx = 0; constraint.gridy++; coordP.add(new JLabel(LABEL_XGRIDEND), constraint); model = new SpinnerNumberModel(0,-10000,10000,1); xGridEnd = new JSpinner(model); xGridEnd.setEditor(new JSpinner.NumberEditor(xGridEnd, "0"));//$NON-NLS-1$ xGridEnd.addChangeListener(this); xGridEnd.setName(LABEL_XGRIDEND); constraint.gridx++; coordP.add(xGridEnd, constraint); constraint.gridx++; coordP.add(new JLabel(LABEL_YGRIDEND), constraint); model = new SpinnerNumberModel(0,-10000,10000,1); yGridEnd = new JSpinner(model); yGridEnd.setEditor(new JSpinner.NumberEditor(yGridEnd, "0"));//$NON-NLS-1$ yGridEnd.addChangeListener(this); yGridEnd.setName(LABEL_YGRIDEND); constraint.gridx++; coordP.add(yGridEnd, constraint); if(withOrigin) { constraint.gridx=0; constraint.gridy++; coordP.add(new JLabel(LABEL_XORIGIN), constraint); model = new SpinnerNumberModel(0,-10000,10000,1); xOrigin = new JSpinner(model); xOrigin.setEditor(new JSpinner.NumberEditor(xOrigin, "0"));//$NON-NLS-1$ xOrigin.addChangeListener(this); xOrigin.setName(LABEL_XORIGIN); constraint.gridx++; coordP.add(xOrigin, constraint); constraint.gridx++; coordP.add(new JLabel(LABEL_YORIGIN), constraint); model = new SpinnerNumberModel(0,-10000,10000,1); yOrigin = new JSpinner(model); yOrigin.setEditor(new JSpinner.NumberEditor(yOrigin, "0"));//$NON-NLS-1$ yOrigin.addChangeListener(this); yOrigin.setName(LABEL_YORIGIN); constraint.gridx++; coordP.add(yOrigin, constraint); } constraint.gridx = 0; constraint.gridy++; coordP.add(new JLabel(LABEL_ROTATION), constraint); model = new SpinnerNumberModel(Figure.DEFAULT_ROTATION_ANGLE, -360, 360,0.1); rotationField = new JSpinner(model); rotationField.setEditor(new JSpinner.NumberEditor(rotationField, "0.0"));//$NON-NLS-1$ rotationField.setName(LaTeXDrawResources.LABEL_ROTATE); rotationField.addChangeListener(this); constraint.gridx++; coordP.add(rotationField, constraint); coordP.setBorder(new CompoundBorder(new TitledBorder(null, LABEL_POSITION_DIMENSIONS, TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); coordP.setPreferredSize(new Dimension(WIDTH_PANELS, 200)); coordP.setMinimumSize(new Dimension(WIDTH_PANELS, 200)); return coordP; } @Override public void actionPerformed(ActionEvent e) { try { Object o = e.getSource(); GridShape g = (GridShape)glimpsePanel.getGlimpseFigure(); if(o instanceof JCheckBox) { String label = ((JCheckBox)o).getActionCommand(); if(label.equals(LABEL_ISXLABEL)) { setModified(true); g.setYLabelWest(!invertXLabelsCB.isSelected()); glimpsePanel.repaint(); return ; } if(label.equals(LABEL_ISYLABEL)) { setModified(true); g.setXLabelSouth(!invertYLabelsCB.isSelected()); glimpsePanel.repaint(); return ; } } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } super.actionPerformed(e); } @Override public void stateChanged(ChangeEvent e) { try { Object o = e.getSource(); GridShape g = (GridShape)glimpsePanel.getGlimpseFigure(); if(o instanceof JSpinner) { String name = ((JSpinner)o).getName(); double v = Double.valueOf(((JSpinner)o).getValue().toString()).doubleValue(); if(name.equals(LABEL_XGRIDEND)) { int xE = (int)v; int xS = Integer.valueOf(xGridStart.getValue().toString()).intValue(); setModified(true); g.getGridEnd().x = xE; xGridStart.removeChangeListener(this); xGridStart.setModel(new SpinnerNumberModel(xE,-10000,xE,1)); xGridStart.setValue(Math.min(xE, xS)); xGridStart.addChangeListener(this); g.updateBorders(null); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_YGRIDEND)) { int yE = (int)v; int yS = Integer.valueOf(yGridStart.getValue().toString()).intValue(); setModified(true); g.getGridEnd().y = yE; yGridStart.removeChangeListener(this); yGridStart.setModel(new SpinnerNumberModel(yE,-10000,yE,1)); yGridStart.setValue(Math.min(yE, yS)); yGridStart.addChangeListener(this); g.updateBorders(null); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_XGRIDSTART)) { int xE = Integer.valueOf(xGridEnd.getValue().toString()).intValue(); int xS = (int)v; setModified(true); g.getGridStart().x = xS; xGridEnd.removeChangeListener(this); xGridEnd.setModel(new SpinnerNumberModel(xS,xS,10000,1)); xGridEnd.setValue(Math.max(xE, xS)); xGridEnd.addChangeListener(this); g.updateBorders(null); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_YGRIDSTART)) { int yE = Integer.valueOf(yGridEnd.getValue().toString()).intValue(); int yS = (int)v; setModified(true); g.getGridStart().y = yS; yGridEnd.removeChangeListener(this); yGridEnd.setModel(new SpinnerNumberModel(yS,yS,10000,1)); yGridEnd.setValue(Math.max(yE, yS)); yGridEnd.addChangeListener(this); g.updateBorders(null); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_XORIGIN)) { setModified(true); g.getOrigin().x = (int)v; g.updateBorders(null); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_YORIGIN)) { setModified(true); g.getOrigin().y = (int)v; g.updateBorders(null); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_X)) { setModified(true); g.getPosition().x = (float)v; g.updateBorders(null); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_Y)) { setModified(true); g.getPosition().y = (float)v; g.updateBorders(null); glimpsePanel.repaint(); return ; } } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } super.stateChanged(e); } @Override public void saveParameters() { GridShape g = (GridShape)figure; LaTeXDrawPoint2D gridMax = g.getGridEnd(), gridMin = g.getGridStart(); gridMax.x = Integer.valueOf(xGridEnd.getValue().toString()).intValue(); gridMax.y = Integer.valueOf(yGridEnd.getValue().toString()).intValue(); gridMin.x = Integer.valueOf(xGridStart.getValue().toString()).intValue(); gridMin.y = Integer.valueOf(yGridStart.getValue().toString()).intValue(); LaTeXDrawPoint2D position = g.getPosition(); position.x = Double.valueOf(xPosition.getValue().toString()).doubleValue(); position.y = Double.valueOf(yPosition.getValue().toString()).doubleValue(); if(xOrigin!=null) { LaTeXDrawPoint2D origin = g.getOrigin(); float tmp = Float.valueOf(xOrigin.getValue().toString()).floatValue(); origin.x = tmp; tmp = Float.valueOf(yOrigin.getValue().toString()).floatValue(); origin.y = tmp; } g.updateBorders(); g.setXLabelSouth(!invertYLabelsCB.isSelected()); g.setYLabelWest(!invertXLabelsCB.isSelected()); super.saveParameters(); g.updateBorders(null); } @Override public void setFigureFrameField() { GridShape g = (GridShape)figure; xGridStart.removeChangeListener(this); yGridStart.removeChangeListener(this); xGridEnd.removeChangeListener(this); yGridEnd.removeChangeListener(this); xGridStart.setValue((int)g.getGridStart().x); xGridStart.setModel(new SpinnerNumberModel((int)g.getGridStart().x,-10000,(int)g.getGridEnd().x,1)); yGridStart.setValue((int)g.getGridStart().y); yGridStart.setModel(new SpinnerNumberModel((int)g.getGridStart().y,-10000,(int)g.getGridEnd().y,1)); xGridEnd.setValue((int)g.getGridEnd().x); xGridEnd.setModel(new SpinnerNumberModel((int)g.getGridEnd().x,(int)g.getGridStart().x,10000,1)); yGridEnd.setValue((int)g.getGridEnd().y); yGridEnd.setModel(new SpinnerNumberModel((int)g.getGridEnd().y,(int)g.getGridStart().y,10000,1)); xGridStart.addChangeListener(this); yGridStart.addChangeListener(this); xGridEnd.addChangeListener(this); yGridEnd.addChangeListener(this); xPosition.setValue(g.getPosition().x); yPosition.setValue(g.getPosition().y); if(xOrigin!=null) { xOrigin.setValue((int)g.getOrigin().x); yOrigin.setValue((int)g.getOrigin().y); } invertXLabelsCB.setSelected(!g.isYLabelWest()); invertYLabelsCB.setSelected(!g.isXLabelSouth()); } @Override public void setDefaultsValues() { super.setDefaultsValues(); GridShape gs = (GridShape)glimpsePanel.glimpseFigure; invertXLabelsCB.setSelected(!GridShape.DEFAULT_ISYLABELWEST); invertYLabelsCB.setSelected(!GridShape.DEFAULT_ISXLABELSOUTH); gs.setXLabelSouth(GridShape.DEFAULT_ISXLABELSOUTH); gs.setYLabelWest(GridShape.DEFAULT_ISYLABELWEST); xGridStart.removeChangeListener(this); yGridStart.removeChangeListener(this); xGridEnd.removeChangeListener(this); yGridEnd.removeChangeListener(this); xGridStart.setValue((int)GridShape.DEFAULT_GRIDMIN.x); xGridStart.setModel(new SpinnerNumberModel((int)GridShape.DEFAULT_GRIDMIN.x,-10000,(int)GridShape.DEFAULT_GRIDMAX.x,1)); yGridStart.setValue((int)GridShape.DEFAULT_GRIDMIN.y); yGridStart.setModel(new SpinnerNumberModel((int)GridShape.DEFAULT_GRIDMIN.y,-10000,(int)GridShape.DEFAULT_GRIDMAX.y,1)); xGridEnd.setValue((int)GridShape.DEFAULT_GRIDMAX.x); xGridEnd.setModel(new SpinnerNumberModel((int)GridShape.DEFAULT_GRIDMAX.x,(int)GridShape.DEFAULT_GRIDMIN.x,10000,1)); yGridEnd.setValue((int)GridShape.DEFAULT_GRIDMAX.y); yGridEnd.setModel(new SpinnerNumberModel((int)GridShape.DEFAULT_GRIDMAX.y,(int)GridShape.DEFAULT_GRIDMIN.y,10000,1)); gs.setGridStartX((int)GridShape.DEFAULT_GRIDMIN.x); gs.setGridStartY((int)GridShape.DEFAULT_GRIDMIN.y); gs.setGridEndX((int)GridShape.DEFAULT_GRIDMAX.x); gs.setGridEndY((int)GridShape.DEFAULT_GRIDMAX.y); xGridStart.addChangeListener(this); yGridStart.addChangeListener(this); xGridEnd.addChangeListener(this); yGridEnd.addChangeListener(this); if(xOrigin!=null) { xOrigin.setValue((int)GridShape.DEFAULT_ORIGIN.x); yOrigin.setValue((int)GridShape.DEFAULT_ORIGIN.y); } gs.setOriginX((int)GridShape.DEFAULT_ORIGIN.x); gs.setOriginY((int)GridShape.DEFAULT_ORIGIN.y); } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/AbstractParametersFrame.java0000644000000000000000000022315611347255510022725 0ustar package latexDraw.ui.dialog; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import latexDraw.figures.*; import latexDraw.figures.properties.Arrowable; import latexDraw.lang.LaTeXDrawLang; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.DrawPanel; import latexDraw.ui.components.ButtonIcon; import latexDraw.ui.components.ColorButton; import latexDraw.ui.components.LaTeXDrawComboBox; import latexDraw.util.LaTeXDrawPoint2D; import latexDraw.util.LaTeXDrawResources; import latexDraw.util.UndoRedoManager; /** * This class defines the pattern for the frames which allow to change the parameters of the figures.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public abstract class AbstractParametersFrame extends JDialog implements ActionListener, ItemListener, KeyListener, ChangeListener { private static final long serialVersionUID = 1L; protected boolean deleteOnCancel; /** The panel containing the drawing */ protected DrawPanel drawPanel; /** The figure to modify */ protected Figure figure; /** The title of the frame */ protected String title; /** The width of many panels. */ public static final int WIDTH_PANELS = 430; /** The label of the panel : Position/dimensions. */ public static final String LABEL_POSITION_DIMENSIONS = LaTeXDrawLang.getString1_7("AbstractParametersFrame.0"); //$NON-NLS-1$ /** The name of the button ok */ public static final String NAME_BUTTON_OK = "BUTTON_OK";//$NON-NLS-1$ /** The name of the button cancel */ public static final String NAME_BUTTON_CANCEL = "BUTTON_CANCEL";//$NON-NLS-1$ /** The name of the button default */ public static final String NAME_BUTTON_DEFAULT = "BUTTON_DEFAULT";//$NON-NLS-1$ /** Allows to know if the frame has been launched by the main frame: * if true, the undo/redo manager will be used. */ protected boolean attachToMainFrame; protected JSpinner dotSizeNum; protected JSpinner dotSizeDim; protected JSpinner bracketNum; protected JSpinner rbracketNum; protected JSpinner tbarsizeNum; protected JSpinner tbarsizeDim; protected JSpinner arrowSizeDim; protected JSpinner arrowSizeNum; protected JSpinner arrowLength; protected JSpinner arrowInset; public static final String LABEL_DOTSIZENUM = "DotSizeNum";//$NON-NLS-1$ public static final String LABEL_DOTSIZEDIM = "DotSizeDim";//$NON-NLS-1$ public static final String LABEL_BRACKETNUM = "BracketNum";//$NON-NLS-1$ public static final String LABEL_RBRACKETNUM = "rBracketNum";//$NON-NLS-1$ public static final String LABEL_TBARSIZENUM = "tBarSizeNum"; //$NON-NLS-1$ public static final String LABEL_TBARSIZEDIM = "tBarSizeDim"; //$NON-NLS-1$ public static final String LABEL_ARROWLENGTH = "arrowLength";//$NON-NLS-1$ public static final String LABEL_ARROWINSET = "arrowInset"; //$NON-NLS-1$ public static final String LABEL_ARROWSIZENUM = "arrowSizeNum";//$NON-NLS-1$ public static final String LABEL_ARROWSIZEDIM = "arrowSizeDim"; //$NON-NLS-1$ /** Allows to change the mid point of the gradient. */ protected JSpinner gradientMidPtField; /** Allows to change the angle of the gradient. */ protected JSpinner gradientAngleField; /** Allows to change the colour of the shadow. */ protected ColorButton gradientStartColButton; /** Allows to change the colour of the shadow. */ protected ColorButton gradientEndColButton; /** Allows to change the size of the shadow. */ protected JSpinner shadowSizeField; /** Allows to change the colour of the shadow. */ protected ColorButton shadowColorButton; /** Allows to change the angle of the shadow. */ protected JSpinner shadowAngleField; /** Allows to set if the figure has a shadow or not. */ protected JCheckBox shadowCheckBox; /** Allows to change the thickness of the figure */ protected JSpinner thicknessField; /** Allows to change the colour of the borders of the figure */ protected ColorButton bordersButton; /** Allows to change the colour of the hatch */ protected ColorButton hatchButton; /** Allows to set if the figure is filled */ protected JCheckBox filledCheckBox; /** Allows to change the colour of the interior of the figure */ protected ColorButton interiorButton; /** Allows to change the colour of the double boundary of the figure */ protected ColorButton doublecolorButton; /** Allows to change the kind of the line */ protected LaTeXDrawComboBox lineChoice; /** Allows to change the kind of hatch */ protected LaTeXDrawComboBox hatchChoice; /** Allows to change the position of the borders */ protected LaTeXDrawComboBox bordersPositionChoice; /** Allows to change the angle of rotation of the figure */ protected JSpinner hatchSepField; protected JSpinner hatchAngleField; /** Allows to change the angle of rotation of the figure */ protected JSpinner rotationField; /** Allows to change the width of the hatch */ protected JSpinner hatchWidthField; /** Allows to set the separation between the double line */ protected JSpinner doubleSep; /** Allows to set if the figure must have double boundary or not */ protected JCheckBox doubleLine; /** The button ok */ protected JButton buttonOk; /** The panel where the figure is displayed */ protected GlimpsePanel glimpsePanel; /** This scrollpane contains the glimpsepanel */ protected JPanel glimpsePanelZoom; /** The scroll pane of the frame to see the figure. */ protected JScrollPane glimpseScrollPane; /** The first arrow choice */ protected LaTeXDrawComboBox arrow1Choice; /** The second arrow choice */ protected LaTeXDrawComboBox arrow2Choice; /** Defines if the shape has been modified with the frame. @since 2.0.0 */ protected boolean isModified; /** The label of the check box which set if the figure has a shadow or not. */ public static final String LABEL_SHADOW_CB = LaTeXDrawResources.LABEL_SHADOW_CHECKBOX; /** The label of the button which set the angle of the shadow. */ public static final String LABEL_SHADOW_ANGLE = LaTeXDrawLang.getString1_7("AbstractParametersFrame.1"); //$NON-NLS-1$ /** The label of the button which set the size of the shadow. */ public static final String LABEL_SHADOW_SIZE = LaTeXDrawLang.getString1_7("AbstractParametersFrame.2"); //$NON-NLS-1$ /** The label of the button which set the angle of the gradient. */ public static final String LABEL_GRADIENT_ANGLE = LaTeXDrawLang.getString1_7("AbstractParametersFrame.3"); //$NON-NLS-1$ public static final String LABEL_HATCHINGS_ANGLE = "hatchAngle"; /** The label of the button which set the middle point of the gradient. */ public static final String LABEL_GRADIENT_MID_PT = LaTeXDrawLang.getString1_7("AbstractParametersFrame.4"); //$NON-NLS-1$ public static final String TITLE_TABBED_PANE_GENERAL = LaTeXDrawLang.getDialogFrameString("PreferencesFrame.general"); //$NON-NLS-1$ public static final String TITLE_TABBED_PANE_OTHERS = LaTeXDrawLang.getString1_7("AbstractParametersFrame.6"); //$NON-NLS-1$ public static final String LABEL_BUTTON_BOUNDARY = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.0"); //$NON-NLS-1$ public static final String LABEL_DOUBLELINE = LaTeXDrawLang.getString1_7("AbstractParametersFrame.9"); //$NON-NLS-1$ public static final String LABEL_DOUBLESEP = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.2"); //$NON-NLS-1$ public static final String LABEL_HATCH_SEP = LaTeXDrawLang.getString1_8("AbstractParametersFrame.0"); //$NON-NLS-1$ public static final String TITLE_GENERAL = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.3"); //$NON-NLS-1$ public static final String LABEL_ARROWS = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.38"); //$NON-NLS-1$ public static final String LABEL_OK = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.4"); //$NON-NLS-1$ public static final String LABEL_DEFAULT = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.5"); //$NON-NLS-1$ public static final String LABEL_CANCEL = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.6"); //$NON-NLS-1$ public static final String LABEL_ROTATION = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.7"); //$NON-NLS-1$ public static final String LABEL_THICKNESS = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.8"); //$NON-NLS-1$ public static final String LABEL_GENERAL = LaTeXDrawLang.getDialogFrameString("PreferencesFrame.general"); //$NON-NLS-1$ public static final String LABEL_TYPE_LINE = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.10"); //$NON-NLS-1$ public static final String LABEL_HATCH_WIDTH = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.11"); //$NON-NLS-1$ public static final String LABEL_LEFT_ARROW = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.12"); //$NON-NLS-1$ public static final String LABEL_RIGHT_ARROW = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.13"); //$NON-NLS-1$ public static final String NAME_TABBEDPANE_ARROW = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.14"); //$NON-NLS-1$ /** The label of the showPointsCB JCheckBox */ public static final String LABEL_SHOWPOINTCB = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.15"); //$NON-NLS-1$ /** The label of the isRound checkbox */ public static final String LABEL_ISROUND = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.16"); //$NON-NLS-1$ /** The label of the field frameArcField */ public static final String LABEL_ROUND_CORNER = LaTeXDrawLang.getString1_7("AbstractParametersFrame.7"); //$NON-NLS-1$ /** The label of the X-centre field */ public static final String LABEL_CENTER_X = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.17"); //$NON-NLS-1$ /** The label of the Y-centre field */ public static final String LABEL_CENTER_Y = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.18"); //$NON-NLS-1$ /** The label of the radius field */ public static final String LABEL_RADIUS = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.19"); //$NON-NLS-1$ public static final String LABEL_DOTSIZE = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.20"); //$NON-NLS-1$ public static final String LABEL_TBARSIZE = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.21"); //$NON-NLS-1$ public static final String LABEL_BRACKET_LGTH = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.22"); //$NON-NLS-1$ public static final String LABEL_RBRACKET_LGTH = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.23"); //$NON-NLS-1$ public static final String LABEL_CROSS_THICKNESS = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.24"); //$NON-NLS-1$ public static final String LABEL_CROSS_WIDTH = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.25"); //$NON-NLS-1$ public static final String LABEL_ARROW_LENGTH = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.26"); //$NON-NLS-1$ public static final String LABEL_ARROW_INSET = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.27"); //$NON-NLS-1$ public static final String LABEL_ARROW_WIDTH = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.28"); //$NON-NLS-1$ public static final String LABEL_X = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.29"); //$NON-NLS-1$ public static final String LABEL_Y = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.30"); //$NON-NLS-1$ /** The label of the width field */ public static final String LABEL_WIDTH = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.31"); //$NON-NLS-1$ /** The label of the height field */ public static final String LABEL_HEIGHT = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.32"); //$NON-NLS-1$ /** * 01/20/06
* @version 1.9
*/ protected static class GlimpsePanel extends JPanel implements Scrollable, MouseListener, MouseMotionListener { private static final long serialVersionUID = 1L; /** The figure to display in the panel */ protected Figure glimpseFigure; /** The zoom by default (100%) */ public static final double DEFAULT_ZOOM = 1.; /** The biggest zoom we can do */ public static final double MAX_ZOOM = 4.5; /** The smallest zoom we can do */ public static final double MIN_ZOOM = 0.25; /** The value we add to the zoom when to user click on a zoom button */ public static final double DEFAULT_ADD_ZOOM = 0.25; /** The zoom : MIN_ZOOM<=zoom<=MAX_ZOOM */ protected double zoom; private transient Cursor formerCursor; private transient Point formerPoint; private transient double tx; private transient double ty; /** * The constructor by default * @param f The figure to display (can be null) */ public GlimpsePanel(Figure f) { if(f!=null) f.setSelected(false); glimpseFigure = f; zoom = DEFAULT_ZOOM; formerCursor = null; formerPoint = null; tx = ty = 0.; addMouseListener(this); addMouseMotionListener(this); } /** * Allows to zoom out the drawing (up to 25%). */ public void zoomOut() { if(zoom-DEFAULT_ADD_ZOOM>=MIN_ZOOM && glimpseFigure!=null) { zoom-=DEFAULT_ADD_ZOOM; updateTxTy(); repaint(); updatePreferredSize(); revalidate(); } } /** * Allows to set the zoom to default. In fact the zoom is not set at ZOOM_DEFAULT, it's set to see the whole figure. */ public void zoomDefault() { if(glimpseFigure!=null) { LaTeXDrawPoint2D nw = glimpseFigure.getTheNWBoundPoint(); LaTeXDrawPoint2D se = glimpseFigure.getTheSEBoundPoint(); double figWidth = se.x-nw.x; double figHeight = se.y-nw.y; int height = getParent().getParent().getHeight(); int width = getParent().getParent().getWidth(); zoom = DEFAULT_ZOOM; while(((figHeight*zoom)>height || (figWidth*zoom)>width) && zoom>MIN_ZOOM) { zoom-=DEFAULT_ADD_ZOOM; } if(zoom getPreferredSize().height); return false; } /** * Useful for scrollbar */ public boolean getScrollableTracksViewportWidth() { if(getParent() instanceof JViewport) return (((JViewport)getParent()).getWidth() > getPreferredSize().width); return false; } /** * Useful for scrollbar */ public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { return 4; } public void mouseClicked(MouseEvent e) { // Nothing to do. } public void mouseEntered(MouseEvent e) { formerCursor = getCursor(); setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); } public void mouseExited(MouseEvent e) { if(formerCursor!=null) { setCursor(formerCursor); formerCursor = null; } } public void mousePressed(MouseEvent e) { // Nothing to do. } public void mouseReleased(MouseEvent e) { formerPoint = null; } public void mouseDragged(MouseEvent e) { if(formerPoint!=null) { tx += e.getPoint().x-formerPoint.x; ty += e.getPoint().y-formerPoint.y; repaint(); } formerPoint = e.getPoint(); } public void mouseMoved(MouseEvent e) { // Nothing to do. } } /** * The abstract constructor * @param d The drawpanel */ protected AbstractParametersFrame(Frame parent, DrawPanel d, boolean attachToMainFrame) { super(parent, true); try { setModified(false); this.attachToMainFrame = attachToMainFrame; drawPanel = d; glimpsePanel = new GlimpsePanel(null); glimpseScrollPane = new JScrollPane(glimpsePanel); glimpsePanel.updatePreferredSize(); glimpsePanel.revalidate(); glimpsePanelZoom = new JPanel(new BorderLayout()); glimpsePanelZoom.add(glimpseScrollPane, BorderLayout.CENTER); glimpsePanelZoom.add(createZoomPanel(), BorderLayout.EAST); glimpsePanelZoom.setBorder(new CompoundBorder(new TitledBorder(null, "", //$NON-NLS-1$ TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); glimpsePanelZoom.setPreferredSize(new Dimension(420, 190)); glimpsePanelZoom.setMaximumSize(new Dimension(700, 240)); createRotationField(); setResizable(true); addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { if(deleteOnCancel) { drawPanel.getDraw().deleteFigure(figure, null); deleteOnCancel = false; } } }); }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } /** * Allows to create a panel containing buttons to zoom the 'glimpse figure'. * @return The created panel. */ public JPanel createZoomPanel() { JPanel panel = new JPanel(); JPanel panel2 = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); panel2.setLayout(new BoxLayout(panel2, BoxLayout.Y_AXIS)); JButton zoomIn = new JButton(LaTeXDrawResources.zoomInIcon); zoomIn.setActionCommand(LaTeXDrawResources.LABEL_ZOOM_IN); zoomIn.addActionListener(this); JButton zoomOut = new JButton(LaTeXDrawResources.zoomOutIcon); zoomOut.setActionCommand(LaTeXDrawResources.LABEL_ZOOM_OUT); zoomOut.addActionListener(this); JButton zoomDefault = new JButton(LaTeXDrawResources.zoomDefaultIcon); zoomDefault.setActionCommand(LaTeXDrawResources.LABEL_ZOOM_DEFAULT); zoomDefault.addActionListener(this); panel2.add(zoomDefault); panel2.add(zoomIn); panel2.add(zoomOut); panel.add(panel2); return panel; } /** * Allows to set the title of the frame */ public void setTitle() { setTitle(LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.33")+ " #" +figure.getNumber()); //$NON-NLS-1$ //$NON-NLS-2$ } /** * Allows to save the values of the fields in the attributes of the figure. */ public void saveParameters() { try { if(attachToMainFrame && !deleteOnCancel) { drawPanel.getFrameParent().getUndoManager().add(UndoRedoManager.LABEL_CHANGE_PARAM, drawPanel.getDraw().getFigures().indexOf(figure), figure.clone()); drawPanel.getFrameParent().updateUndoRedo(); } if(figure.canHaveArrow()) { ArrowHead leftA = ((Arrowable)figure).getArrowHead1(); ArrowHead rightA = ((Arrowable)figure).getArrowHead2(); JLabel lab = (JLabel)arrow1Choice.getSelectedItem(); ((Arrowable)figure).setArrow1Style(lab.getText()); lab = (JLabel)arrow2Choice.getSelectedItem(); ((Arrowable)figure).setArrow2Style(lab.getText()); leftA.setBracketNum(Double.valueOf(bracketNum.getValue().toString()).doubleValue()); rightA.setBracketNum(Double.valueOf(bracketNum.getValue().toString()).doubleValue()); leftA.setDotSizeDim(Double.valueOf(dotSizeDim.getValue().toString()).doubleValue()); rightA.setDotSizeDim(Double.valueOf(dotSizeDim.getValue().toString()).doubleValue()); leftA.setDotSizeNum(Double.valueOf(dotSizeNum.getValue().toString()).doubleValue()); rightA.setDotSizeNum(Double.valueOf(dotSizeNum.getValue().toString()).doubleValue()); leftA.setRBracketNum(Double.valueOf(rbracketNum.getValue().toString()).doubleValue()); rightA.setRBracketNum(Double.valueOf(rbracketNum.getValue().toString()).doubleValue()); leftA.setTBarSizeDim(Double.valueOf(tbarsizeDim.getValue().toString()).doubleValue()); rightA.setTBarSizeDim(Double.valueOf(tbarsizeDim.getValue().toString()).doubleValue()); leftA.setTBarSizeNum(Double.valueOf(tbarsizeNum.getValue().toString()).doubleValue()); rightA.setTBarSizeNum(Double.valueOf(tbarsizeNum.getValue().toString()).doubleValue()); leftA.setArrowSizeNum(Double.valueOf(arrowSizeNum.getValue().toString()).doubleValue()); rightA.setArrowSizeNum(Double.valueOf(arrowSizeNum.getValue().toString()).doubleValue()); leftA.setArrowSizeDim(Double.valueOf(arrowSizeDim.getValue().toString()).doubleValue()); rightA.setArrowSizeDim(Double.valueOf(arrowSizeDim.getValue().toString()).doubleValue()); leftA.setArrowLength(Double.valueOf(arrowLength.getValue().toString()).doubleValue()); rightA.setArrowLength(Double.valueOf(arrowLength.getValue().toString()).doubleValue()); leftA.setArrowInset(Double.valueOf(arrowInset.getValue().toString()).doubleValue()); rightA.setArrowInset(Double.valueOf(arrowInset.getValue().toString()).doubleValue()); } if(doublecolorButton!=null) figure.setDoubleColor(doublecolorButton.getColor()); if(bordersPositionChoice!=null) { JLabel l = (JLabel) bordersPositionChoice.getSelectedItem(); figure.setBordersPosition(l.getText()); } if(doubleLine!=null) { figure.setHasDoubleBoundary(doubleLine.isSelected()); figure.setDoubleSep(Double.valueOf(doubleSep.getValue().toString())); } if(lineChoice!=null) { JLabel l = (JLabel) lineChoice.getSelectedItem(); figure.setLineStyle(l.getText()); } if(thicknessField!=null) figure.setThickness(Float.valueOf(thicknessField.getValue().toString())); if(bordersButton!=null) figure.setLinesColor(bordersButton.getColor()); if(interiorButton!=null) figure.setInteriorColor(interiorButton.getColor()); if(figure.canHaveShadow()) { figure.setHasShadow(shadowCheckBox.isSelected()); figure.setShadowSize(Double.valueOf(shadowSizeField.getValue().toString()).doubleValue()); figure.setShadowAngle(Math.toRadians(Double.valueOf(shadowAngleField.getValue().toString()).doubleValue())); figure.setShadowColor(shadowColorButton.getColor()); } if(filledCheckBox!=null) figure.setIsFilled(filledCheckBox.isSelected()); if(figure.canBeHatched()) { figure.setHatchingAngle(Math.toRadians(Double.valueOf(hatchAngleField.getValue().toString()).doubleValue())); figure.setHatchingSep(Float.valueOf(hatchSepField.getValue().toString())); figure.setHatchingWidth(Float.valueOf(hatchWidthField.getValue().toString())); figure.setHatchingColor(hatchButton.getColor()); JLabel l = (JLabel) hatchChoice.getSelectedItem(); figure.setHatchingStyle(l.getText()); figure.setGradientAngle(Math.toRadians(Double.valueOf(gradientAngleField.getValue().toString()).doubleValue())); figure.setGradientEndColor(((ButtonIcon)gradientEndColButton.getIcon()).getColor()); figure.setGradientStartColor(((ButtonIcon)gradientStartColButton.getIcon()).getColor()); figure.setGradientMidPoint(Double.valueOf(gradientMidPtField.getValue().toString()).doubleValue()); } if(rotationField!=null) figure.setRotationAngle(Math.toRadians( Double.valueOf(rotationField.getValue().toString()).doubleValue())); drawPanel.getDraw().updateBorders(); drawPanel.updateDraw(true); }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } public void keyTyped(KeyEvent e) { /* No action to do */ } public void keyReleased(KeyEvent e) { /* No action to do */ } public void keyPressed(KeyEvent e) { /* No action to do */ } public void actionPerformed(ActionEvent e) { Object o = e.getSource(); try { if(o instanceof JButton || o instanceof JCheckBox) { String label = ((AbstractButton)o).getActionCommand(); Figure f = glimpsePanel.getGlimpseFigure(); if(label.equals(LaTeXDrawResources.LABEL_ZOOM_IN)) { glimpsePanel.zoomIn(); return; } if(label.equals(LaTeXDrawResources.LABEL_ZOOM_OUT)) { glimpsePanel.zoomOut(); return; } if(label.equals(LaTeXDrawResources.LABEL_ZOOM_DEFAULT)) { glimpsePanel.zoomDefault(); return; } if(label.equals(LABEL_DOUBLELINE)) { setModified(true); f.setHasDoubleBoundary(doubleLine.isSelected()); doubleSep.setEnabled(doubleLine.isSelected()); doublecolorButton.setEnabled(doubleLine.isSelected()); glimpsePanel.repaint(); return ; } if(label.equals(NAME_BUTTON_CANCEL)) { if(deleteOnCancel) { drawPanel.getDraw().deleteFigure(figure, null); deleteOnCancel = false; } super.setVisible(false); return; } if(label.equals(NAME_BUTTON_DEFAULT)) { setDefaultsValues(); glimpsePanel.repaint(); return; } if(label.equals(NAME_BUTTON_OK)) { saveParameters(); drawPanel.getFrameParent().updateFrameFields(); if(isModified()) drawPanel.setIsModified(true); setVisible(false); return; } if(label.equals(LaTeXDrawResources.LABEL_FILLED_CHECKBOX)) { if(interiorButton!=null) { setModified(true); f.setIsFilled(filledCheckBox.isSelected()); glimpsePanel.repaint(); } return; } if(label.equals(LaTeXDrawResources.LABEL_SHADOW_CHECKBOX)) { if(shadowColorButton!=null) { setModified(true); shadowColorButton.setEnabled(shadowCheckBox.isSelected()); shadowAngleField.setEnabled(shadowCheckBox.isSelected()); shadowSizeField.setEnabled(shadowCheckBox.isSelected()); f.setHasShadow(shadowCheckBox.isSelected()); updateFilledCB(); glimpsePanel.repaint(); } return; } if(label.equals(LaTeXDrawResources.LABEL_COLOR_GRADIENT_FIRST)) { Color c = JColorChooser.showDialog((Component) e.getSource(), LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.34"), //$NON-NLS-1$ ((ColorButton)o).getColor()); if(c!=null) { setModified(true); ((ColorButton)o).setColor(c); f.setGradientStartColor(c); glimpsePanel.repaint(); } return ; } if(label.equals(LaTeXDrawResources.LABEL_COLOR_GRADIENT_SECOND)) { Color c = JColorChooser.showDialog((Component) e.getSource(), LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.34"), //$NON-NLS-1$ ((ColorButton)o).getColor()); if(c!=null) { setModified(true); ((ColorButton)o).setColor(c); f.setGradientEndColor(c); glimpsePanel.repaint(); } return ; } if(label.equals(LaTeXDrawResources.LABEL_COLOR_HATCH)) { Color c = JColorChooser.showDialog((Component) e.getSource(), LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.34"), //$NON-NLS-1$ ((ColorButton)o).getColor()); if(c!=null) { setModified(true); ((ColorButton)o).setColor(c); f.setHatchingColor(c); glimpsePanel.repaint(); } return ; } if(label.equals(LaTeXDrawResources.NAME_COLOR_SHADOW)) { Color c = JColorChooser.showDialog((Component) e.getSource(), LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.34"), //$NON-NLS-1$ ((ColorButton)o).getColor()); if(c!=null) { setModified(true); ((ColorButton)o).setColor(c); f.setShadowColor(c); glimpsePanel.repaint(); } return ; } if(label.equals(LABEL_BUTTON_BOUNDARY)) { Color c = JColorChooser.showDialog((Component) e.getSource(), LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.35"), //$NON-NLS-1$ ((ColorButton)o).getColor()); if(c!=null) { setModified(true); ((ColorButton)o).setColor(c); f.setDoubleColor(c); glimpsePanel.repaint(); } return ; } if(label.equals(LaTeXDrawResources.LABEL_COLOR_BUTTON)) { Color c = JColorChooser.showDialog((Component) e.getSource(), LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.36"), //$NON-NLS-1$ ((ColorButton)o).getColor()); if(c!=null) { setModified(true); ((ColorButton)o).setColor(c); f.setLinesColor(c); glimpsePanel.repaint(); } return ; } if(label.equals(LaTeXDrawResources.LABEL_COLOR_INTERIOR_BUTTON)) { Color c = JColorChooser.showDialog((Component) e.getSource(), LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.37"), //$NON-NLS-1$ ((ColorButton)o).getColor()); if(c!=null) { setModified(true); ((ColorButton)o).setColor(c); f.setInteriorColor(c); glimpsePanel.repaint(); } return; } } // if(o instanceof JButton) }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } /** * Allows to set the value of the specific fields of the frame * from the attributes of the figure */ public abstract void setFigureFrameField(); /** * Initialises some fields of the frame and set visible or not it. * @param visible True: the frame must be visible. * @param selected The selected figure. * @param deleteOnCancel True: the figure must be deleted if the user click on the button cancel. */ public void setVisible(boolean visible, Figure selected, boolean deleteOnCancel, boolean isFramedBox) { try { if(visible) { setModified(false); this.deleteOnCancel = deleteOnCancel; figure = selected; setTitle(); glimpsePanel.setGlimpseFigure((Figure) selected.clone()); glimpsePanel.updatePreferredSize(); glimpsePanel.revalidate(); glimpsePanel.repaint(); setFigureFrameField(); if(figure.canHaveArrow()) { arrow1Choice.setSelectedItem(((Arrowable)figure).getArrow1Style()); arrow2Choice.setSelectedItem(((Arrowable)figure).getArrow2Style()); ArrowHead rightA = ((Arrowable)figure).getArrowHead2(); arrowInset.setValue(rightA.getArrowInset()); arrowLength.setValue(rightA.getArrowLength()); arrowSizeDim.setValue(rightA.getArrowSizeDim()); arrowSizeNum.setValue(rightA.getArrowSizeNum()); bracketNum.setValue(rightA.getBracketNum()); dotSizeDim.setValue(rightA.getDotSizeDim()); dotSizeNum.setValue(rightA.getDotSizeNum()); rbracketNum.setValue(rightA.getRBracketNum()); tbarsizeDim.setValue(rightA.getTBarSizeDim()); tbarsizeNum.setValue(rightA.getTBarSizeNum()); updateEnableParamsArrow(); } if(doublecolorButton!=null) { doublecolorButton.setEnabled(figure.hasDoubleBoundary()); doublecolorButton.setColor(figure.getDoubleColor()); } if(bordersPositionChoice!=null) { bordersPositionChoice.setEnabled(figure.isBordersMovable() && !isFramedBox); bordersPositionChoice.setSelectedItem(figure.getBordersPosition()); } if(doubleLine!=null) { doubleLine.setSelected(figure.hasDoubleBoundary()); doubleSep.setEnabled(doubleLine.isSelected()); doubleSep.setValue(figure.getDoubleSep()); } if(rotationField!=null) { rotationField.setEnabled(!isFramedBox); rotationField.setValue(Math.toDegrees(selected.getRotationAngle())); } if(lineChoice!=null) lineChoice.setSelectedItem(selected.getLineStyle()); if(thicknessField!=null) thicknessField.setValue((double)selected.getThickness()); if(bordersButton!=null) bordersButton.setColor(selected.getLinesColor()); String txt = selected.getHatchingStyle(); int num=0; if(txt.equals(PSTricksConstants.TOKEN_FILL_GRADIENT)) num=1; else if(txt.equals(PSTricksConstants.TOKEN_FILL_NONE) || txt.equals(PSTricksConstants.TOKEN_FILL_SOLID)) num=2; if(selected.canBeHatched()) { hatchAngleField.setEnabled(num==0); hatchAngleField.setValue(Math.toDegrees(selected.getHatchingAngle())); hatchChoice.setSelectedItem(selected.getHatchingStyle()); hatchButton.setEnabled(num==0); hatchWidthField.setValue((double)selected.getHatchingWidth()); hatchSepField.setValue(selected.getHatchingSep()); hatchButton.setColor(selected.getHatchingColor()); hatchWidthField.setEnabled(num==0); hatchSepField.setEnabled(num==0); gradientAngleField.setEnabled(num==1); gradientAngleField.setValue(Math.toDegrees(selected.getGradientAngle())); gradientEndColButton.setEnabled(num==1); gradientMidPtField.setEnabled(num==1); gradientMidPtField.setValue(selected.getGradientMidPoint()); gradientStartColButton.setEnabled(num==1); updateFilledCB(); filledCheckBox.setSelected(selected.isFilled() && selected.canBeFilled()); gradientEndColButton.setColor(selected.getGradientEndColor()); gradientStartColButton.setColor(selected.getGradientStartColor()); } if(interiorButton!=null) interiorButton.setColor(selected.getInteriorColor()); if(selected.canHaveShadow()) { shadowSizeField.setValue(figure.getShadowSize()); shadowAngleField.setValue(Math.toDegrees(figure.getShadowAngle())); shadowColorButton.setEnabled(figure.hasShadow()); shadowColorButton.setColor(figure.getShadowColor()); shadowCheckBox.setSelected(figure.hasShadow()); shadowColorButton.setEnabled(shadowCheckBox.isSelected()); shadowAngleField.setEnabled(shadowCheckBox.isSelected()); shadowSizeField.setEnabled(shadowCheckBox.isSelected()); } } updateFilledCB(); }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } super.setVisible(visible); } /** * @return A panel with components to change the parameters of the hatching of the figure. */ public JPanel createHatchingPanel() { GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.WEST; JPanel hatchingP = new JPanel(new GridBagLayout()); hatchButton = new ColorButton(LaTeXDrawResources.LABEL_COLOR_HATCH, new ButtonIcon(Figure.DEFAULT_BORDERS_COL)); hatchButton.setActionCommand(LaTeXDrawResources.LABEL_COLOR_HATCH); hatchButton.addActionListener(this); hatchingP.add(hatchButton, constraint); constraint.gridx++; hatchingP.add(new JLabel(LABEL_HATCH_WIDTH), constraint); constraint.gridx++; SpinnerModel model = new SpinnerNumberModel(Figure.DEFAULT_HATCH_WIDTH, 0.1, 100,0.1); hatchWidthField = new JSpinner(model); hatchWidthField.setEditor(new JSpinner.NumberEditor(hatchWidthField, "0.0"));//$NON-NLS-1$ hatchWidthField.addChangeListener(this); hatchWidthField.setName(Figure.LABEL_HATCH_WIDTH); hatchingP.add(hatchWidthField, constraint); constraint.gridx++; hatchingP.add(new JLabel(LABEL_HATCH_SEP), constraint); constraint.gridx++; model = new SpinnerNumberModel(Figure.DEFAULT_HATCH_SEP, 0.01, 1000,1); hatchSepField = new JSpinner(model); hatchSepField.setEditor(new JSpinner.NumberEditor(hatchSepField, "0.00"));//$NON-NLS-1$ hatchSepField.addChangeListener(this); hatchSepField.setName(LABEL_HATCH_SEP); hatchingP.add(hatchSepField, constraint); constraint.gridy++; constraint.gridx=1; hatchingP.add(new JLabel("angle"), constraint); constraint.gridx++; model = new SpinnerNumberModel(0., -1000., 1000., 1.); hatchAngleField = new JSpinner(model); hatchAngleField.setEditor(new JSpinner.NumberEditor(hatchAngleField, "0.00"));//$NON-NLS-1$ hatchAngleField.addChangeListener(this); hatchAngleField.setName(LABEL_HATCHINGS_ANGLE); hatchingP.add(hatchAngleField, constraint); hatchingP.setBorder(new CompoundBorder(new TitledBorder(null, LaTeXDrawLang.getString1_7("AbstractParametersFrame.8"), //$NON-NLS-1$ TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); return hatchingP; } /** * @return A panel with components to change the parameters of the double borders of the figure. */ public JPanel createDoubleLinePanel() { JPanel fillingP = new JPanel(new FlowLayout(FlowLayout.LEFT)); doubleLine = new JCheckBox(LABEL_DOUBLELINE); doubleLine.setActionCommand(LABEL_DOUBLELINE); doubleLine.addActionListener(this); fillingP.add(doubleLine); fillingP.add(new JLabel(LABEL_DOUBLESEP)); SpinnerModel model = new SpinnerNumberModel(Figure.DEFAULT_DOUBLESEP, 1, 1000,1); doubleSep = new JSpinner(model); doubleSep.setEditor(new JSpinner.NumberEditor(doubleSep, "0")); //$NON-NLS-1$ doubleSep.setName(LABEL_DOUBLESEP); doubleSep.addChangeListener(this); doubleSep.setEnabled(doubleLine.isSelected()); fillingP.add(doubleSep); doublecolorButton = new ColorButton(LABEL_BUTTON_BOUNDARY, new ButtonIcon(Figure.DEFAULT_DOUBLE_COLOR)); doublecolorButton.setActionCommand(LABEL_BUTTON_BOUNDARY); doublecolorButton.addActionListener(this); fillingP.add(doublecolorButton); fillingP.setBorder(new CompoundBorder(new TitledBorder(null, LaTeXDrawLang.getString1_7("AbstractParametersFrame.9"), //$NON-NLS-1$ TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); return fillingP; } /** * @return A panel with components to change the parameters of the borders of the figure. */ public JPanel createBordersPanel(boolean movable) { JPanel borderP = new JPanel(new FlowLayout(FlowLayout.LEFT)); borderP.add(new JLabel(LABEL_THICKNESS)); SpinnerModel model = new SpinnerNumberModel(Figure.DEFAULT_THICKNESS, 0.1, 100,0.1); thicknessField = new JSpinner(model); thicknessField.setName(LaTeXDrawResources.NAME_THICKNESS_FIELD); thicknessField.setEditor(new JSpinner.NumberEditor(thicknessField, "0.0"));//$NON-NLS-1$ thicknessField.addChangeListener(this); borderP.add(thicknessField); bordersButton = new ColorButton(LaTeXDrawResources.LABEL_COLOR_BUTTON, new ButtonIcon(Figure.DEFAULT_BORDERS_COL)); bordersButton.setActionCommand(LaTeXDrawResources.LABEL_COLOR_BUTTON); bordersButton.addActionListener(this); borderP.add(bordersButton); borderP.add(new JLabel(LABEL_TYPE_LINE)); lineChoice = createLineChoice(this); borderP.add(lineChoice); if(movable) { bordersPositionChoice = Figure.createBordersPositionChoice(); bordersPositionChoice.addItemListener(this); borderP.add(bordersPositionChoice); } borderP.setBorder(new CompoundBorder(new TitledBorder(null, LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.47"), //$NON-NLS-1$ TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); return borderP; } /** * @return A panel with components to change the parameters of the filling of the figure. */ public JPanel createFillPanel() { JPanel fillingP = new JPanel(new FlowLayout(FlowLayout.LEFT)); filledCheckBox = new JCheckBox(LaTeXDrawResources.LABEL_FILLED_CHECKBOX); filledCheckBox.setActionCommand(LaTeXDrawResources.LABEL_FILLED_CHECKBOX); filledCheckBox.addActionListener(this); fillingP.add(filledCheckBox); interiorButton = new ColorButton(LaTeXDrawResources.LABEL_COLOR_INTERIOR_BUTTON, new ButtonIcon(Figure.DEFAULT_INTERIOR_COL)); interiorButton.setActionCommand(LaTeXDrawResources.LABEL_COLOR_INTERIOR_BUTTON); interiorButton.addActionListener(this); fillingP.add(interiorButton); hatchChoice = Figure.createFillChoice(); hatchChoice.setPreferredSize(new Dimension(60,25)); hatchChoice.addItemListener(this); fillingP.add(hatchChoice); fillingP.setBorder(new CompoundBorder(new TitledBorder(null, LaTeXDrawLang.getString1_7("AbstractParametersFrame.11"), //$NON-NLS-1$ TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); return fillingP; } /** * @return A panel with components to change the parameters of the shadow of the figure. */ public JPanel createGradientPanel() { GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.WEST; JPanel gradientP = new JPanel(new GridBagLayout()); gradientStartColButton = new ColorButton(LaTeXDrawResources.LABEL_COLOR_GRADIENT_FIRST, new ButtonIcon(PSTricksConstants.DEFAULT_GRADIENT_START_COLOR)); gradientStartColButton.setActionCommand(LaTeXDrawResources.LABEL_COLOR_GRADIENT_FIRST); gradientStartColButton.addActionListener(this); gradientP.add(gradientStartColButton, constraint); gradientEndColButton = new ColorButton(LaTeXDrawResources.LABEL_COLOR_GRADIENT_SECOND, new ButtonIcon(PSTricksConstants.DEFAULT_GRADIENT_END_COLOR)); gradientEndColButton.setActionCommand(LaTeXDrawResources.LABEL_COLOR_GRADIENT_SECOND); gradientEndColButton.addActionListener(this); constraint.gridx++; gradientP.add(gradientEndColButton, constraint); constraint.gridy++; constraint.gridx=0; gradientP.add(new JLabel(LABEL_GRADIENT_MID_PT), constraint); constraint.gridx++; SpinnerModel model = new SpinnerNumberModel(Figure.DEFAULT_GRADIENT_MID_POINT,0,1,0.01); gradientMidPtField = new JSpinner(model); gradientMidPtField.setEditor(new JSpinner.NumberEditor(gradientMidPtField, "0.000"));//$NON-NLS-1$ gradientMidPtField.addChangeListener(this); gradientMidPtField.setName(LABEL_GRADIENT_MID_PT); gradientP.add(gradientMidPtField, constraint); constraint.gridx++; gradientP.add(new JLabel(LABEL_GRADIENT_ANGLE), constraint); constraint.gridx++; model = new SpinnerNumberModel(Math.toDegrees(Figure.DEFAULT_GRADIENT_ANGLE), -360, 360,0.5); gradientAngleField = new JSpinner(model); gradientAngleField.setEditor(new JSpinner.NumberEditor(gradientAngleField, "0.0"));//$NON-NLS-1$ gradientAngleField.addChangeListener(this); gradientAngleField.setName(LABEL_GRADIENT_ANGLE); constraint.gridx++; gradientP.add(gradientAngleField, constraint); gradientP.setBorder(new CompoundBorder(new TitledBorder(null, LaTeXDrawLang.getString1_7("AbstractParametersFrame.12"), //$NON-NLS-1$ TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); return gradientP; } /** * @return A panel with components to change the parameters of the shadow of the figure. */ public JPanel createShadowPanel() { GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.CENTER; JPanel shadowP = new JPanel(new GridBagLayout()); constraint.gridy=0; constraint.gridx=0; shadowCheckBox = new JCheckBox(LaTeXDrawResources.LABEL_SHADOW_CHECKBOX); shadowCheckBox.setActionCommand(LaTeXDrawResources.LABEL_SHADOW_CHECKBOX); shadowCheckBox.addActionListener(this); constraint.gridx=0; constraint.gridy=0; shadowP.add(shadowCheckBox, constraint); shadowColorButton = new ColorButton(LaTeXDrawResources.LABEL_COLOR_SHADOW, new ButtonIcon(Figure.DEFAULT_SHADOW_COLOR)); shadowColorButton.setActionCommand(LaTeXDrawResources.NAME_COLOR_SHADOW); shadowColorButton.addActionListener(this); constraint.gridx++; shadowP.add(shadowColorButton, constraint); constraint.gridy++; constraint.gridx=0; shadowP.add(new JLabel(LABEL_SHADOW_SIZE), constraint); constraint.gridx++; SpinnerModel model = new SpinnerNumberModel(Figure.DEFAULT_SHADOW_SIZE,0.01,1000,1); shadowSizeField = new JSpinner(model); shadowSizeField.setEditor(new JSpinner.NumberEditor(shadowSizeField, "0.00"));//$NON-NLS-1$ shadowSizeField.addChangeListener(this); shadowSizeField.setName(LABEL_SHADOW_SIZE); shadowP.add(shadowSizeField, constraint); constraint.gridx++; shadowP.add(new JLabel(LABEL_SHADOW_ANGLE), constraint); constraint.gridx++; model = new SpinnerNumberModel(Math.toDegrees(Figure.DEFAULT_SHADOW_ANGLE), -360, 360,0.5); shadowAngleField = new JSpinner(model); shadowAngleField.setEditor(new JSpinner.NumberEditor(shadowAngleField, "0.0"));//$NON-NLS-1$ shadowAngleField.addChangeListener(this); shadowAngleField.setName(LABEL_SHADOW_ANGLE); constraint.gridx++; shadowP.add(shadowAngleField, constraint); shadowP.setBorder(new CompoundBorder(new TitledBorder(null, LaTeXDrawLang.getString1_7("LaTeXDrawFrame.0"), //$NON-NLS-1$ TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); return shadowP; } /** * Allows to create a panel with defaults buttons (ok, cancel, default) * @param frame The frame which ask the panel * @return The created panel */ public JPanel createButtonsPanel(AbstractParametersFrame frame) { JPanel panel = new JPanel(); buttonOk = new JButton(LABEL_OK); JButton buttonCancel = new JButton(LABEL_CANCEL), buttonDefault = new JButton(LABEL_DEFAULT); buttonOk.setActionCommand(NAME_BUTTON_OK); buttonCancel.setActionCommand(NAME_BUTTON_CANCEL); buttonDefault.setActionCommand(NAME_BUTTON_DEFAULT); panel.add(buttonOk); panel.add(buttonCancel); panel.add(buttonDefault); panel.setPreferredSize(new Dimension(280, 40)); panel.setMaximumSize(new Dimension(280, 40)); buttonOk.addActionListener(frame); buttonCancel.addActionListener(frame); buttonDefault.addActionListener(frame); return panel; } /** * Allows to set by default some fields of the frame */ public void setDefaultsValues() { Figure f = glimpsePanel.getGlimpseFigure(); setModified(true); if(f.canHaveShadow()) { f.setHasShadow(PSTricksConstants.DEFAULT_SHADOW); shadowAngleField.setValue(Math.toDegrees(Figure.DEFAULT_SHADOW_ANGLE)); shadowSizeField.setValue(Figure.DEFAULT_SHADOW_SIZE); shadowColorButton.setEnabled(Figure.DEFAULT_SHADOW_HAS); shadowColorButton.setColor(Figure.DEFAULT_SHADOW_COLOR); f.setShadowColor(Figure.DEFAULT_SHADOW_COLOR); glimpsePanel.glimpseFigure.setDoubleColor(Figure.DEFAULT_SHADOW_COLOR); shadowCheckBox.setSelected(Figure.DEFAULT_SHADOW_HAS); shadowSizeField.setEnabled(shadowCheckBox.isSelected()); shadowAngleField.setEnabled(shadowCheckBox.isSelected()); } if(f.canHaveArrow()) { ((Arrowable)f).setArrow1Style(ArrowHead.DEFAULT_STYLE); ((Arrowable)f).setArrow2Style(ArrowHead.DEFAULT_STYLE); arrow1Choice.setSelectedItem(ArrowHead.DEFAULT_STYLE); arrow2Choice.setSelectedItem(ArrowHead.DEFAULT_STYLE); bracketNum.setValue(ArrowHead.DEFAULT_BRACKET_NUM); dotSizeDim.setValue(ArrowHead.DEFAULT_DOT_SIZE_DIM); dotSizeNum.setValue(ArrowHead.DEFAULT_ARROW_SIZE_NUM); rbracketNum.setValue(ArrowHead.DEFAULT_RBRACKET_NUM); tbarsizeDim.setValue(ArrowHead.DEFAULT_TBAR_SIZE_DIM); tbarsizeNum.setValue(ArrowHead.DEFAULT_TBAR_SIZE_NUM); arrowInset.setValue(ArrowHead.DEFAULT_ARROW_INSET); arrowLength.setValue(ArrowHead.DEFAULT_ARROW_LGTH); arrowSizeDim.setValue(ArrowHead.DEFAULT_ARROW_SIZE_DIM); arrowSizeNum.setValue(ArrowHead.DEFAULT_ARROW_SIZE_NUM); ArrowHead leftA = ((Arrowable)f).getArrowHead1(); ArrowHead rightA = ((Arrowable)f).getArrowHead2(); leftA.setBracketNum(ArrowHead.DEFAULT_BRACKET_NUM); rightA.setBracketNum(ArrowHead.DEFAULT_BRACKET_NUM); leftA.setDotSizeDim(ArrowHead.DEFAULT_DOT_SIZE_DIM); rightA.setDotSizeDim(ArrowHead.DEFAULT_DOT_SIZE_DIM); leftA.setDotSizeNum(ArrowHead.DEFAULT_ARROW_SIZE_NUM); rightA.setDotSizeNum(ArrowHead.DEFAULT_ARROW_SIZE_NUM); leftA.setRBracketNum(ArrowHead.DEFAULT_RBRACKET_NUM); rightA.setRBracketNum(ArrowHead.DEFAULT_RBRACKET_NUM); leftA.setTBarSizeDim(ArrowHead.DEFAULT_TBAR_SIZE_DIM); rightA.setTBarSizeDim(ArrowHead.DEFAULT_TBAR_SIZE_DIM); leftA.setTBarSizeNum(ArrowHead.DEFAULT_TBAR_SIZE_NUM); rightA.setTBarSizeNum(ArrowHead.DEFAULT_TBAR_SIZE_NUM); leftA.setArrowSizeNum(ArrowHead.DEFAULT_ARROW_SIZE_NUM); rightA.setArrowSizeNum(ArrowHead.DEFAULT_ARROW_SIZE_NUM); leftA.setArrowSizeDim(ArrowHead.DEFAULT_ARROW_SIZE_DIM); rightA.setArrowSizeDim(ArrowHead.DEFAULT_ARROW_SIZE_DIM); leftA.setArrowLength(ArrowHead.DEFAULT_ARROW_LGTH); rightA.setArrowLength(ArrowHead.DEFAULT_ARROW_LGTH); leftA.setArrowInset(ArrowHead.DEFAULT_ARROW_INSET); rightA.setArrowInset(ArrowHead.DEFAULT_ARROW_INSET); updateEnableParamsArrow(); } if(doublecolorButton!=null) { doublecolorButton.setEnabled(Figure.DEFAULT_DOUBLELINE); doublecolorButton.setColor(Figure.DEFAULT_DOUBLE_COLOR); glimpsePanel.glimpseFigure.setDoubleColor(Figure.DEFAULT_DOUBLE_COLOR); } if(bordersPositionChoice!=null) { bordersPositionChoice.setSelectedItem(Figure.DEFAULT_BORDERS_POSITION); glimpsePanel.glimpseFigure.setBordersPosition(Figure.DEFAULT_BORDERS_POSITION); } if(doubleLine!=null) { glimpsePanel.glimpseFigure.setHasDoubleBoundary(Figure.DEFAULT_DOUBLELINE); glimpsePanel.glimpseFigure.setDoubleSep(Figure.DEFAULT_DOUBLESEP); doubleLine.setSelected(Figure.DEFAULT_DOUBLELINE); doubleSep.setValue(Figure.DEFAULT_DOUBLESEP); } if(lineChoice!=null) lineChoice.setSelectedItem(Figure.DEFAULT_LINE_STYLE); if(f.canBeHatched()) { hatchButton.setColor(Figure.DEFAULT_HATCH_COL); glimpsePanel.getGlimpseFigure().setHatchingColor(Figure.DEFAULT_HATCH_COL); hatchChoice.setSelectedItem(Figure.DEFAULT_HATCH_STYLE); hatchWidthField.setValue((double)Figure.DEFAULT_HATCH_WIDTH); hatchSepField.setValue(Figure.DEFAULT_HATCH_SEP); hatchAngleField.setValue(0.); } if(bordersButton!=null) { bordersButton.setColor(Figure.DEFAULT_BORDERS_COL); glimpsePanel.getGlimpseFigure().setLinesColor(Figure.DEFAULT_BORDERS_COL); } if(interiorButton!=null) { interiorButton.setColor(Figure.DEFAULT_INTERIOR_COL); glimpsePanel.getGlimpseFigure().setInteriorColor(Figure.DEFAULT_INTERIOR_COL); } if(filledCheckBox!=null) filledCheckBox.setSelected(Figure.DEFAULT_IS_FILLED); if(f.canBeHatched()) { gradientAngleField.setValue(Math.toDegrees(Figure.DEFAULT_GRADIENT_ANGLE)); gradientMidPtField.setValue(Figure.DEFAULT_GRADIENT_MID_POINT); gradientEndColButton.setColor(PSTricksConstants.DEFAULT_GRADIENT_END_COLOR); boolean ok = Figure.DEFAULT_HATCH_STYLE.equals(PSTricksConstants.TOKEN_FILL_GRADIENT); gradientEndColButton.setEnabled(ok); gradientStartColButton.setColor(PSTricksConstants.DEFAULT_GRADIENT_START_COLOR); gradientStartColButton.setEnabled(ok); gradientMidPtField.setEnabled(ok); gradientAngleField.setEnabled(ok); } if(rotationField!=null) rotationField.setValue(Figure.DEFAULT_ROTATION_ANGLE); if(thicknessField!=null) thicknessField.setValue((double)Figure.DEFAULT_THICKNESS); glimpsePanel.repaint(); } /** * Allows to create the list of the different styles of line. * @param frame The frame which ask the Choice. * @return The created Choice. */ public LaTeXDrawComboBox createLineChoice(AbstractParametersFrame frame) { LaTeXDrawComboBox choice = Figure.createStyleLineChoice(); choice.setActionCommand(LaTeXDrawResources.CHOICE_LINE_NAME); choice.setName(LaTeXDrawResources.CHOICE_LINE_NAME); choice.addItemListener(frame); return choice; } public void itemStateChanged(ItemEvent e) { try { Object o = e.getSource(); Figure f = glimpsePanel.getGlimpseFigure(); if(o instanceof LaTeXDrawComboBox) { String ac = ((LaTeXDrawComboBox)o).getActionCommand(); if(ac.equals(LaTeXDrawResources.CHOICE_LINE_NAME)) { JLabel l = (JLabel) lineChoice.getSelectedItem(); setModified(true); f.setLineStyle(l.getText()); glimpsePanel.repaint(); return ; } if(ac.equals(Figure.LABEL_BORDERS_POSITION_CHOICE)) { JLabel l = (JLabel) bordersPositionChoice.getSelectedItem(); setModified(true); f.setBordersPosition(l.getText()); glimpsePanel.repaint(); return ; } if(ac.equals(Figure.LABEL_HATCH_CHOICE)) { String txt = ((JLabel)hatchChoice.getSelectedItem()).getText(); int num=0; if(txt.equals(PSTricksConstants.TOKEN_FILL_GRADIENT)) num=1; else if(txt.equals(PSTricksConstants.TOKEN_FILL_NONE) || txt.equals(PSTricksConstants.TOKEN_FILL_SOLID)) num=2; setModified(true); f.setHatchingStyle(txt); hatchButton.setEnabled(num==0); hatchWidthField.setEnabled(num==0); hatchAngleField.setEnabled(num==0); hatchSepField.setEnabled(num==0); gradientAngleField.setEnabled(num==1); gradientEndColButton.setEnabled(num==1); gradientMidPtField.setEnabled(num==1); gradientStartColButton.setEnabled(num==1); updateFilledCB(); glimpsePanel.repaint(); return ; } if(ac.equals(LaTeXDrawResources.CHOICE_ARROW_LEFT_NAME)) { JLabel label = (JLabel) arrow1Choice.getSelectedItem(); setModified(true); ((Arrowable)f).setArrow1Style(label.getText()); updateEnableParamsArrow(); glimpsePanel.repaint(); return ; } if(ac.equals(LaTeXDrawResources.CHOICE_ARROW_RIGHT_NAME)) { JLabel label = (JLabel) arrow2Choice.getSelectedItem(); setModified(true); ((Arrowable)f).setArrow2Style(label.getText()); updateEnableParamsArrow(); glimpsePanel.repaint(); return ; } } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } /** * Defines actions to do when a item like JSpinner has changed */ public void stateChanged(ChangeEvent e) { try { Object o = e.getSource(); if(o instanceof JSpinner) { String name = ((JSpinner)o).getName(); Figure f = glimpsePanel.getGlimpseFigure(); double v = Double.valueOf(((JSpinner)o).getValue().toString()).doubleValue(); if(name.equals(LaTeXDrawResources.NAME_THICKNESS_FIELD)) { if(f instanceof Dot) ((Dot)f).setWidth((float)v); else f.setThickness((float)v); setModified(true); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_DOUBLESEP)) { setModified(true); f.setDoubleSep(v); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_HATCH_SEP)) { setModified(true); f.setHatchingSep(v); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_HATCHINGS_ANGLE)) { setModified(true); f.setHatchingAngle(Math.toRadians(v)); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_GRADIENT_ANGLE)) { setModified(true); f.setGradientAngle(Math.toRadians(v)); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_GRADIENT_MID_PT)) { setModified(true); f.setGradientMidPoint(v); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_SHADOW_ANGLE)) { setModified(true); f.setShadowAngle(Math.toRadians(v)); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_SHADOW_SIZE)) { setModified(true); f.setShadowSize(v); glimpsePanel.repaint(); return ; } if(name.equals(Figure.LABEL_HATCH_WIDTH)) { setModified(true); f.setHatchingWidth((float)v); glimpsePanel.repaint(); return ; } if(name.equals(LaTeXDrawResources.LABEL_ROTATE)) { setModified(true); f.setRotationAngle(Math.toRadians(v)); glimpsePanel.repaint(); return; } if(name.equals(LABEL_BRACKETNUM)) { setModified(true); ((Arrowable)f).getArrowHead2().setBracketNum(v); ((Arrowable)f).getArrowHead1().setBracketNum(v); glimpsePanel.repaint(); return; } if(name.equals(LABEL_DOTSIZEDIM)) { setModified(true); ((Arrowable)f).getArrowHead1().setDotSizeDim(v); ((Arrowable)f).getArrowHead2().setDotSizeDim(v); glimpsePanel.repaint(); return; } if(name.equals(LABEL_DOTSIZENUM)) { setModified(true); ((Arrowable)f).getArrowHead1().setDotSizeNum(v); ((Arrowable)f).getArrowHead2().setDotSizeNum(v); glimpsePanel.repaint(); return; } if(name.equals(LABEL_RBRACKETNUM)) { setModified(true); ((Arrowable)f).getArrowHead1().setRBracketNum(v); ((Arrowable)f).getArrowHead2().setRBracketNum(v); glimpsePanel.repaint(); return; } if(name.equals(LABEL_TBARSIZEDIM)) { setModified(true); ((Arrowable)f).getArrowHead1().setTBarSizeDim(v); ((Arrowable)f).getArrowHead2().setTBarSizeDim(v); glimpsePanel.repaint(); return; } if(name.equals(LABEL_TBARSIZENUM)) { setModified(true); ((Arrowable)f).getArrowHead1().setTBarSizeNum(v); ((Arrowable)f).getArrowHead2().setTBarSizeNum(v); glimpsePanel.repaint(); return; } if(name.equals(LABEL_ARROWSIZENUM)) { setModified(true); ((Arrowable)f).getArrowHead1().setArrowSizeNum(v); ((Arrowable)f).getArrowHead2().setArrowSizeNum(v); glimpsePanel.repaint(); return; } if(name.equals(LABEL_ARROWSIZEDIM)) { setModified(true); ((Arrowable)f).getArrowHead1().setArrowSizeDim(v); ((Arrowable)f).getArrowHead2().setArrowSizeDim(v); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_ARROWLENGTH)) { setModified(true); ((Arrowable)f).getArrowHead1().setArrowLength(v); ((Arrowable)f).getArrowHead2().setArrowLength(v); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_ARROWINSET)) { setModified(true); ((Arrowable)f).getArrowHead1().setArrowInset(v); ((Arrowable)f).getArrowHead2().setArrowInset(v); glimpsePanel.repaint(); return ; } } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } /** * Allows to set the field rotationField. */ public void createRotationField() { SpinnerModel model = new SpinnerNumberModel(Figure.DEFAULT_ROTATION_ANGLE, -360, 360,0.1); rotationField = new JSpinner(model); rotationField.setEditor(new JSpinner.NumberEditor(rotationField, "0.0")); //$NON-NLS-1$ rotationField.setName(LaTeXDrawResources.LABEL_ROTATE); rotationField.addChangeListener(this); rotationField.setName(LaTeXDrawResources.LABEL_ROTATE); } /** * @return Create a panel with fields to modify the arrows. * @param twoLeftArrows True if the figure has two 'left' arrows like arc and not a right arrow and a left arrow like line. */ public JPanel createArrowPanel(boolean twoLeftArrows, boolean withFillButton) { JPanel arrowP = new JPanel(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.WEST; arrowP.add(new JLabel(LABEL_LEFT_ARROW), constraint); arrow1Choice = ArrowHead.createLeftArrowStyleList(); arrow1Choice.setName(LaTeXDrawResources.CHOICE_ARROW_LEFT_NAME); arrow1Choice.setActionCommand(LaTeXDrawResources.CHOICE_ARROW_LEFT_NAME); arrow1Choice.setSelectedItem(PSTricksConstants.NONEARROW_STYLE); arrow1Choice.addItemListener(this); constraint.gridx++; arrowP.add(arrow1Choice, constraint); constraint.gridx++; arrowP.add(new JLabel(LABEL_RIGHT_ARROW), constraint); if(twoLeftArrows) arrow2Choice = ArrowHead.createLeftArrowStyleList(); else arrow2Choice = ArrowHead.createRightArrowStyleList(); arrow2Choice.setName(LaTeXDrawResources.CHOICE_ARROW_RIGHT_NAME); arrow2Choice.setActionCommand(LaTeXDrawResources.CHOICE_ARROW_RIGHT_NAME); arrow2Choice.setSelectedItem(PSTricksConstants.NONEARROW_STYLE); arrow2Choice.addItemListener(this); constraint.gridx++; arrowP.add(arrow2Choice, constraint); constraint.gridx=0; constraint.gridy++; arrowP.add(new JLabel(LABEL_DOTSIZE), constraint); SpinnerNumberModel model = new SpinnerNumberModel(ArrowHead.DEFAULT_DOT_SIZE_NUM, 0.1, 100,0.1); dotSizeNum = new JSpinner(model); dotSizeNum.setName(LABEL_DOTSIZENUM); dotSizeNum.setEditor(new JSpinner.NumberEditor(dotSizeNum, "0.0000"));//$NON-NLS-1$ dotSizeNum.addChangeListener(this); constraint.gridx++; arrowP.add(dotSizeNum, constraint); constraint.gridx++; arrowP.add(new JLabel(LABEL_CROSS_THICKNESS), constraint); model = new SpinnerNumberModel(ArrowHead.DEFAULT_DOT_SIZE_DIM, 0, 1000,1); dotSizeDim = new JSpinner(model); dotSizeDim.setName(LABEL_DOTSIZEDIM); dotSizeDim.setEditor(new JSpinner.NumberEditor(dotSizeDim, "0.00"));//$NON-NLS-1$ dotSizeDim.addChangeListener(this); constraint.gridx++; arrowP.add(dotSizeDim, constraint); constraint.gridx = 0; constraint.gridy++; arrowP.add(new JLabel(LABEL_TBARSIZE), constraint); model = new SpinnerNumberModel(ArrowHead.DEFAULT_TBAR_SIZE_NUM,0.1, 100,0.1); tbarsizeNum = new JSpinner(model); tbarsizeNum.setName(LABEL_TBARSIZENUM); tbarsizeNum.setEditor(new JSpinner.NumberEditor(tbarsizeNum, "0.0000"));//$NON-NLS-1$ tbarsizeNum.addChangeListener(this); constraint.gridx++; arrowP.add(tbarsizeNum, constraint); constraint.gridx++; arrowP.add(new JLabel(LABEL_CROSS_THICKNESS), constraint); model = new SpinnerNumberModel(ArrowHead.DEFAULT_TBAR_SIZE_DIM, 0, 1000,1); tbarsizeDim = new JSpinner(model); tbarsizeDim.setName(LABEL_TBARSIZEDIM); tbarsizeDim.setEditor(new JSpinner.NumberEditor(tbarsizeDim, "0.00"));//$NON-NLS-1$ tbarsizeDim.addChangeListener(this); constraint.gridx++; arrowP.add(tbarsizeDim, constraint); constraint.gridx = 0; constraint.gridy++; arrowP.add(new JLabel(LABEL_BRACKET_LGTH), constraint); model = new SpinnerNumberModel(ArrowHead.DEFAULT_BRACKET_NUM, 0.001, 100,0.01); bracketNum = new JSpinner(model); bracketNum.setName(LABEL_BRACKETNUM); bracketNum.setEditor(new JSpinner.NumberEditor(bracketNum, "0.0000"));//$NON-NLS-1$ bracketNum.addChangeListener(this); constraint.gridx++; arrowP.add(bracketNum, constraint); constraint.gridx++; arrowP.add(new JLabel(LABEL_CROSS_WIDTH), constraint); constraint.gridx = 0; constraint.gridy++; arrowP.add(new JLabel(LABEL_RBRACKET_LGTH), constraint); model = new SpinnerNumberModel(ArrowHead.DEFAULT_RBRACKET_NUM, 0.001, 100,0.01); rbracketNum = new JSpinner(model); rbracketNum.setName(LABEL_RBRACKETNUM); rbracketNum.setEditor(new JSpinner.NumberEditor(rbracketNum, "0.0000"));//$NON-NLS-1$ rbracketNum.addChangeListener(this); constraint.gridx++; arrowP.add(rbracketNum, constraint); constraint.gridx++; arrowP.add(new JLabel(LABEL_CROSS_WIDTH), constraint); constraint.gridx=0; constraint.gridy++; arrowP.add(new JLabel(LABEL_ARROW_WIDTH), constraint); model = new SpinnerNumberModel(ArrowHead.DEFAULT_ARROW_SIZE_NUM, 0.001, 100,0.01); arrowSizeNum = new JSpinner(model); arrowSizeNum.setName(LABEL_ARROWSIZENUM); arrowSizeNum.setEditor(new JSpinner.NumberEditor(arrowSizeNum, "0.0000"));//$NON-NLS-1$ arrowSizeNum.addChangeListener(this); constraint.gridx++; arrowP.add(arrowSizeNum, constraint); constraint.gridx++; arrowP.add(new JLabel(LABEL_CROSS_THICKNESS), constraint); model = new SpinnerNumberModel(ArrowHead.DEFAULT_ARROW_SIZE_DIM, 0, 1000, 1); arrowSizeDim = new JSpinner(model); arrowSizeDim.setName(LABEL_ARROWSIZEDIM); arrowSizeDim.setEditor(new JSpinner.NumberEditor(arrowSizeDim, "0.00"));//$NON-NLS-1$ arrowSizeDim.addChangeListener(this); constraint.gridx++; arrowP.add(arrowSizeDim, constraint); constraint.gridx=0; constraint.gridy++; arrowP.add(new JLabel(LABEL_ARROW_LENGTH), constraint); model = new SpinnerNumberModel(ArrowHead.DEFAULT_ARROW_LGTH, 0, 100,0.01); arrowLength = new JSpinner(model); arrowLength.setName(LABEL_ARROWLENGTH); arrowLength.setEditor(new JSpinner.NumberEditor(arrowLength, "0.0000"));//$NON-NLS-1$ arrowLength.addChangeListener(this); constraint.gridx++; arrowP.add(arrowLength, constraint); constraint.gridx=0; constraint.gridy++; arrowP.add(new JLabel(LABEL_ARROW_INSET), constraint); model = new SpinnerNumberModel(ArrowHead.DEFAULT_ARROW_INSET, 0, 100,0.01); arrowInset = new JSpinner(model); arrowInset.setName(LABEL_ARROWINSET); arrowInset.setEditor(new JSpinner.NumberEditor(arrowInset, "0.0000"));//$NON-NLS-1$ arrowInset.addChangeListener(this); constraint.gridx++; arrowP.add(arrowInset, constraint); if(withFillButton) { interiorButton = new ColorButton(LaTeXDrawResources.LABEL_COLOR_INTERIOR_BUTTON, new ButtonIcon(Figure.DEFAULT_INTERIOR_COL)); interiorButton.setActionCommand(LaTeXDrawResources.LABEL_COLOR_INTERIOR_BUTTON); interiorButton.addActionListener(this); constraint.gridx++; arrowP.add(interiorButton, constraint); } arrowP.setBorder(new CompoundBorder(new TitledBorder(null, LABEL_ARROWS, TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); return arrowP; } /** * Allows to set enable or disable the parameters of the left arrow */ public void updateEnableParamsArrow() { JLabel label1 = (JLabel) arrow2Choice.getSelectedItem(); JLabel label2 = (JLabel) arrow1Choice.getSelectedItem(); String text1 = label1.getText(); String text2 = label2.getText(); boolean ok = text1.equals(PSTricksConstants.BAREND_STYLE) || text1.equals(PSTricksConstants.BARIN_STYLE) || text1.equals(PSTricksConstants.LSBRACKET_STYLE) || text1.equals(PSTricksConstants.RSBRACKET_STYLE) || text1.equals(PSTricksConstants.RRBRACKET_STYLE) || text1.equals(PSTricksConstants.LRBRACKET_STYLE) || text2.equals(PSTricksConstants.BAREND_STYLE) || text2.equals(PSTricksConstants.BARIN_STYLE) || text2.equals(PSTricksConstants.LSBRACKET_STYLE) || text2.equals(PSTricksConstants.RSBRACKET_STYLE) || text2.equals(PSTricksConstants.RRBRACKET_STYLE) || text2.equals(PSTricksConstants.LRBRACKET_STYLE) ; tbarsizeDim.setEnabled(ok); tbarsizeNum.setEnabled(ok); bracketNum.setEnabled(text1.equals(PSTricksConstants.RSBRACKET_STYLE) || text1.equals(PSTricksConstants.LSBRACKET_STYLE) || text2.equals(PSTricksConstants.RSBRACKET_STYLE) || text2.equals(PSTricksConstants.LSBRACKET_STYLE)); rbracketNum.setEnabled(text1.equals(PSTricksConstants.RRBRACKET_STYLE) || text1.equals(PSTricksConstants.LRBRACKET_STYLE) || text2.equals(PSTricksConstants.RRBRACKET_STYLE) || text2.equals(PSTricksConstants.LRBRACKET_STYLE)); ok = text1.equals(PSTricksConstants.CIRCLEEND_STYLE) || text1.equals(PSTricksConstants.CIRCLEIN_STYLE) || text1.equals(PSTricksConstants.DISKEND_STYLE) || text1.equals(PSTricksConstants.DISKIN_STYLE) || text2.equals(PSTricksConstants.CIRCLEEND_STYLE) || text2.equals(PSTricksConstants.CIRCLEIN_STYLE) || text2.equals(PSTricksConstants.DISKEND_STYLE) || text2.equals(PSTricksConstants.DISKIN_STYLE); dotSizeDim.setEnabled(ok); dotSizeNum.setEnabled(ok); ok = (text1.equals(PSTricksConstants.DLARROW_STYLE) || text1.equals(PSTricksConstants.LARROW_STYLE) || text1.equals(PSTricksConstants.DRARROW_STYLE) || text1.equals(PSTricksConstants.RARROW_STYLE) || text2.equals(PSTricksConstants.DLARROW_STYLE) || text2.equals(PSTricksConstants.LARROW_STYLE) || text2.equals(PSTricksConstants.DRARROW_STYLE) || text2.equals(PSTricksConstants.RARROW_STYLE)); arrowInset.setEnabled(ok); arrowLength.setEnabled(ok); arrowSizeDim.setEnabled(ok); arrowSizeNum.setEnabled(ok); } /** * Defines if the checkbox "filledCB" must be enable or not. * @since 1.9 */ protected void updateFilledCB() { Figure f = glimpsePanel.getGlimpseFigure(); if(!f.canBeFilled() || filledCheckBox==null) return ; String txt = f.getHatchingStyle(); if(txt.equals(PSTricksConstants.TOKEN_FILL_GRADIENT)) { filledCheckBox.setEnabled(false); return ; } if(f instanceof JoinedLines || f instanceof BezierCurve || f instanceof AkinPoints) { filledCheckBox.setEnabled(!(shadowCheckBox.isSelected() && f.canHaveShadow() && (txt.equals(PSTricksConstants.TOKEN_FILL_CROSSHATCH) || txt.equals(PSTricksConstants.TOKEN_FILL_CROSSHATCH_F) || txt.equals(PSTricksConstants.TOKEN_FILL_HLINES) || txt.equals(PSTricksConstants.TOKEN_FILL_HLINES_F) || txt.equals(PSTricksConstants.TOKEN_FILL_VLINES) || txt.equals(PSTricksConstants.TOKEN_FILL_VLINES_F)))); } else filledCheckBox.setEnabled(!f.canHaveShadow() || !shadowCheckBox.isSelected()); } /** * @return the isModified. * @since 2.0.0 */ public synchronized boolean isModified() { return isModified; } /** * @param isModified the isModified to set. * @since 2.0.0 */ public synchronized void setModified(boolean isModified) { this.isModified = isModified; } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/ParametersGridFrame.java0000644000000000000000000004405311347255510022044 0ustar package latexDraw.ui.dialog; import java.awt.*; import java.awt.event.ActionEvent; import javax.swing.*; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import latexDraw.figures.Figure; import latexDraw.figures.Grid; import latexDraw.figures.GridShape; import latexDraw.lang.LaTeXDrawLang; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.DrawPanel; import latexDraw.ui.components.ButtonIcon; import latexDraw.ui.components.ColorButton; import latexDraw.util.LaTeXDrawResources; /** * This class defines the frame which allows to modify a grid
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class ParametersGridFrame extends AbstractGridShapeFrame { private static final long serialVersionUID = 1L; /** Allows to change the colour of the sub-grid */ protected ColorButton subGridColorButton; /** Allows to change the size of the label */ protected JSpinner labelSize; /** Allows to change the attribute Grid.subGridDiv */ protected JSpinner subGridDiv; /** Allows to change the attribute Grid.subGridWidth */ protected JSpinner subGridWidth; /** Allows to change the attribute Grid.gridWidth */ protected JSpinner gridWidth; /** Allows to change the colour of the labels */ protected ColorButton labelsColorButton; /** Allows to change the attribute Grid.gridDots */ protected JSpinner gridDots; /** Allows to change the attribute Grid.subGridDots */ protected JSpinner subGridDots; /** Allows to know if we must draw the labels */ protected JCheckBox drawLabel; /** Allows to change the attribute Grid.unit */ protected JSpinner unit; /** The label of the unit item */ public static final String LABEL_UNIT = LaTeXDrawLang.getDialogFrameString("ParametersGridFrame.3"); //$NON-NLS-1$ /** The label of the drawLabel checkbox */ public static final String LABEL_DRAWLABELS = LaTeXDrawLang.getDialogFrameString("ParametersGridFrame.15"); //$NON-NLS-1$ /** The label of the subGridDots item */ public static final String LABEL_SUBGRIDDOTS = LaTeXDrawLang.getDialogFrameString("ParametersGridFrame.4"); //$NON-NLS-1$ /** The label of the gridDots item */ public static final String LABEL_GRIDDOTS = LaTeXDrawLang.getDialogFrameString("ParametersGridFrame.5"); //$NON-NLS-1$ /** The label of the gridWidth item */ public static final String LABEL_GRIDWIDTH = LaTeXDrawLang.getDialogFrameString("ParametersGridFrame.6"); //$NON-NLS-1$ /** The label of the subGridWidth item */ public static final String LABEL_SUBGRIDWIDTH = LaTeXDrawLang.getDialogFrameString("ParametersGridFrame.7"); //$NON-NLS-1$ /** The label of the subGridDiv item */ public static final String LABEL_SUBGRIDDIV = LaTeXDrawLang.getDialogFrameString("ParametersGridFrame.8"); //$NON-NLS-1$ /** The label of the X position item */ public static final String LABEL_LABEL_SIZE = LaTeXDrawLang.getDialogFrameString("ParametersGridFrame.9"); //$NON-NLS-1$ /** The label of the subGridcolorutton item */ public static final String LABEL_SUBGRIDCOLOR = LaTeXDrawLang.getDialogFrameString("ParametersGridFrame.10"); //$NON-NLS-1$ /** * The constructor by default * @param d The drawPanel */ public ParametersGridFrame(Frame parent, DrawPanel d, boolean attachToMainFrame) { super(parent, d, attachToMainFrame); try { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.gridy = 0; constraint.gridwidth = 1; constraint.gridheight = 1; constraint.weightx = 0.1; constraint.weighty = 0.1; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.WEST; JTabbedPane tabbedPane = new JTabbedPane(); JPanel pButton = createButtonsPanel(this); JPanel pGeneral = new JPanel(); pGeneral.setLayout(new BoxLayout(pGeneral, BoxLayout.Y_AXIS)); pGeneral.add(createPositionPanel(true)); JPanel pOther = new JPanel(); pOther.setLayout(new BoxLayout(pOther, BoxLayout.Y_AXIS)); JPanel other = new JPanel(new GridBagLayout()); JPanel pLabels = new JPanel(new GridBagLayout()); constraint.gridx=0; constraint.gridy=0; other.add(new JLabel(LABEL_GRIDWIDTH), constraint); SpinnerModel model = new SpinnerNumberModel(1, 0.1, 1000, 0.5); gridWidth = new JSpinner(model); gridWidth.setEditor(new JSpinner.NumberEditor(gridWidth, "0.00"));//$NON-NLS-1$ gridWidth.addChangeListener(this); gridWidth.setName(LABEL_GRIDWIDTH); constraint.gridx++; other.add(gridWidth, constraint); bordersButton = new ColorButton(LaTeXDrawLang.getDialogFrameString("PreferencesFrame.grid"),new ButtonIcon(Figure.DEFAULT_BORDERS_COL)); //$NON-NLS-1$ bordersButton.setActionCommand(LaTeXDrawResources.LABEL_COLOR_BUTTON); bordersButton.addActionListener(this); constraint.gridx = 0; constraint.gridy++; other.add(bordersButton, constraint); subGridColorButton = new ColorButton(LABEL_SUBGRIDCOLOR, new ButtonIcon(PSTricksConstants.DEFAULT_SUB_GRID_COLOR)); subGridColorButton.setActionCommand(LABEL_SUBGRIDCOLOR); subGridColorButton.addActionListener(this); constraint.gridx++; other.add(subGridColorButton, constraint); constraint.gridy++; constraint.gridx = 0; other.add(new JLabel(LABEL_GRIDDOTS), constraint); model = new SpinnerNumberModel(0,0,10000,1); gridDots = new JSpinner(model); gridDots.setEditor(new JSpinner.NumberEditor(gridDots, "0"));//$NON-NLS-1$ gridDots.addChangeListener(this); gridDots.setName(LABEL_GRIDDOTS); constraint.gridx++; other.add(gridDots, constraint); constraint.gridx++; other.add(new JLabel(LABEL_UNIT), constraint); model = new SpinnerNumberModel(1,0.0001,100,0.1); unit = new JSpinner(model); unit.setEditor(new JSpinner.NumberEditor(unit, "0.000"));//$NON-NLS-1$ unit.addChangeListener(this); unit.setName(LABEL_UNIT); constraint.gridx++; other.add(unit, constraint); constraint.gridy++; constraint.gridx = 0; other.add(new JLabel(LABEL_SUBGRIDDIV), constraint); model = new SpinnerNumberModel(1,1,100,1); subGridDiv = new JSpinner(model); subGridDiv.setEditor(new JSpinner.NumberEditor(subGridDiv, "0"));//$NON-NLS-1$ subGridDiv.addChangeListener(this); subGridDiv.setName(LABEL_SUBGRIDDIV); constraint.gridx++; other.add(subGridDiv, constraint); constraint.gridx++; other.add(new JLabel(LABEL_SUBGRIDWIDTH), constraint); model = new SpinnerNumberModel(1, 0.1, 100, 0.5); subGridWidth = new JSpinner(model); subGridWidth.setEditor(new JSpinner.NumberEditor(subGridWidth, "0.00"));//$NON-NLS-1$ subGridWidth.addChangeListener(this); subGridWidth.setName(LABEL_SUBGRIDWIDTH); constraint.gridx++; other.add(subGridWidth, constraint); constraint.gridx=0; constraint.gridy++; other.add(new JLabel(LABEL_SUBGRIDDOTS), constraint); model = new SpinnerNumberModel(0, 0, 10000, 1); subGridDots = new JSpinner(model); subGridDots.setEditor(new JSpinner.NumberEditor(subGridDots, "0"));//$NON-NLS-1$ subGridDots.addChangeListener(this); subGridDots.setName(LABEL_SUBGRIDDOTS); constraint.gridx++; other.add(subGridDots, constraint); constraint.gridx=0; constraint.gridy=0; pLabels.add(new JLabel(LABEL_LABEL_SIZE), constraint); model = new SpinnerNumberModel(Grid.MIN_LABELS_SIZE, Grid.MIN_LABELS_SIZE, 100, 1); labelSize = new JSpinner(model); labelSize.setEditor(new JSpinner.NumberEditor(labelSize, "0"));//$NON-NLS-1$ labelSize.addChangeListener(this); labelSize.setName(LABEL_LABEL_SIZE); constraint.gridx++; pLabels.add(labelSize, constraint); labelsColorButton = new ColorButton(LABEL_LABELSCOLOR, new ButtonIcon(PSTricksConstants.DEFAULT_LABELGRIDCOLOR)); labelsColorButton.setActionCommand(LABEL_LABELSCOLOR); labelsColorButton.addActionListener(this); constraint.gridx++; pLabels.add(labelsColorButton, constraint); drawLabel = new JCheckBox(LABEL_DRAWLABELS, Grid.DEFAULT_LABELSSIZE>0); drawLabel.setActionCommand(LABEL_DRAWLABELS); drawLabel.setName(LABEL_DRAWLABELS); drawLabel.addActionListener(this); constraint.gridwidth = 1; constraint.gridx = 0; constraint.gridy++; pLabels.add(drawLabel, constraint); constraint.gridx = 0; constraint.gridy++; invertXLabelsCB = new JCheckBox(LABEL_ISXLABEL); invertXLabelsCB.setText(LABEL_ISXLABEL); invertXLabelsCB.setSelected(GridShape.DEFAULT_ISYLABELWEST); invertXLabelsCB.setActionCommand(LABEL_ISXLABEL); invertXLabelsCB.addActionListener(this); pLabels.add(invertXLabelsCB, constraint); constraint.gridx+=2; invertYLabelsCB = new JCheckBox(LABEL_ISYLABEL); invertYLabelsCB.setText(LABEL_ISYLABEL); invertYLabelsCB.setSelected(GridShape.DEFAULT_ISXLABELSOUTH); invertYLabelsCB.addActionListener(this); invertYLabelsCB.setActionCommand(LABEL_ISYLABEL); pLabels.add(invertYLabelsCB, constraint); other.setBorder(new CompoundBorder(new TitledBorder(null, LaTeXDrawLang.getString1_7("ParametersGridFrame.0"), //$NON-NLS-1$ TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); pLabels.setBorder(new CompoundBorder(new TitledBorder(null, LaTeXDrawLang.getString1_8("ParametersAxeFrame.12"), //$NON-NLS-1$ TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); pOther.add(other); pOther.add(pLabels); tabbedPane.addTab(TITLE_TABBED_PANE_GENERAL, pGeneral); tabbedPane.addTab(TITLE_TABBED_PANE_OTHERS, pOther); BoxLayout bl = new BoxLayout(getContentPane(), BoxLayout.Y_AXIS); getContentPane().setLayout(bl); getContentPane().add(glimpsePanelZoom); getContentPane().add(tabbedPane); getContentPane().add(pButton); pack(); setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2); setVisible(false); }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } @Override public void setVisible(boolean visible, Figure selected, boolean deleteOnCancel, boolean isFramedBox) { try { if(!(selected instanceof Grid)) throw new ClassCastException(); super.setVisible(visible, selected, deleteOnCancel, isFramedBox); } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } @Override public void actionPerformed(ActionEvent e) { try { Object o = e.getSource(); Grid g = (Grid)glimpsePanel.getGlimpseFigure(); if(o instanceof JCheckBox) { String label = ((JCheckBox)o).getActionCommand(); if(label.equals(LABEL_DRAWLABELS)) { boolean mustBeDrawn = drawLabel.isSelected(); labelsColorButton.setEnabled(mustBeDrawn); labelSize.setEnabled(mustBeDrawn); if(!mustBeDrawn) g.setGridLabelsSize(0); else g.setGridLabelsSize(Integer.valueOf(labelSize.getValue().toString()).intValue()); setModified(true); glimpsePanel.repaint(); return; } } if(o instanceof JButton) { String label = ((JButton)o).getActionCommand(); if(label==null) return ; if(label.equals(LABEL_LABELSCOLOR)) { Color c = JColorChooser.showDialog((Component) e.getSource(), LaTeXDrawLang.getDialogFrameString("ParametersGridFrame.17"), //$NON-NLS-1$ ((ColorButton)o).getColor()); if(c!=null) { setModified(true); ((ColorButton)o).setColor(c); g.setGridLabelsColor(c); glimpsePanel.repaint(); } return ; } if(label.equals(LABEL_SUBGRIDCOLOR)) { Color c = JColorChooser.showDialog((Component) e.getSource(), LaTeXDrawLang.getDialogFrameString("ParametersGridFrame.18"), //$NON-NLS-1$ ((ColorButton)o).getColor()); if(c!=null) { setModified(true); ((ColorButton)o).setColor(c); g.setSubGridColor(c); glimpsePanel.repaint(); } return ; } } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } super.actionPerformed(e); } @Override public void stateChanged(ChangeEvent e) { try { Object o = e.getSource(); Grid g = (Grid)glimpsePanel.getGlimpseFigure(); if(o instanceof JSpinner) { String name = ((JSpinner)o).getName(); if(name.equals(LABEL_GRIDDOTS)) { setModified(true); g.setGridDots(Integer.valueOf(gridDots.getValue().toString()).intValue()); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_UNIT)) { setModified(true); g.setUnit(Float.valueOf(unit.getValue().toString()).doubleValue()); g.updateBorders(null); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_SUBGRIDDOTS)) { setModified(true); g.setSubGridDots(Integer.valueOf(subGridDots.getValue().toString()).intValue()); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_SUBGRIDDIV)) { setModified(true); g.setSubGridDiv(Integer.valueOf(subGridDiv.getValue().toString()).intValue()); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_LABEL_SIZE)) { setModified(true); g.setGridLabelsSize(Integer.valueOf(labelSize.getValue().toString()).intValue()); g.updateBorders(null); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_GRIDWIDTH)) { setModified(true); g.setGridWidth(Float.valueOf(gridWidth.getValue().toString()).floatValue()); g.updateBorders(null); glimpsePanel.repaint(); return ; } if(name.equals(LABEL_SUBGRIDWIDTH)) { setModified(true); g.setSubGridWidth(Float.valueOf(subGridWidth.getValue().toString()).floatValue()); glimpsePanel.repaint(); return ; } } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } super.stateChanged(e); } @Override public void saveParameters() { super.saveParameters(); Grid g = (Grid)figure; g.setUnit(Float.valueOf(unit.getValue().toString()).doubleValue()); g.setGridDots(Integer.valueOf(gridDots.getValue().toString()).intValue()); g.setSubGridDots(Integer.valueOf(subGridDots.getValue().toString()).intValue()); g.setSubGridDiv(Integer.valueOf(subGridDiv.getValue().toString()).intValue()); g.setGridLabelsColor(labelsColorButton.getColor()); if(drawLabel.isSelected()) g.setGridLabelsSize(Integer.valueOf(labelSize.getValue().toString()).intValue()); else g.setGridLabelsSize(0); g.setGridWidth(Float.valueOf(gridWidth.getValue().toString()).floatValue()); g.setSubGridWidth(Float.valueOf(subGridWidth.getValue().toString()).floatValue()); g.setSubGridColor(subGridColorButton.getColor()); g.updateFonts(); g.updateBorders(g.getFontMetrics()); drawPanel.getFrameParent().setExportAsMenu(true); drawPanel.getDraw().updateBorders(); drawPanel.updateDraw(true); } @Override public void setFigureFrameField() { super.setFigureFrameField(); Grid g = (Grid)figure; subGridColorButton.setColor(g.getSubGridColor()); labelsColorButton.setColor(g.getGridLabelsColor()); subGridDiv.setValue(g.getSubGridDiv()); subGridDots.setValue(g.getSubGridDots()); subGridWidth.setValue((double)g.getSubGridWidth()); gridWidth.setValue((double)g.getGridWidth()); gridDots.setValue(g.getGridDots()); unit.setValue(g.getUnit()); if(g.getGridLabelsSize()>0) labelSize.setValue(g.getGridLabelsSize()); } @Override public void setDefaultsValues() { super.setDefaultsValues(); Grid g = (Grid)glimpsePanel.glimpseFigure; unit.setValue(PSTricksConstants.DEFAULT_UNIT); subGridColorButton.setColor(PSTricksConstants.DEFAULT_SUB_GRID_COLOR); labelsColorButton.setColor(PSTricksConstants.DEFAULT_LABELGRIDCOLOR); g.setSubGridColor(PSTricksConstants.DEFAULT_SUB_GRID_COLOR); g.setGridLabelsColor(PSTricksConstants.DEFAULT_LABELGRIDCOLOR); subGridDiv.setValue(PSTricksConstants.DEFAULT_SUBGRIDDIV); subGridDots.setValue(PSTricksConstants.DEFAULT_SUBGRIDDOTS); subGridWidth.setValue(PSTricksConstants.DEFAULT_SUB_GRID_WIDTH); gridWidth.setValue(PSTricksConstants.DEFAULT_GRID_WIDTH); gridDots.setValue(PSTricksConstants.DEFAULT_GRIDDOTS); labelSize.setValue(Grid.DEFAULT_LABELSSIZE); drawLabel.setSelected(true); g.setGridLabelsSize(Grid.DEFAULT_LABELSSIZE); labelSize.setEnabled(drawLabel.isSelected()); glimpsePanel.repaint(); } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/ShortcutsFrame.java0000644000000000000000000002250511347255510021127 0ustar package latexDraw.ui.dialog; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import javax.swing.*; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableColumnModel; import javax.swing.table.TableModel; import latexDraw.lang.LaTeXDrawLang; import latexDraw.util.LaTeXDrawResources; /** * This class defines a frame containing the shortcuts of the program.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 09/18/06
* @author Arnaud BLOUIN
* @version 2.0.0
* @since 1.9
*/ public class ShortcutsFrame extends JFrame { private static final long serialVersionUID = 1L; /** * The constructor creates a frame containing a table with all the shortcuts. */ public ShortcutsFrame() { super(LaTeXDrawLang.getString1_9("LaTeXDrawFrame.3")); //$NON-NLS-1$ setIconImage(LaTeXDrawResources.latexdrawIcon.getImage()); JTable table; final String[] titles = {LaTeXDrawLang.getString1_9("ShortcutsFrame.1"), //$NON-NLS-1$ LaTeXDrawLang.getString1_6("ParserMessagesFrame.0"), //$NON-NLS-1$ LaTeXDrawLang.getString1_9("ShortcutsFrame.3")}; //$NON-NLS-1$ String catEdit = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.89"); //$NON-NLS-1$ String catNav = LaTeXDrawLang.getString1_9("ShortcutsFrame.4"); //$NON-NLS-1$ String catTran = LaTeXDrawLang.getString1_9("ShortcutsFrame.5"); //$NON-NLS-1$ String catDraw = LaTeXDrawLang.getString1_9("ShortcutsFrame.6"); //$NON-NLS-1$ String catFile = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.88"); //$NON-NLS-1$ String cathelp = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.93"); //$NON-NLS-1$ String move = LaTeXDrawLang.getString1_9("ShortcutsFrame.7"); //$NON-NLS-1$ JButton okB = new JButton(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.23")); //$NON-NLS-1$ JPanel panel = new JPanel(); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); String ctrl = KeyEvent.getKeyModifiersText(InputEvent.CTRL_MASK); String shift = KeyEvent.getKeyModifiersText(InputEvent.SHIFT_MASK); String leftClick = LaTeXDrawLang.getString1_9("ShortcutsFrame.8"); //$NON-NLS-1$ final String st1 = LaTeXDrawLang.getString1_9("ShortcutsFrame.9"); //$NON-NLS-1$ final String st2 = LaTeXDrawLang.getString1_9("ShortcutsFrame.10"); //$NON-NLS-1$ final String st3 = LaTeXDrawLang.getString1_9("ShortcutsFrame.11"); //$NON-NLS-1$ final String st4 = LaTeXDrawLang.getString1_9("ShortcutsFrame.12"); //$NON-NLS-1$ final Object[][] data = { {ctrl+"+C", LaTeXDrawResources.LABEL_COPY, catEdit},//$NON-NLS-1$ {ctrl+"+V", LaTeXDrawResources.LABEL_PASTE, catEdit},//$NON-NLS-1$ {ctrl+"+X", LaTeXDrawResources.LABEL_CUT, catEdit},//$NON-NLS-1$ {ctrl+"+Z", LaTeXDrawResources.LABEL_UNDO, catEdit},//$NON-NLS-1$ {ctrl+"+Y", LaTeXDrawResources.LABEL_REDO, catEdit},//$NON-NLS-1$ {ctrl+"+N", LaTeXDrawResources.LABEL_NEW, catFile},//$NON-NLS-1$ {ctrl+"+O", LaTeXDrawResources.LABEL_OPEN, catFile},//$NON-NLS-1$ {ctrl+"+S", LaTeXDrawResources.LABEL_SAVE, catFile},//$NON-NLS-1$ {ctrl+"+E", LaTeXDrawResources.LABEL_PRINT_CODE, catFile},//$NON-NLS-1$ {ctrl+"+D", LaTeXDrawResources.LABEL_PRINT_DRAW, catFile},//$NON-NLS-1$ {ctrl+"+W", LaTeXDrawResources.LABEL_QUIT, catFile},//$NON-NLS-1$ {KeyEvent.getKeyText(KeyEvent.VK_F9), LaTeXDrawResources.LABEL_ZOOM_DEFAULT, catNav}, {KeyEvent.getKeyText(KeyEvent.VK_ADD), LaTeXDrawResources.LABEL_ZOOM_IN, catNav}, {KeyEvent.getKeyText(KeyEvent.VK_SUBTRACT), LaTeXDrawResources.LABEL_ZOOM_OUT, catNav}, {'L', LaTeXDrawResources.LABEL_LINE, catDraw}, {'J', LaTeXDrawResources.LABEL_JOINED_LINES, catDraw}, {'P', LaTeXDrawResources.LABEL_POLY, catDraw}, {'D', LaTeXDrawResources.LABEL_DOT, catDraw}, {'R', LaTeXDrawResources.LABEL_RECT, catDraw}, {'S', LaTeXDrawResources.LABEL_SQUARE, catDraw}, {'H', LaTeXDrawResources.LABEL_RHOMBUS, catDraw}, {'T', LaTeXDrawResources.LABEL_TRIANGLE, catDraw}, {'E', LaTeXDrawResources.LABEL_ELLIPSE, catDraw}, {'C', LaTeXDrawResources.LABEL_CIRCLE, catDraw}, {'A', LaTeXDrawResources.LABEL_ARC, catDraw}, {'W', LaTeXDrawResources.LABEL_WEDGE, catDraw}, {'O', LaTeXDrawResources.LABEL_CHORD, catDraw}, {'B', LaTeXDrawResources.LABEL_BEZIER_CURVE, catDraw}, {'G', LaTeXDrawResources.LABEL_GRID, catDraw}, {'Z', LaTeXDrawResources.LABEL_AXES, catDraw}, {'K', LaTeXDrawResources.LABEL_POINTS_AKIN, catDraw}, {'X', LaTeXDrawResources.LABEL_TEXT, catDraw}, {'F', LaTeXDrawResources.LABEL_SELECT_FIGURE, catDraw}, {KeyEvent.getKeyText(KeyEvent.VK_DELETE), LaTeXDrawResources.LABEL_DELETE, catDraw}, {KeyEvent.getKeyText(KeyEvent.VK_F1), LaTeXDrawResources.LABEL_HELP, cathelp}, {KeyEvent.getKeyText(KeyEvent.VK_F2), LaTeXDrawLang.getString1_9("LaTeXDrawFrame.3"), cathelp}, //$NON-NLS-1$ {KeyEvent.getKeyText(KeyEvent.VK_RIGHT), st1, catNav}, {KeyEvent.getKeyText(KeyEvent.VK_LEFT), st2, catNav}, {KeyEvent.getKeyText(KeyEvent.VK_UP), st3, catNav}, {KeyEvent.getKeyText(KeyEvent.VK_DOWN), st4, catNav}, {ctrl+'+'+KeyEvent.getKeyText(KeyEvent.VK_RIGHT), st1+move, catNav}, {ctrl+'+'+KeyEvent.getKeyText(KeyEvent.VK_LEFT), st2+move, catNav}, {ctrl+'+'+KeyEvent.getKeyText(KeyEvent.VK_UP), st3+move, catNav}, {ctrl+'+'+KeyEvent.getKeyText(KeyEvent.VK_DOWN), st4+move, catNav}, {shift+'+'+ctrl+'+'+KeyEvent.getKeyText(KeyEvent.VK_RIGHT), LaTeXDrawLang.getString1_9("ShortcutsFrame.14"), catNav}, //$NON-NLS-1$ {shift+'+'+ctrl+'+'+KeyEvent.getKeyText(KeyEvent.VK_LEFT), LaTeXDrawLang.getString1_9("ShortcutsFrame.15"), catNav}, //$NON-NLS-1$ {shift+'+'+ctrl+'+'+KeyEvent.getKeyText(KeyEvent.VK_UP), LaTeXDrawLang.getString1_9("ShortcutsFrame.16"), catNav}, //$NON-NLS-1$ {shift+'+'+ctrl+'+'+KeyEvent.getKeyText(KeyEvent.VK_DOWN), LaTeXDrawLang.getString1_9("ShortcutsFrame.17"), catNav}, //$NON-NLS-1$ {shift+'+'+KeyEvent.getKeyText(KeyEvent.VK_RIGHT), LaTeXDrawLang.getString1_9("ShortcutsFrame.18"), catNav}, //$NON-NLS-1$ {shift+'+'+KeyEvent.getKeyText(KeyEvent.VK_LEFT), LaTeXDrawLang.getString1_9("ShortcutsFrame.19"), catNav}, //$NON-NLS-1$ {shift+'+'+KeyEvent.getKeyText(KeyEvent.VK_UP), LaTeXDrawLang.getString1_9("ShortcutsFrame.20"), catNav}, //$NON-NLS-1$ {shift+'+'+KeyEvent.getKeyText(KeyEvent.VK_DOWN), LaTeXDrawLang.getString1_9("ShortcutsFrame.21"), catNav}, //$NON-NLS-1$ {ctrl+"+U", LaTeXDrawLang.getString1_9("ShortcutsFrame.23"), catTran}, //$NON-NLS-1$ //$NON-NLS-2$ {ctrl+"+A", LaTeXDrawLang.getString1_9("ShortcutsFrame.25"), catDraw}, //$NON-NLS-1$ //$NON-NLS-2$ {ctrl+'+'+leftClick, LaTeXDrawLang.getString1_9("ShortcutsFrame.26"), catDraw}, //$NON-NLS-1$ {shift+'+'+leftClick, LaTeXDrawLang.getString1_9("ShortcutsFrame.27"), catDraw}, //$NON-NLS-1$ {KeyEvent.getKeyText(KeyEvent.VK_SPACE), LaTeXDrawLang.getString1_9("ShortcutsFrame.28"), catDraw}, //$NON-NLS-1$ {ctrl+'+'+LaTeXDrawLang.getString1_9("ShortcutsFrame.29"), LaTeXDrawLang.getString1_9("ShortcutsFrame.30"), catDraw} //$NON-NLS-1$ //$NON-NLS-2$ }; TableModel dataModel = new AbstractTableModel() { private static final long serialVersionUID = 1L; public int getColumnCount() { return titles.length; } public int getRowCount() { return data.length;} public Object getValueAt(int row, int col) {return data[row][col];} @Override public String getColumnName(int column) {return titles[column];} @Override public Class getColumnClass(int c) {return getValueAt(0, c).getClass();} @Override public boolean isCellEditable(int row, int col) {return false;} @Override public void setValueAt(Object aValue, int row, int column) { data[row][column] = aValue; } }; table = new JTable(dataModel); table.getTableHeader().setReorderingAllowed(false); TableColumnModel colmodel = table.getColumnModel(); colmodel.getColumn(0).setPreferredWidth(30); colmodel.getColumn(1).setPreferredWidth(200); colmodel.getColumn(2).setPreferredWidth(40); JScrollPane scrollPane = new JScrollPane(); JViewport vp = scrollPane.getViewport(); vp.add(table); okB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); } }); panel.add(okB); getContentPane().setLayout(new BorderLayout()); getContentPane().add(scrollPane, BorderLayout.CENTER); getContentPane().add(panel, BorderLayout.SOUTH); setSize(550, 500); setLocation((dim.width-getWidth())/2, (dim.height-getHeight())/2); } } latexdraw-2.0.8+1.orig/latexDraw/ui/dialog/ExceptionFrameDialog.java0000644000000000000000000001300311347255510022200 0ustar package latexDraw.ui.dialog; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.ClipboardOwner; import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.Transferable; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; import latexDraw.lang.LaTeXDrawLang; import latexDraw.util.LaTeXDrawResources; /** * This class defines a frame which allows to show, to the user, the * exception which has occurred in a frame. The user can send the report * of the exception to the developer of the LaTeXDraw Project *
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* * 01/20/06
* @author Arnaud BLOUIN
* @version 1.9
*/ public class ExceptionFrameDialog extends JFrame implements ActionListener, ClipboardOwner { private static final long serialVersionUID = 1L; /** The exception which much be displayed */ Exception exception; /** The label of the button "ok" */ public static final String LABEL_OK = AbstractParametersFrame.LABEL_OK; public static final String LABEL_COPY = "copy"; //$NON-NLS-1$ private JEditorPane editor; protected JLabel info; /** * The constructor by default */ public ExceptionFrameDialog(Exception e) { try { info = new JLabel(); exception = e; setIconImage(LaTeXDrawResources.errIcon.getImage()); editor = new JEditorPane(); JScrollPane scroller = new JScrollPane(); JViewport vp = scroller.getViewport(); StackTraceElement[] stack = e.getStackTrace(); int i, size = stack.length; String msg=""; //$NON-NLS-1$ editor.setEditable(false); vp.add(editor); for(i=0; i *
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* * 09/15/06
* @author Arnaud BLOUIN
* @version 2.0.0
* @since 1.9
*/ public class RecentFilesListener extends AbstractListener implements ActionListener { public static final String ACTION_CMD_RECENT_CLEAR = "clearRecents";//$NON-NLS-1$ /** The prefix of the action command of "recent files" menus. */ public static final String RECENT_PREFIX_CMD = "RECENT_";//$NON-NLS-1$ protected PreferencesFrame preferencesFrame; /** * The constructor. * @param prefFrame The frame of preferences. * @param frame The main frame of the program. */ public RecentFilesListener(PreferencesFrame prefFrame, LaTeXDrawFrame frame) { super(frame); preferencesFrame = prefFrame; mainFrame = frame; } public void actionPerformed(ActionEvent e) { Object src = e.getSource(); if(src instanceof JMenuItem) { AbstractButton ab = ((AbstractButton)src); String label = ab.getActionCommand(); if(label.equals(ACTION_CMD_RECENT_CLEAR)) { preferencesFrame.getRecentFilesName().clear(); preferencesFrame.writeXMLPreferences(false); mainFrame.getLMenuBar().updateRecentFilesMenu(); return ; } if(label.compareTo(RECENT_PREFIX_CMD)>0) { String path = label.substring(RECENT_PREFIX_CMD.length()); boolean ok = false; if(path.toLowerCase().endsWith(TeXFilter.TEX_EXTENSION)) { if(mainFrame.getDrawPanel().isModified()) switch(JOptionPane.showConfirmDialog(mainFrame, LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.156"), //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.110"), //$NON-NLS-1$ JOptionPane.YES_NO_CANCEL_OPTION)) { case JOptionPane.YES_OPTION: boolean saved = mainFrame.save(true); ok = saved ? mainFrame.importPSTricksFile(path) : false; break; case JOptionPane.NO_OPTION: ok = mainFrame.importPSTricksFile(path); break; case JOptionPane.CANCEL_OPTION: ok = true; break; } else ok = mainFrame.importPSTricksFile(path); } else if(mainFrame.getDrawPanel().isModified()) switch(JOptionPane.showConfirmDialog(mainFrame, LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.156"), //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.110"), //$NON-NLS-1$ JOptionPane.YES_NO_CANCEL_OPTION)) { case JOptionPane.YES_OPTION: boolean saved = mainFrame.save(true); ok = saved ? mainFrame.open(path, false) : false ; break; case JOptionPane.NO_OPTION: ok = mainFrame.open(path, false); break; case JOptionPane.CANCEL_OPTION: ok = true; break; } else ok = mainFrame.open(path, false); if(!ok) JOptionPane.showMessageDialog(mainFrame, LaTeXDrawLang.getString1_9("RecentFilesListener.0"), //$NON-NLS-1$ LaTeXDrawLang.getString1_9("RecentFilesListener.1"), //$NON-NLS-1$ JOptionPane.WARNING_MESSAGE); return ; } } } } latexdraw-2.0.8+1.orig/latexDraw/ui/listeners/MenusListener.java0000644000000000000000000005672511347255510021537 0ustar package latexDraw.ui.listeners; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; import latexDraw.figures.Draw; import latexDraw.figures.Figure; import latexDraw.lang.LaTeXDrawLang; import latexDraw.ui.DrawPanel; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.ui.dialog.ExceptionFrameDialog; import latexDraw.util.LaTeXDrawResources; import latexDraw.util.VersionChecker; /** * This class defines a listener for the menu of the program.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* * 09/18/06
* @author Arnaud BLOUIN
* @version 2.0.0
* @since 1.9
*/ public class MenusListener extends AbstractListener implements ActionListener { public static final String ACTION_CMD_SHORTCUTS = "shortcut";//$NON-NLS-1$ public static final String ACTION_VISIBLE_ALL_FIGURES = "visibleAll";//$NON-NLS-1$ public static final String LABEL_CHECK_UPDATE = "checkupdate";//$NON-NLS-1$ public MenusListener(LaTeXDrawFrame frame) { super(frame); } public void actionPerformed(ActionEvent e) { Object src = e.getSource(); if(src instanceof AbstractButton) { AbstractButton ab = ((AbstractButton)src); String label = ab.getActionCommand(); DrawPanel drawPanel = mainFrame.getDrawPanel(); boolean ok = ab.isSelected(); if(label.equals(LaTeXDrawResources.LABEL_SAVE)) { mainFrame.save(false); mainFrame.requestFocus(); return; } if(label.equals(LaTeXDrawResources.LABEL_SAVE_AS)) { mainFrame.save(true); mainFrame.requestFocus(); return; } if(label.equals(LaTeXDrawResources.LABEL_OPEN)) { try { if(drawPanel.isModified()) switch(JOptionPane.showConfirmDialog(mainFrame, LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.156"), //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.10"), //$NON-NLS-1$ JOptionPane.YES_NO_CANCEL_OPTION)) { case JOptionPane.YES_OPTION: boolean saved = mainFrame.save(true); if(saved) mainFrame.open(null, true); break; case JOptionPane.NO_OPTION: mainFrame.open(null, true); break; case JOptionPane.CANCEL_OPTION: break; } else mainFrame.open(null, true); }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } mainFrame.requestFocus(); return; } if(label.equals(ACTION_VISIBLE_ALL_FIGURES)) { drawPanel.getDraw().recenterFigures(); drawPanel.updateDraw(false); return; } if(label.equals(LaTeXDrawResources.LABEL_ZOOM_IN)) { drawPanel.zoomIn(); drawPanel.getFrameParent().getToolbar().getZoomField().setValue(drawPanel.getZoom()*100); mainFrame.getXScale().repaint(); mainFrame.getYScale().repaint(); mainFrame.requestFocus(); return; } if(label.equals(LaTeXDrawResources.LABEL_ZOOM_OUT)) { drawPanel.zoomOut(); drawPanel.getFrameParent().getToolbar().getZoomField().setValue(drawPanel.getZoom()*100); mainFrame.getXScale().repaint(); mainFrame.getYScale().repaint(); mainFrame.requestFocus(); return; } if(label.equals(LaTeXDrawResources.LABEL_ZOOM_DEFAULT)) { drawPanel.zoomDefault(); drawPanel.getFrameParent().getToolbar().getZoomField().setValue(drawPanel.getZoom()*100); mainFrame.getXScale().repaint(); mainFrame.getYScale().repaint(); mainFrame.requestFocus(); return; } if(label.equals(LaTeXDrawResources.LABEL_REDO)) { mainFrame.getUndoManager().redo(); drawPanel.updateDraw(true); mainFrame.setSelection(!drawPanel.getDraw().getSelected().isEmpty()); mainFrame.updateUndoRedo(); mainFrame.updateFrameFields(); mainFrame.setExportAsMenu(drawPanel.getDraw().getNbFigures()>0); mainFrame.setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.158")); //$NON-NLS-1$ mainFrame.setIsModified(true); mainFrame.requestFocus(); return; } if(label.equals(LaTeXDrawResources.LABEL_UNDO)) { mainFrame.getUndoManager().undo(); drawPanel.updateDraw(true); mainFrame.setSelection(!drawPanel.getDraw().getSelected().isEmpty()); mainFrame.updateUndoRedo(); mainFrame.updateFrameFields(); mainFrame.setExportAsMenu(drawPanel.getDraw().getNbFigures()>0); mainFrame.setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.159")); //$NON-NLS-1$ mainFrame.setIsModified(true); mainFrame.requestFocus(); return; } if(label.equals(ACTION_CMD_SHORTCUTS)) { mainFrame.showShortcutsFrame(); return ; } if(label.equals(LaTeXDrawResources.LABEL_COPY)) { drawPanel.copy(); mainFrame.setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.146")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_PASTE)) { drawPanel.paste(); mainFrame.setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.147")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_CUT)) { drawPanel.cut(); mainFrame.setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.148")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_DISPLAY_BORDERS)) { mainFrame.displayBorders(ok); mainFrame.requestFocus(); return; } if(label.equals(LaTeXDrawResources.LABEL_SELECT_FIGURE)) { mainFrame.getLMenuBar().getMenuSelect().setSelected(ok); mainFrame.getToolbar().getButtonImageSelect().setSelected(ok); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_SELECT_FIGURE); drawPanel.isSelection(true); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); return; } if(label.equals(LaTeXDrawResources.LABEL_LINE)) { mainFrame.getLMenuBar().getMenuLine().setSelected(ok); mainFrame.getToolbar().getButtonImageLine().setSelected(ok); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_LINE); drawPanel.isSelection(false); mainFrame.setSelection(false); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); mainFrame.setStatusBarText(LaTeXDrawLang.getString1_9("MenusListener.0")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_JOINED_LINES)) { mainFrame.getLMenuBar().getMenuJoinedLines().setSelected(ok); mainFrame.getToolbar().getButtonImageJoinedLines().setSelected(ok); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_JOINED_LINES); drawPanel.isSelection(false); mainFrame.setSelection(false); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); mainFrame.setStatusBarText(LaTeXDrawLang.getString1_9("MenusListener.1")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_RECT)) { mainFrame.getLMenuBar().getMenuRect().setSelected(ok); mainFrame.getToolbar().getButtonImageRect().setSelected(ok); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_RECT); drawPanel.isSelection(false); mainFrame.setSelection(false); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); mainFrame.setStatusBarText(LaTeXDrawLang.getString1_9("MenusListener.4")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_POLY)) { mainFrame.getLMenuBar().getMenuPoly().setSelected(ok); mainFrame.getToolbar().getButtonImagePoly().setSelected(ok); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_POLY); drawPanel.isSelection(false); mainFrame.setSelection(false); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); mainFrame.setStatusBarText(LaTeXDrawLang.getString1_9("MenusListener.1")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_SQUARE)) { mainFrame.getLMenuBar().getMenuSquare().setSelected(ok); mainFrame.getToolbar().getButtonImageSquare().setSelected(ok); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_SQUARE); drawPanel.isSelection(false); mainFrame.setSelection(false); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); mainFrame.setStatusBarText(LaTeXDrawLang.getString1_9("MenusListener.4")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_TEXT)) { mainFrame.getLMenuBar().getMenuText().setSelected(ok); mainFrame.getToolbar().getButtonImageText().setSelected(ok); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_TEXT); drawPanel.isSelection(false); mainFrame.setSelection(false); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); mainFrame.setStatusBarText(LaTeXDrawLang.getString1_9("MenusListener.5")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_GRID)) { mainFrame.getLMenuBar().getMenuGrid().setSelected(ok); mainFrame.getToolbar().getButtonImageGrid().setSelected(ok); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_GRID); drawPanel.isSelection(false); mainFrame.setSelection(false); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); mainFrame.setStatusBarText(LaTeXDrawLang.getString1_9("MenusListener.6")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_AXES)) { mainFrame.getLMenuBar().getMenuAxes().setSelected(ok); mainFrame.getToolbar().getButtonImageAxes().setSelected(ok); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_AXES); drawPanel.isSelection(false); mainFrame.setSelection(false); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); mainFrame.setStatusBarText(LaTeXDrawLang.getString1_9("MenusListener.7")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_POINTS_AKIN)) { mainFrame.getLMenuBar().getMenuPointsAkin().setSelected(ok); mainFrame.getToolbar().getButtonImagePointsAkin().setSelected(ok); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_POINTS_AKIN); drawPanel.isSelection(false); mainFrame.setSelection(false); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); mainFrame.setStatusBarText(LaTeXDrawLang.getString1_9("MenusListener.8")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_DOT)) { mainFrame.getLMenuBar().getMenuDot().setSelected(ok); mainFrame.getToolbar().getButtonImageDot().setSelected(ok); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_DOT); drawPanel.isSelection(false); mainFrame.setSelection(false); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); mainFrame.setStatusBarText(LaTeXDrawLang.getString1_9("MenusListener.9")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_RHOMBUS)) { mainFrame.getLMenuBar().getMenuRhombus().setSelected(ok); mainFrame.getToolbar().getButtonImageRhombus().setSelected(ok); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_RHOMBUS); drawPanel.isSelection(false); mainFrame.setSelection(false); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); mainFrame.setStatusBarText(LaTeXDrawLang.getString1_9("MenusListener.4")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_TRIANGLE)) { mainFrame.getLMenuBar().getMenuTriangle().setSelected(ok); mainFrame.getToolbar().getButtonImageTriangle().setSelected(ok); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_TRIANGLE); drawPanel.isSelection(false); mainFrame.setSelection(false); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); mainFrame.setStatusBarText(LaTeXDrawLang.getString1_9("MenusListener.4")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_CIRCLE)) { mainFrame.getLMenuBar().getMenuCircle().setSelected(ok); mainFrame.getToolbar().getButtonImageCircle().setSelected(ok); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_CIRCLE); drawPanel.isSelection(false); mainFrame.setSelection(false); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); mainFrame.setStatusBarText(LaTeXDrawLang.getString1_9("MenusListener.4")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_ELLIPSE)) { mainFrame.getLMenuBar().getMenuEllipse().setSelected(ok); mainFrame.getToolbar().getButtonImageEllipse().setSelected(ok); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_ELLIPSE); drawPanel.isSelection(false); mainFrame.setSelection(false); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); mainFrame.setStatusBarText(LaTeXDrawLang.getString1_9("MenusListener.4")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_ARC)) { mainFrame.getLMenuBar().getMenuArc().setSelected(ok); mainFrame.getToolbar().getButtonImageArc().setSelected(true); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_ARC); drawPanel.isSelection(false); mainFrame.setSelection(false); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); mainFrame.setStatusBarText(LaTeXDrawLang.getString1_9("MenusListener.4")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_CHORD)) { mainFrame.getLMenuBar().getMenuChord().setSelected(ok); mainFrame.getToolbar().getButtonImageChord().setSelected(true); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_CHORD); drawPanel.isSelection(false); mainFrame.setSelection(false); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); mainFrame.setStatusBarText(LaTeXDrawLang.getString1_9("MenusListener.4")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_WEDGE)) { mainFrame.getLMenuBar().getMenuWedge().setSelected(ok); mainFrame.getToolbar().getButtonImageWedge().setSelected(ok); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_WEDGE); drawPanel.isSelection(false); mainFrame.setSelection(false); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); mainFrame.setStatusBarText(LaTeXDrawLang.getString1_9("MenusListener.4")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_BEZIER_CURVE)) { mainFrame.getLMenuBar().getMenuBezierCurve().setSelected(ok); mainFrame.getToolbar().getButtonImageBezierCurve().setSelected(ok); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_BEZIER_CURVE); drawPanel.isSelection(false); mainFrame.setSelection(false); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); mainFrame.setStatusBarText(LaTeXDrawLang.getString1_9("MenusListener.1")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_CLOSED_BEZIER_CURVE)) { mainFrame.getLMenuBar().getMenuClosedBezierCurve().setSelected(ok); mainFrame.getToolbar().getButtonImageClosedBezierCurve().setSelected(ok); LaTeXDrawFrame.setCurrentChoice(LaTeXDrawResources.LABEL_CLOSED_BEZIER_CURVE); drawPanel.isSelection(false); mainFrame.setSelection(false); drawPanel.setMenuSelectedPopupGeneral(label, true); mainFrame.requestFocus(); mainFrame.setStatusBarText(LaTeXDrawLang.getString1_9("MenusListener.1")); //$NON-NLS-1$ return; } if(label.equals(LaTeXDrawResources.LABEL_DELETE)) { if(drawPanel.deleteSelection()==0) { mainFrame.setExportAsMenu(false); drawPanel.setIsModified(true); mainFrame.setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.149")); //$NON-NLS-1$ } mainFrame.setSelection(false); mainFrame.requestFocus(); return; } if(label.equals(LaTeXDrawResources.LABEL_INSERT_PIX)) { mainFrame.insertPicture(); mainFrame.requestFocus(); return ; } if(label.equals(LaTeXDrawResources.LABEL_TEMPLATE_EXPORT)) { mainFrame.exportAsTemplate(); mainFrame.requestFocus(); return ; } if(label.equals(LaTeXDrawResources.LABEL_NEW) || label.equals(LaTeXDrawResources.LABEL_NEW_WITH_SEL)) { Draw selection = null; if(label.equals(LaTeXDrawResources.LABEL_NEW_WITH_SEL)) try { selection = (Draw) mainFrame.getDrawPanel().getDraw().getSelected().clone(); } catch(CloneNotSupportedException e1) { /**/ } mainFrame.newProject(); if(selection!=null && !selection.isEmpty()) { for(Figure f : selection.getFigures()) mainFrame.getDrawPanel().getDraw().addFigure(f, null); mainFrame.setIsModified(true); mainFrame.getDrawPanel().updateDraw(true); mainFrame.updateFrameFields(); } mainFrame.requestFocus(); return; } if(label.equals(LaTeXDrawResources.LABEL_BATCH_CONVERT)) { mainFrame.batchConvertion(); return; } if(label.equals(LaTeXDrawResources.LABEL_EXPORT_TRICKS)) { mainFrame.exportAsPsTricks(); return; } if(label.equals(LaTeXDrawResources.LABEL_EXPORT_PDF_LATEX_CROP)) { mainFrame.exportAsPicture(LaTeXDrawResources.LABEL_EXPORT_PDF_LATEX_CROP); return; } if(label.equals(LaTeXDrawResources.LABEL_EXPORT_PDF_LATEX)) { mainFrame.exportAsPicture(LaTeXDrawResources.LABEL_EXPORT_PDF_LATEX); return; } if(label.equals(LaTeXDrawResources.LABEL_EXPORT_EPS_LATEX)) { mainFrame.exportAsPicture(LaTeXDrawResources.LABEL_EXPORT_EPS_LATEX); return; } if(label.equals(LaTeXDrawResources.LABEL_EXPORT_BMP)) { mainFrame.exportAsPicture(LaTeXDrawResources.LABEL_EXPORT_BMP); return; } if(label.equals(LaTeXDrawResources.LABEL_EXPORT_JPG)) { mainFrame.exportAsPicture(LaTeXDrawResources.LABEL_EXPORT_JPG); return; } if(label.equals(LaTeXDrawResources.LABEL_EXPORT_PNG)) { mainFrame.exportAsPicture(LaTeXDrawResources.LABEL_EXPORT_PNG); return; } if(label.equals(LaTeXDrawResources.LABEL_EXPORT_EPS)) { mainFrame.exportAsPicture(LaTeXDrawResources.LABEL_EXPORT_EPS); return; } if(label.equals(LaTeXDrawResources.LABEL_EXPORT_PPM)) { mainFrame.exportAsPicture(LaTeXDrawResources.LABEL_EXPORT_PPM); return; } if(label.equals(LaTeXDrawResources.LABEL_PRINT_CODE)) { mainFrame.printCode(); return; } if(label.equals(LaTeXDrawResources.LABEL_PRINT_DRAW)) { mainFrame.printDraw(); return; } if(label.equals(LaTeXDrawResources.LABEL_FIGURE_PROPERTIES)) { Draw listSelected = drawPanel.getDraw().getSelected(); if(listSelected.size()!=1) return; mainFrame.showParamFrame(listSelected.getFigureAt(0), false); return ; } if(label.equals(LABEL_CHECK_UPDATE)) { VersionChecker vc = new VersionChecker(mainFrame); vc.start(); return; } if(label.equals(LaTeXDrawResources.LABEL_QUIT)) mainFrame.onWindowClosing(); if(label.equals(LaTeXDrawResources.LABEL_AUTO_ADJUST_BORDERS)) { drawPanel.setAutoAdjustement(ab.isSelected()); drawPanel.setIsModified(true); return; } if(label.equals(LaTeXDrawResources.LABEL_DISPLAY_XSCALE)) { mainFrame.displayXScale(ab.isSelected()); return; } if(label.equals(LaTeXDrawResources.LABEL_DISPLAY_YSCALE)) { mainFrame.displayYScale(ab.isSelected()); return; } if(label.equals(LaTeXDrawResources.LABEL_IMPORT_TEX)) { try { if(drawPanel.isModified()) switch(JOptionPane.showConfirmDialog(mainFrame, LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.156"), //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.110"), //$NON-NLS-1$ JOptionPane.YES_NO_CANCEL_OPTION)) { case JOptionPane.YES_OPTION: boolean saved = mainFrame.save(true); if(saved) mainFrame.importPSTricksFile(); break; case JOptionPane.NO_OPTION: mainFrame.importPSTricksFile(); break; case JOptionPane.CANCEL_OPTION: break; } else mainFrame.importPSTricksFile(); }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } mainFrame.requestFocus(); return; } return ; } } } latexdraw-2.0.8+1.orig/latexDraw/ui/listeners/ToolbarListener.java0000644000000000000000000001237211347255510022040 0ustar package latexDraw.ui.listeners; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; import latexDraw.ui.DrawPanel; import latexDraw.ui.LaTeXDrawFrame; /** * Defines a listener for the latexdraw toolbar.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 08/14/07
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class ToolbarListener extends AbstractListener implements ActionListener { public static final String LABEL_ALIGN_LEFT = "alignLeft"; //$NON-NLS-1$ public static final String LABEL_ALIGN_RIGHT = "alignRight"; //$NON-NLS-1$ public static final String LABEL_ALIGN_TOP = "alignTop"; //$NON-NLS-1$ public static final String LABEL_ALIGN_BOTTOM = "alignBottom"; //$NON-NLS-1$ public static final String LABEL_ALIGN_MIDDLE_H = "alignMiddleH"; //$NON-NLS-1$ public static final String LABEL_ALIGN_MIDDLE_V = "alignMiddleV"; //$NON-NLS-1$ public static final String LABEL_DISTRIB_H_EQ = "distribHEq"; //$NON-NLS-1$ public static final String LABEL_DISTRIB_H_LEFT = "distribHLe"; //$NON-NLS-1$ public static final String LABEL_DISTRIB_H_RIGHT = "distribHRi"; //$NON-NLS-1$ public static final String LABEL_DISTRIB_H_MID = "distribHMi"; //$NON-NLS-1$ public static final String LABEL_DISTRIB_V_EQ = "distribVEq"; //$NON-NLS-1$ public static final String LABEL_DISTRIB_V_BOTTOM = "distribVBo"; //$NON-NLS-1$ public static final String LABEL_DISTRIB_V_TOP = "distribVTo"; //$NON-NLS-1$ public static final String LABEL_DISTRIB_V_MID = "distribVMi"; //$NON-NLS-1$ /** * The constructor. * @param frame The latexdraw frame. */ public ToolbarListener(LaTeXDrawFrame frame) { super(frame); } public void actionPerformed(ActionEvent e) { Object src = e.getSource(); if(src instanceof JMenuItem || src instanceof JButton || src instanceof JToggleButton || src instanceof JCheckBox) { String label = ((AbstractButton)src).getActionCommand(); DrawPanel drawPanel = mainFrame.getDrawPanel(); if(label.equals(LABEL_ALIGN_LEFT)) { drawPanel.getDraw().align(0); drawPanel.updateDraw(true); mainFrame.requestFocus(); return ; } if(label.equals(LABEL_ALIGN_RIGHT)) { drawPanel.getDraw().align(1); drawPanel.updateDraw(true); mainFrame.requestFocus(); return ; } if(label.equals(LABEL_ALIGN_TOP)) { drawPanel.getDraw().align(2); drawPanel.updateDraw(true); mainFrame.requestFocus(); return ; } if(label.equals(LABEL_ALIGN_BOTTOM)) { drawPanel.getDraw().align(3); drawPanel.updateDraw(true); mainFrame.requestFocus(); return ; } if(label.equals(LABEL_ALIGN_MIDDLE_H)) { drawPanel.getDraw().align(5); drawPanel.updateDraw(true); mainFrame.requestFocus(); return ; } if(label.equals(LABEL_ALIGN_MIDDLE_V)) { drawPanel.getDraw().align(4); drawPanel.updateDraw(true); mainFrame.requestFocus(); return ; } if(label.equals(LABEL_DISTRIB_H_LEFT)) { drawPanel.getDraw().distribute(4); drawPanel.updateDraw(true); mainFrame.requestFocus(); return ; } if(label.equals(LABEL_DISTRIB_H_MID)) { drawPanel.getDraw().distribute(5); drawPanel.updateDraw(true); mainFrame.requestFocus(); return ; } if(label.equals(LABEL_DISTRIB_H_RIGHT)) { drawPanel.getDraw().distribute(6); drawPanel.updateDraw(true); mainFrame.requestFocus(); return ; } if(label.equals(LABEL_DISTRIB_H_EQ)) { drawPanel.getDraw().distribute(7); drawPanel.updateDraw(true); mainFrame.requestFocus(); return ; } if(label.equals(LABEL_DISTRIB_V_BOTTOM)) { drawPanel.getDraw().distribute(0); drawPanel.updateDraw(true); mainFrame.requestFocus(); return ; } if(label.equals(LABEL_DISTRIB_V_MID)) { drawPanel.getDraw().distribute(1); drawPanel.updateDraw(true); mainFrame.requestFocus(); return ; } if(label.equals(LABEL_DISTRIB_V_TOP)) { drawPanel.getDraw().distribute(2); drawPanel.updateDraw(true); mainFrame.requestFocus(); return ; } if(label.equals(LABEL_DISTRIB_V_EQ)) { drawPanel.getDraw().distribute(3); drawPanel.updateDraw(true); mainFrame.requestFocus(); return ; } } } } latexdraw-2.0.8+1.orig/latexDraw/ui/listeners/AbstractListener.java0000644000000000000000000000222411347255510022174 0ustar package latexDraw.ui.listeners; import latexDraw.ui.LaTeXDrawFrame; /** * This class defines an abstract listener for the program.
* It contains a reference to the main frame. *
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* * 09/18/06
* @author Arnaud BLOUIN
* @version 2.0.0
* @since 1.9
*/ public class AbstractListener { /** The main frame of the program. */ LaTeXDrawFrame mainFrame; /** * The constructor. * @param frame A reference to the main frame of the program. */ public AbstractListener(LaTeXDrawFrame frame) { mainFrame = frame; } } latexdraw-2.0.8+1.orig/latexDraw/ui/listeners/ShortcutsListener.java0000644000000000000000000001764011347255510022437 0ustar package latexDraw.ui.listeners; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.Vector; import latexDraw.figures.Draw; import latexDraw.figures.Figure; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.util.UndoRedoManager; /** * This class allows the program to listen the shortcuts the user want to do.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 09/15/06
* @author Arnaud BLOUIN
* @version 2.0.0
* @since 1.9
*/ public class ShortcutsListener extends AbstractListener implements KeyListener { public static final int INTERVAL_SCROLLBAR = 5; /** This set of figures is used when the selection is moved for the undo/redo manager. @since 1.9.1 */ protected Draw clone; private long oldTime; /** * The constructor. * @param frame The main frame of the program; cannot be null. */ public ShortcutsListener(LaTeXDrawFrame frame) { super(frame); clone = null; oldTime = 0; } public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if(key==KeyEvent.VK_SPACE) {// Back space select the first or the next figure (if a single figure is already selected). if(mainFrame.isOnSelection()) mainFrame.getDrawPanel().getDraw().selectNextFigure(); return ; } if(key==KeyEvent.VK_A)// ctrl+A = select of the figures. { if(e.getModifiers()==InputEvent.CTRL_MASK) { mainFrame.selectAllFigures(); return ; } return ; } if(key==KeyEvent.VK_U)// ctrl+U = update the selected figures to the magnetic grid. { if(e.getModifiers()==InputEvent.CTRL_MASK) { mainFrame.getDrawPanel().updateSelectionToGrid(); return ; } return ; } if(key==KeyEvent.VK_RIGHT) { if(e.getModifiers()==0)// Right arrow = move the horizontal scrollbar to the right. { mainFrame.getDrawPanel().moveHorizontalScrollbar(INTERVAL_SCROLLBAR); return ; } if(e.getModifiers()==InputEvent.CTRL_MASK) {// Right arrow + ctrl = move strongly the horizontal scrollbar to the right. mainFrame.getDrawPanel().moveHorizontalScrollbar(mainFrame.getDrawPanel().getWidth()); return ; } if(e.getModifiers()==(InputEvent.CTRL_MASK+InputEvent.SHIFT_MASK)) {// Right arrow + ctrl + shift = move at the end of the horizontal scrollbar. mainFrame.getDrawPanel().getHorizontalScrollBar().setValue( mainFrame.getDrawPanel().getHorizontalScrollBar().getMaximum()); return ; } if(e.getModifiers()==InputEvent.ALT_MASK) {// alt + right arrow = move the selected figures to the right. if(clone==null) try { oldTime = e.getWhen(); clone = (Draw)mainFrame.getDrawPanel().getDraw().getSelected().clone(); } catch(CloneNotSupportedException e1) { clone = null; } mainFrame.getDrawPanel().moveSelectedFiguresHorizontally(1); return ; } return ; } if(key==KeyEvent.VK_LEFT) { if(e.getModifiers()==0)// left arrow = move the horizontal scrollbar to the left. { mainFrame.getDrawPanel().moveHorizontalScrollbar(-INTERVAL_SCROLLBAR); return ; } if(e.getModifiers()==InputEvent.CTRL_MASK) {// left arrow + ctrl = move strongly the horizontal scrollbar to the left. mainFrame.getDrawPanel().moveHorizontalScrollbar(-mainFrame.getDrawPanel().getWidth()); return ; } if(e.getModifiers()==(InputEvent.CTRL_MASK+InputEvent.SHIFT_MASK)) {// left arrow + ctrl + shift = move at the beginning of the horizontal scrollbar. mainFrame.getDrawPanel().getHorizontalScrollBar().setValue( mainFrame.getDrawPanel().getHorizontalScrollBar().getMinimum()); return ; } if(e.getModifiers()==InputEvent.ALT_MASK) {// alt + right arrow = move the selected figures to the left. try { oldTime = e.getWhen(); clone = (Draw)mainFrame.getDrawPanel().getDraw().getSelected().clone(); } catch(CloneNotSupportedException e1) { clone = null; } mainFrame.getDrawPanel().moveSelectedFiguresHorizontally(-1); return ; } return ; } if(key==KeyEvent.VK_UP) { if(e.getModifiers()==0)// up arrow = move the vertical scrollbar to the top. { mainFrame.getDrawPanel().moveVerticalScrollbar(-INTERVAL_SCROLLBAR); return ; } if(e.getModifiers()==InputEvent.CTRL_MASK) {// up arrow + ctrl = move strongly the vertical scrollbar to the top. mainFrame.getDrawPanel().moveVerticalScrollbar(-mainFrame.getDrawPanel().getWidth()); return ; } if(e.getModifiers()==(InputEvent.CTRL_MASK+InputEvent.SHIFT_MASK)) {// up arrow + ctrl + shift = move at the beginning of the vertical scrollbar. mainFrame.getDrawPanel().getVerticalScrollBar().setValue( mainFrame.getDrawPanel().getHorizontalScrollBar().getMinimum()); return ; } if(e.getModifiers()==InputEvent.ALT_MASK) {// alt + right arrow = move the selected figures to the top. try { oldTime = e.getWhen(); clone = (Draw)mainFrame.getDrawPanel().getDraw().getSelected().clone(); } catch(CloneNotSupportedException e1) { clone = null; } mainFrame.getDrawPanel().moveSelectedFiguresVertically(-1); return ; } return ; } if(key==KeyEvent.VK_DOWN) { if(e.getModifiers()==0)// down arrow = move the vertical scrollbar to the bottom. { mainFrame.getDrawPanel().moveVerticalScrollbar(INTERVAL_SCROLLBAR); return ; } if(e.getModifiers()==InputEvent.CTRL_MASK) {// down arrow + ctrl = move strongly the vertical scrollbar to the bottom. mainFrame.getDrawPanel().moveVerticalScrollbar(mainFrame.getDrawPanel().getWidth()); return ; } if(e.getModifiers()==(InputEvent.CTRL_MASK+InputEvent.SHIFT_MASK)) {// down arrow + ctrl + shift = move at the end of the horizontal scrollbar. mainFrame.getDrawPanel().getVerticalScrollBar().setValue( mainFrame.getDrawPanel().getHorizontalScrollBar().getMaximum()); return ; } if(e.getModifiers()==InputEvent.ALT_MASK) {// alt + right arrow = move the selected figures to the bottom. try { oldTime = e.getWhen(); clone = (Draw)mainFrame.getDrawPanel().getDraw().getSelected().clone(); } catch(CloneNotSupportedException e1) { clone = null; } mainFrame.getDrawPanel().moveSelectedFiguresVertically(1); return ; } return ; } } public void keyReleased(KeyEvent e) { if(clone!=null && e.getWhen()-oldTime>100) { Draw selection = mainFrame.getDrawPanel().getDraw().getSelected(); if(selection!=null && !selection.isEmpty()) { Vector
figures = mainFrame.getDrawPanel().getDraw().getFigures(); int[] id = new int[selection.size()]; for(int i=0, size=selection.size(); i * This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/21/08
* @author Arnaud BLOUIN
* @version 2.0.0
* @since 1.9
*/ public class InstallerListener implements ActionListener { protected InstallerUI installer; protected JFileChooser fileChooser; public InstallerListener(InstallerUI installerUI) { if(installerUI==null) throw new IllegalArgumentException(); installer = installerUI; fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setMultiSelectionEnabled(false); } public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if(o instanceof JButton) { String actionCmd = ((JButton)o).getActionCommand(); if(actionCmd==null) return ; if(actionCmd.equals(InstallerUI.ACTION_CANCEL)) { if(installer.isContinueInstall()) installer.setContinueInstall(false); else System.exit(0); return ; } if(actionCmd.equals(InstallerUI.ACTION_TERMINATE)) { System.exit(0); return ; } if(actionCmd.equals(InstallerUI.ACTION_NEXT)) { installer.incrementSlidePosition(); return ; } if(actionCmd.equals(InstallerUI.ACTION_PREVIOUS)) { installer.decrementSlidePosition(); return ; } if(actionCmd.equals(InstallerUI.ACTION_CHOOSE_FOLDER)) { int id = fileChooser.showDialog(installer, "Select"); if(id == JFileChooser.APPROVE_OPTION) installer.setPathInstall(fileChooser.getSelectedFile().getPath()); return ; } return ; } } } latexdraw-2.0.8+1.orig/latexDraw/ui/CodePanel.java0000644000000000000000000004620211347255510016551 0ustar package latexDraw.ui; import java.awt.BorderLayout; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.ClipboardOwner; import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.Transferable; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.ObjectInputStream; import javax.swing.*; import latexDraw.lang.LaTeXDrawLang; import latexDraw.ui.codeEditorPane.AbstractCodeEditorPane; import latexDraw.ui.codeEditorPane.PSTricksEditorPane; import latexDraw.ui.components.CloseButton; import latexDraw.util.LaTeXDrawNamespace; import latexDraw.util.LaTeXDrawPoint2D; import latexDraw.util.LaTeXDrawResources; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * Defines the panel which contains the code generated from the drawing.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 06/03/07
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class CodePanel extends JPanel implements ActionListener, ClipboardOwner { private static final long serialVersionUID = 1L; /** The comments of the user */ private String comments; /** The label of the drawing */ private String label; /** The caption of the drawing */ private String caption; /** The main frame of the program */ private LaTeXDrawFrame mainFrame; /** The token of the position of the drawing */ private String positionVertToken; /** The horizontal position of the drawing */ private String positionHoriToken; /** The latex packages needed for the compilation of the drawing. */ protected String documentPackages; public static final String TOKEN_HORI_CENTER_START = "\\begin{center}\n"; //$NON-NLS-1$ public static final String TOKEN_HORI_CENTER_END = "\\end{center}\n"; //$NON-NLS-1$ public static final String TOKEN_HORI_VERT_DEFAULT = ""; //$NON-NLS-1$ public static final boolean DEFAULT_ISONFLOATSPAGE = false; public static final String TOKEN_VERT_TOP = "t"; //$NON-NLS-1$ public static final String TOKEN_VERT_BOTTOM = "b"; //$NON-NLS-1$ public static final String TOKEN_VERT_FLOATS_PAGE = "p"; //$NON-NLS-1$ public static final String TOKEN_VERT_HERE = "h"; //$NON-NLS-1$ public static final String TOKEN_VERT_HERE_HERE = "H"; //$NON-NLS-1$ /** Defines the number of characters added at the beginning * of each lines of the comments (these characters are "% ")*/ public static final int LGTH_START_LINE_COMMENT = 2; /** The label of the button reload */ public static final String LABEL_RELOAD = LaTeXDrawLang.getOthersString("CodePanel.reload"); //$NON-NLS-1$ /** The label of the check-box autoUpdate */ public static final String LABEL_AUTO_UPDATE = LaTeXDrawLang.getOthersString("CodePanel.autoUpdate"); //$NON-NLS-1$ /** Allows to know if the code must be update in real time by default */ public static final boolean DEFAULT_AUTO_UPDATE = true; /** The label of the button buttonCopySel */ public static final String LABEL_COPY_SELECTION_CODE = LaTeXDrawLang.getOthersString("CodePanel.copySel"); //$NON-NLS-1$ /** The label of the button which copy all the text in the clipboard */ public static final String LABEL_COPY_ALL = LaTeXDrawLang.getOthersString("CodePanel.copyAll"); //$NON-NLS-1$ public static final String LABEL_COPY_SELECTED_FIG = "Select code of selected figures"; //$NON-NLS-1$ /** This button allows the user to copy the selected text in the clipboard */ protected JButton buttonCopySel; /** Allows to know if the user wants to update in real time the code or not */ protected JCheckBox autoUpdateCB; /** This button allows the user to update the code */ protected JButton reloadButton; /** Allows to add comments to the code */ protected JButton commentsButton; protected AbstractCodeEditorPane editor; /** The constructor by default */ public CodePanel(LaTeXDrawFrame parent) { mainFrame = parent; positionHoriToken = TOKEN_HORI_VERT_DEFAULT; label = "";//$NON-NLS-1$ caption = "";//$NON-NLS-1$ positionVertToken = "";//$NON-NLS-1$ editor = new PSTricksEditorPane(this); JScrollPane scroller = new JScrollPane(); JViewport vp = scroller.getViewport(); vp.add(editor); JToolBar toolbar = new JToolBar("Code toolbar"); //$NON-NLS-1$ toolbar.setFloatable(false); autoUpdateCB = new JCheckBox(LABEL_AUTO_UPDATE); autoUpdateCB.setMargin(LaTeXDrawFrame.INSET_BUTTON); autoUpdateCB.setToolTipText(LaTeXDrawLang.getOthersString("CodePanel.tip")); //$NON-NLS-1$ autoUpdateCB.setActionCommand(LABEL_AUTO_UPDATE); autoUpdateCB.setSelected(DEFAULT_AUTO_UPDATE); toolbar.add(autoUpdateCB); autoUpdateCB.addActionListener(this); reloadButton = new JButton(LaTeXDrawResources.reloadIcon); reloadButton.setMargin(LaTeXDrawFrame.INSET_BUTTON); reloadButton.setToolTipText(LaTeXDrawLang.getOthersString("CodePanel.updateCode")); //$NON-NLS-1$ reloadButton.setActionCommand(LABEL_RELOAD); reloadButton.setEnabled(!DEFAULT_AUTO_UPDATE); toolbar.add(reloadButton); reloadButton.addActionListener(this); commentsButton = new JButton(LaTeXDrawResources.commentIcon); commentsButton.setMargin(LaTeXDrawFrame.INSET_BUTTON); commentsButton.setToolTipText(LaTeXDrawLang.getOthersString("CodePanel.addComment")); //$NON-NLS-1$ commentsButton.setActionCommand(LaTeXDrawResources.LABEL_COMMENTS); commentsButton.addActionListener(mainFrame); toolbar.add(commentsButton); JButton but = new JButton(LaTeXDrawResources.copyIcon); but.setMargin(LaTeXDrawFrame.INSET_BUTTON); but.setToolTipText(LABEL_COPY_ALL); but.setActionCommand(LABEL_COPY_ALL); toolbar.add(but); but.addActionListener(this); buttonCopySel = new JButton(LaTeXDrawResources.copySelIcon); buttonCopySel.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonCopySel.setToolTipText(LABEL_COPY_SELECTION_CODE); buttonCopySel.setActionCommand(LABEL_COPY_SELECTION_CODE); buttonCopySel.setEnabled(false); toolbar.add(buttonCopySel); buttonCopySel.addActionListener(this); JToolBar toolbar2 = new JToolBar(); toolbar2.setFloatable(false); CloseButton closeB = new CloseButton(this); closeB.addActionListener(mainFrame); closeB.setActionCommand(LaTeXDrawResources.LABEL_DISPLAY_CODE_PANEL); toolbar2.add(closeB); JPanel p = new JPanel(); p.setLayout(new BorderLayout()); p.add(toolbar2,BorderLayout.EAST); p.add(toolbar,BorderLayout.WEST); setLayout(new BorderLayout()); add(p, BorderLayout.NORTH); add(scroller, BorderLayout.CENTER); comments = "";//$NON-NLS-1$ } /** * Allows to get the comments without any characters like "%" * at the start of each lines. (these characters are used like comment symbol by LaTeX). * @return The code without LaTeX comment symbol '%' */ public String getCommentsWithoutTag() { if(comments!=null) { int i=0, j=0, lgth = comments.length(); char buffer[] = new char[lgth]; boolean eol = true; while(i1) return str.substring(0, str.length()-System.getProperty("line.separator").length());//$NON-NLS-1$ return str; } return null; } /** * Allows to get the comments of the code * @return The comments of the code */ public String getComments() { return comments; } /** * Empty the panel. */ public void setEmpty() { comments=""; //$NON-NLS-1$ editor.setEmpty(); } /** * Allow to set the comments of the code * @param newComments The new comments of the code */ public void setComments(String newComments) { if(newComments!=null && newComments.length()>0) { int i, j=0, lgth = newComments.length(); char buffer[] = new char[lgth*3]; boolean eol = true; for(i=0; i0) { mainFrame.setStatusBarText(LaTeXDrawLang.getOthersString("CodePanel.copiedSelText")); //$NON-NLS-1$ copyTextToClipBoard(code); } mainFrame.requestFocus(); return ; } } // if(o instanceof JButton) } /** * Allows to copy a text in the clipboard * @param text The text to copy */ public void copyTextToClipBoard(String text) { Clipboard cb = getToolkit().getSystemClipboard(); cb.setContents(new StringSelection(text), this); } /** * Allows to know if the code must be update in real time or not * @return True if the code must be update in real time */ public boolean isInAutoUpdate() { return autoUpdateCB.isSelected(); } /** * Allows to set if the code panel must be displayed * @param isIn If true, the code panel must be displayed */ public void setIsInAutoUpdate(boolean isIn) { if(isIn!=isInAutoUpdate()) mainFrame.getDrawPanel().setIsModified(true); autoUpdateCB.setSelected(isIn); updateAutoUpdateComponents(); } /** * Allows to update components which depends of the checkbox "autoUpdateCB" */ protected void updateAutoUpdateComponents() { if(autoUpdateCB.isSelected()) { mainFrame.menuBar.getMenuReloadCode().setEnabled(false); reloadButton.setEnabled(false); mainFrame.getDrawPanel().updateCode(); } else { reloadButton.setEnabled(true); mainFrame.menuBar.getMenuReloadCode().setEnabled(true); } } /** * Allows to get the text of the editor * @return The text of the editor */ public String getText() { return editor.getText(); } /** * @return Returns the caption. */ public String getCaption() { return caption; } /** * @param caption The caption to set. */ public void setCaption(String caption) { this.caption = caption; } /** * @return Returns the label. */ public String getLabel() { return label; } /** * @param label The label to set. */ public void setLabel(String label) { this.label = label; } /** * @return Returns the positionVertToken. */ public String getPositionVertToken() { return positionVertToken; } /** * @param positionToken The positionVertToken to set. */ public void setPositionVertToken(String positionToken) { if(positionToken.equals(TOKEN_VERT_BOTTOM) || positionToken.equals(TOKEN_VERT_FLOATS_PAGE) || positionToken.equals(TOKEN_VERT_HERE) || positionToken.equals(TOKEN_VERT_HERE_HERE) || positionToken.equals(TOKEN_VERT_TOP)) positionVertToken = positionToken; else positionVertToken = TOKEN_HORI_VERT_DEFAULT; } /** * @return Returns the positionHoriToken. */ public String getPositionHoriToken() { return positionHoriToken; } /** * @param positionHori The positionHoriToken to set. */ public void setPositionHoriToken(String positionHori) { positionHoriToken = positionHori; } public void lostOwnership(Clipboard cb, Transferable t) { /* * No code required. */ } /** * Actions to do when a new project is created. * @since 1.9 */ public void newProject() { positionHoriToken = TOKEN_HORI_VERT_DEFAULT; positionVertToken = TOKEN_HORI_VERT_DEFAULT; label = "";//$NON-NLS-1$ caption = "";//$NON-NLS-1$ } /** * @return the mainFrame. * @since 1.9 */ public LaTeXDrawFrame getMainFrame() { return mainFrame; } /** * @return the buttonCopySel. * @since 2.0.0 */ public JButton getButtonCopySel() { return buttonCopySel; } /** * Set the beginning of the code generated. * @param SW The top right point. * @param NE The bottom left point. * @param pixelsPerCm The definition level of the drawing. * @param origin The origin point of the system of coordinates. */ public void setStart(LaTeXDrawPoint2D SW, LaTeXDrawPoint2D NE, int pixelsPerCm, LaTeXDrawPoint2D origin) { editor.setStart(SW, NE, pixelsPerCm, origin); } /** * Set the body (between the beginning and the end) of the code. * @param code The new code. */ public void setBody(String code) { editor.setBody(code); } public AbstractCodeEditorPane getEditor() { return editor; } /** * Update the text of the panel. */ public void updateText() { editor.updateText(); } /** * Sets the XML element "meta" with the parameters of the code panel. * @param document The XML document. * @param meta The Element to fill. * @throws IllegalArgumentException If meta or document is null. * @since 2.0.0 */ public void getXMLMetadata(Document document, Element meta) { if(document==null || meta==null) throw new IllegalArgumentException(); if(documentPackages!=null && documentPackages.length()!=0) { Element cap = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_LATEX_INCLUDES); cap.appendChild(document.createCDATASection(documentPackages)); meta.appendChild(cap); } if(caption!=null && caption.length()!=0) { Element cap = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_CAPTION); cap.appendChild(document.createCDATASection(caption)); meta.appendChild(cap); } if(label!=null && label.length()!=0) { Element lab = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_LABEL); lab.appendChild(document.createCDATASection(label)); meta.appendChild(lab); } if(positionHoriToken!=null && positionHoriToken.length()!=0) { Element tok = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_POSITION_HORIZ); tok.appendChild(document.createTextNode(positionHoriToken)); meta.appendChild(tok); } if(positionVertToken!=null && positionVertToken.length()!=0) { Element tok = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_POSITION_VERT); tok.appendChild(document.createTextNode(positionVertToken)); meta.appendChild(tok); } if(comments!=null && comments.length()!=0) { Element comm = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_COMMENTS); comm.appendChild(document.createCDATASection(getCommentsWithoutTag())); meta.appendChild(comm); } Element auto = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_AUTO_UPDATE); auto.appendChild(document.createTextNode(String.valueOf(isInAutoUpdate()))); meta.appendChild(auto); } /** * Sets the latexdraw parameters from the metadata SVG tag. * @param nl The list of the parameters. * @since 2.0.0 */ public void setXMLMetadata(NodeList nl) { if(nl==null) return ; Node n; String name; for(int i=0, size = nl.getLength(); i *
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public final class LaTeXDraw { /** * The main function. * @param args The parameters given during the call of the program. */ public static void main(String[] args) { try { // Create the frame of the application. LaTeXDrawFrame frame = new LaTeXDrawFrame(args, true); if(!System.getProperty("os.name").equals("Linux"))//$NON-NLS-1$//$NON-NLS-2$ frame.setVisible(true); }catch(NoClassDefFoundError ex) { System.err.println(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.83"));//$NON-NLS-1$ System.err.println("One or several files are missing; reinstall LaTeXDraw to fix it."); //$NON-NLS-1$ ex.printStackTrace(); System.exit(-1); } } } latexdraw-2.0.8+1.orig/latexDraw/ui/SplashScreen.java0000644000000000000000000000661611347255510017316 0ustar package latexDraw.ui; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Image; import java.awt.MediaTracker; import java.awt.Toolkit; import javax.swing.JProgressBar; import javax.swing.JWindow; import javax.swing.SwingUtilities; import javax.swing.UIManager; import latexDraw.ui.components.DisplayCanvas; import latexDraw.ui.dialog.ExceptionFrameDialog; /** * This class defines a splash screen displayed during the start of the program with a progress * bar showing us the progression of the loading of the LaTeXDraw interface.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 09/13/06
* @author Arnaud BLOUIN
* @version 2.0.0
* @since 1.9
*/ public class SplashScreen extends JWindow { private static final long serialVersionUID = 1L; /** The progress bar showing us the progression of the loading of the LaTeXDraw interface.*/ JProgressBar progressBar; /** * The constructor by default. * @param lookAndFeel the class of the look and feel; default LaF if null. */ public SplashScreen(String lookAndFeel) { try { try { if(lookAndFeel==null) UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); else UIManager.setLookAndFeel(lookAndFeel); }catch(Exception ex) {/* Tant pis ! */} Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); progressBar = new JProgressBar(0, 100); Image i = Toolkit.getDefaultToolkit().getImage( getClass().getClassLoader().getResource("res/LaTeXDrawSmall.png"));//$NON-NLS-1$ MediaTracker tracker=new MediaTracker(this); tracker.addImage(i,0); try { tracker.waitForID(0); } catch(InterruptedException e) { e.printStackTrace(); } setLayout(new BorderLayout()); getContentPane().add(new DisplayCanvas(i), BorderLayout.CENTER); getContentPane().add(progressBar, BorderLayout.SOUTH); setLocation((dim.width-i.getWidth(null))/2, (dim.height-i.getHeight(null))/2); setSize(i.getWidth(null), i.getHeight(null)+15); }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } /** * Increment the progress bar. * @param increment The value to add to the progress bar. */ public void addToProgressBar(int increment) { final int cpt = progressBar.getValue()+increment; if(cpt>=progressBar.getMinimum() && cpt<=progressBar.getMaximum()) try { SwingUtilities.invokeAndWait(new Runnable() { public void run() {updateBar(cpt);} }); } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } /** * Allows to update the progress bar. * @param newValue its new value. */ protected synchronized void updateBar(int newValue) { progressBar.setValue(newValue); } } latexdraw-2.0.8+1.orig/latexDraw/ui/components/0000755000000000000000000000000011347255510016235 5ustar latexdraw-2.0.8+1.orig/latexDraw/ui/components/Delimitor.java0000644000000000000000000001646611347255510021045 0ustar package latexDraw.ui.components; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Point; import java.awt.geom.Rectangle2D; import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; import latexDraw.util.LaTeXDrawPoint2D; /** * A delimiter delimits figures in the draw panel.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 06/26/07
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class Delimitor implements Serializable, Cloneable { private static final long serialVersionUID = 1L; public static final int DEFAULT_OPACITY = 130; /** The coordinates of the centre of the delimiter */ protected LaTeXDrawPoint2D center; /** The thickness of the delimiters */ public static final int THICKNESS = 2; /** The dimension of the delimiter */ protected double dim = 8.; /** The opacity of the delimiters. Can be changed. */ private static int opacity = DEFAULT_OPACITY; /** A possible colour for the interior of the delimiter */ public static final Color INTERIOR = new Color(153, 153, 204, opacity); /** A possible colour for the interior of the delimiter */ public static final Color INTERIOR_2 = new Color(204, 133, 133, opacity); /** A possible colour for the interior of the delimiter */ public static final Color INTERIOR_3 = new Color(150, 98, 144, opacity); /** A possible colour for the interior of the delimiter */ public static final Color INTERIOR_4 = new Color(60, 160, 115, opacity); private static final BasicStroke STROKE = new BasicStroke(2, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER); /** The colour of the interior of the delimiter */ private Color interior; /** * The constructor by default */ public Delimitor() { this(new LaTeXDrawPoint2D()); } /** * The constructor * @param p The location of the delimiter */ public Delimitor(LaTeXDrawPoint2D p) { center = p==null ? new LaTeXDrawPoint2D() : p; interior = INTERIOR; } /** * Allows to change the centre * @param c The new centre */ public synchronized void setCenter(LaTeXDrawPoint2D c) { if(c==null) throw new IllegalArgumentException(); center = c; } /** * Allows to change to change the colours of the delimiter */ public synchronized void setColorSet1() { interior = new Color(INTERIOR.getRed(), INTERIOR.getGreen(), INTERIOR.getBlue(), opacity); } /** * Allows to change to change the colours of the delimiter */ public synchronized void setColorSet2() { interior = new Color(INTERIOR_2.getRed(), INTERIOR_2.getGreen(), INTERIOR_2.getBlue(), opacity); } /** * Allows to change to change the colours of the delimiter */ public synchronized void setColorSet3() { interior = new Color(INTERIOR_3.getRed(), INTERIOR_3.getGreen(), INTERIOR_3.getBlue(), opacity); } /** * Allows to change to change the colours of the delimiter */ public synchronized void setColorSet4() { interior = new Color(INTERIOR_4.getRed(), INTERIOR_4.getGreen(), INTERIOR_4.getBlue(), opacity); } /** * Allows to set the width of the delimiter * @param dim Its new width */ public synchronized void setDim(double dim) { if(dim<=0) throw new IllegalArgumentException(); this.dim = dim; } /** * Allows to get the X-coordinate of the delimiter * @return The X-coordinate */ public double getX() { return center.getX(); } /** * Allows to access to the centre of the delimiter * @return The centre of the delimiter */ public synchronized LaTeXDrawPoint2D getCenter() { return center; } /** * Allows to get the Y-coordinate of the delimiter * @return The Y-coordinate */ public double getY() { return center.getY(); } /** * This method allows to draw the delimiter. * @param g The Graphics of the panel where the delimiter must be drawn */ public void draw(Graphics2D g) { double demiDim = dim/2.; if(opacity!=interior.getTransparency()) interior = new Color(interior.getRed(), interior.getGreen(),interior.getBlue(), opacity); g.setStroke(STROKE); g.setColor(interior); g.fill(new Rectangle2D.Double(center.x-demiDim, center.y-demiDim, dim, dim)); } /** * Allows the change the coordinate of the delimiter * @param p The new centre of the delimiter */ public synchronized void setCoordinates(LaTeXDrawPoint2D p) { if(p==null) throw new IllegalArgumentException(); setCoordinates(p.x, p.y); } /** * Allows the change the coordinate of the delimiter * @param x The X-coordinate of the new position * @param y The Y-coordinate of the new position */ public synchronized void setCoordinates(double x, double y) { center.setLocation(x, y); } /** * Allows to know if the point pt is in the delimiter * @param pt The point which we want to know if it's in the delimiter * @return true if it is in the delimiter and else false */ public boolean isIn(LaTeXDrawPoint2D pt) { if(pt==null) return false; return pt.x>=center.x-dim/2. && pt.x<=center.x+dim/2. && pt.y>=center.y-dim/2. && pt.y<=center.y+dim/2.; } /** * Allows to know if the point pt is in the delimiter * @param pt The point which we want to know if it's in the delimiter * @return true if it is in the delimiter and else false */ public boolean isIn(Point pt) { if(pt==null) return false; return isIn(new LaTeXDrawPoint2D(pt.x, pt.y)); } @Override public Object clone() throws CloneNotSupportedException { Delimitor d =(Delimitor) super.clone(); d.center = (LaTeXDrawPoint2D)center.clone(); d.dim = dim; d.interior = interior; return d; } private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { ois.readObject();// The two other colours that are no more used. ois.readObject(); interior = (Color) ois.readObject(); center = (LaTeXDrawPoint2D) ois.readObject(); dim = ois.readDouble(); } /** * @return the dim */ public synchronized double getDim() { return dim; } /** * @return the opacity. */ public static synchronized int getOpacity() { return opacity; } /** * @param opacity the opacity to set. */ public static void setOpacity(int opacity) { if(opacity<0 || opacity>255) throw new IllegalArgumentException(); Delimitor.opacity = opacity; } /** * @return the interior. * @since 2.0.0 */ public synchronized Color getInterior() { return interior; } } latexdraw-2.0.8+1.orig/latexDraw/ui/components/LMenuBar.java0000644000000000000000000012230611347255510020551 0ustar /* * LMenuBar.java */ package latexDraw.ui.components; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.util.Vector; import javax.swing.ButtonGroup; import javax.swing.JCheckBoxMenuItem; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JRadioButtonMenuItem; import javax.swing.KeyStroke; import latexDraw.lang.LaTeXDrawLang; import latexDraw.ui.CodePanel; import latexDraw.ui.DrawPanel; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.ui.dialog.ExceptionFrameDialog; import latexDraw.ui.listeners.MenusListener; import latexDraw.ui.listeners.RecentFilesListener; import latexDraw.util.LaTeXDrawResources; /** * Defines the latexdraw menu bar..
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 09/22/07
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class LMenuBar extends JMenuBar { private static final long serialVersionUID = 1L; /** The menu which allows to import templates */ protected MenuTemplate menuTemplate; /** Allows to cut a figure */ protected JMenuItem cutMenu; /** Allows to paste a figure */ protected JMenuItem pasteMenu; /** Allows to copy a figure */ protected JMenuItem copyMenu; /** This menu allows to export the drawing as a template */ protected JMenuItem exportTemplateMenu; /** Allows to undo actions */ protected JMenuItem undoMenu; /** Allows to redo actions */ protected JMenuItem redoMenu; /** This menu allows the user to export either the pstricks code or the drawing as jpg picture */ protected JMenu exportAsMenu; protected JMenu recentFilesMenu; /** The menu "drawing" */ protected JMenu drawMenu; /** This menu allows the user to set his preferences */ protected JMenuItem preferencesMenu; /** This menu allows the set the properties of the selected figure */ protected JMenuItem propertiesFigureMenu; /** This menu allows the user to delete a figure in the drawing. */ protected JMenuItem deleteFigure; /** This menu allows the user to see or not the borders of the drawing */ protected JCheckBoxMenuItem displayBorders; /** This menu allows the user to see or not the X-scale */ protected JCheckBoxMenuItem displayXScale; /** This menu allows the user to see or not the Y-scale */ protected JCheckBoxMenuItem displayYScale; /** This menu allows the user to see or not the grids */ protected JCheckBoxMenuItem displayGrid; protected JCheckBoxMenuItem displayPersoGrid; /** This menu allows the user to set visible or not the code panel */ protected JCheckBoxMenuItem displayCodePanel; /** This menu allows to activate the automatic adjustment of the borders of the drawing */ protected JCheckBoxMenuItem autoAdjustBorders; /** The button of the menubar to draw polygons */ protected JRadioButtonMenuItem menuPoly; /** The button of the menubar to draw lines */ protected JRadioButtonMenuItem menuLine; /** The button of the menubar to draw rectangles */ protected JRadioButtonMenuItem menuRect; /** The button of the menubar to draw squares */ protected JRadioButtonMenuItem menuSquare; /** The button of the menubar to draw dots */ protected JRadioButtonMenuItem menuDot; /** The button of the menubar to draw rhombus */ protected JRadioButtonMenuItem menuRhombus; /** The button of the menubar to draw triangles */ protected JRadioButtonMenuItem menuTriangle; /** The button of the menubar to draw joined lines */ protected JRadioButtonMenuItem menuJoinedLines; /** The button of the menubar to draw circles */ protected JRadioButtonMenuItem menuCircle; protected JRadioButtonMenuItem menuAxes; /** The button of the menubar to draw chords */ protected JRadioButtonMenuItem menuChord; /** The button of the menubar to draw ellipses */ protected JRadioButtonMenuItem menuEllipse; /** The button of the menubar to draw Bézier curves */ protected JRadioButtonMenuItem menuBezierCurve; protected JRadioButtonMenuItem menuClosedBezierCurve; /** The button of the menubar to select figures */ protected JRadioButtonMenuItem menuSelect; /** The button of the menubar to draw arcs */ protected JRadioButtonMenuItem menuArc; /** The button of the menubar to draw wedges */ protected JRadioButtonMenuItem menuWedge; /** The button of the menubar to draw texts */ protected JRadioButtonMenuItem menuText; /** The button of the menubar to draw akin points */ protected JRadioButtonMenuItem menuPointsAkin; /** The button of the menubar to draw grids */ protected JRadioButtonMenuItem menuGrid; protected JCheckBoxMenuItem menuAutoUpdate; protected JMenuItem menuReloadCode; protected JMenuItem updateToGridMenu; protected LaTeXDrawFrame parentFrame; public LMenuBar(LaTeXDrawFrame p) { super(); if(p==null) throw new IllegalArgumentException(); parentFrame = p; MenusListener ml = parentFrame.getMenuListener(); ButtonGroup drawMenuGroup = new ButtonGroup(); JMenu fileMenu = new JMenu(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.88")); //$NON-NLS-1$ JMenu editMenu = new JMenu(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.89")); //$NON-NLS-1$ JMenu displayM = new JMenu(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.90")); //$NON-NLS-1$ drawMenu = new JMenu(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.91")); //$NON-NLS-1$ JMenu insertMenu = new JMenu(LaTeXDrawLang.getString1_6("LaTeXDrawFrame.10")); //$NON-NLS-1$ JMenu codeMenu = new JMenu(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.92")); //$NON-NLS-1$ JMenu helpMenu = new JMenu(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.93")); //$NON-NLS-1$ JMenuItem menu; undoMenu = new JMenuItem(LaTeXDrawResources.LABEL_UNDO, KeyEvent.VK_Z); undoMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z,InputEvent.CTRL_MASK)); undoMenu.setIcon(LaTeXDrawResources.undoIcon); undoMenu.addActionListener(ml); undoMenu.setActionCommand(LaTeXDrawResources.LABEL_UNDO); editMenu.add(undoMenu); redoMenu = new JMenuItem(LaTeXDrawResources.LABEL_REDO, KeyEvent.VK_Y); redoMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Y,InputEvent.CTRL_MASK)); redoMenu.setIcon(LaTeXDrawResources.redoIcon); redoMenu.addActionListener(ml); redoMenu.setActionCommand(LaTeXDrawResources.LABEL_REDO); editMenu.add(redoMenu); editMenu.addSeparator(); copyMenu = new JMenuItem(LaTeXDrawResources.LABEL_COPY, KeyEvent.VK_C); copyMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,InputEvent.CTRL_MASK)); copyMenu.setIcon(LaTeXDrawResources.copyIcon); copyMenu.addActionListener(ml); copyMenu.setActionCommand(LaTeXDrawResources.LABEL_COPY); editMenu.add(copyMenu); copyMenu.setEnabled(false); cutMenu = new JMenuItem(LaTeXDrawResources.LABEL_CUT, KeyEvent.VK_X); cutMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,InputEvent.CTRL_MASK)); cutMenu.setIcon(LaTeXDrawResources.cutIcon); cutMenu.addActionListener(ml); cutMenu.setActionCommand(LaTeXDrawResources.LABEL_CUT); editMenu.add(cutMenu); cutMenu.setEnabled(false); pasteMenu = new JMenuItem(LaTeXDrawResources.LABEL_PASTE, KeyEvent.VK_V); pasteMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,InputEvent.CTRL_MASK)); pasteMenu.setIcon(LaTeXDrawResources.pasteIcon); pasteMenu.addActionListener(ml); pasteMenu.setActionCommand(LaTeXDrawResources.LABEL_PASTE); editMenu.add(pasteMenu); pasteMenu.setEnabled(false); menu = new JMenuItem(LaTeXDrawResources.LABEL_NEW, KeyEvent.VK_N); menu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,InputEvent.CTRL_MASK)); menu.setIcon(LaTeXDrawResources.newIcon); menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_NEW); fileMenu.add(menu); menu = new JMenuItem(LaTeXDrawResources.LABEL_NEW_WITH_SEL); menu.setIcon(LaTeXDrawResources.newIcon); menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_NEW_WITH_SEL); fileMenu.add(menu); menu = new JMenuItem(LaTeXDrawResources.LABEL_OPEN, KeyEvent.VK_O); menu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O,InputEvent.CTRL_MASK)); menu.setIcon(LaTeXDrawResources.openIcon); menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_OPEN); fileMenu.add(menu); menu = new JMenuItem(LaTeXDrawResources.LABEL_SAVE, KeyEvent.VK_S); menu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,InputEvent.CTRL_MASK)); menu.setIcon(LaTeXDrawResources.saveIcon); menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_SAVE); fileMenu.add(menu); menu = new JMenuItem(LaTeXDrawResources.LABEL_SAVE_AS, KeyEvent.VK_A); menu.setIcon(LaTeXDrawResources.saveAsIcon); menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_SAVE_AS); fileMenu.add(menu); recentFilesMenu = new JMenu(LaTeXDrawResources.LABEL_RECENT_FILES); recentFilesMenu.setIcon(LaTeXDrawResources.emptyIcon); recentFilesMenu.setActionCommand(LaTeXDrawResources.LABEL_RECENT_FILES); fileMenu.add(recentFilesMenu); fileMenu.addSeparator(); JMenu importM = new JMenu(LaTeXDrawResources.LABEL_IMPORT); importM.setIcon(LaTeXDrawResources.importIcon); fileMenu.add(importM); menu = new JMenuItem(LaTeXDrawResources.LABEL_IMPORT_TEX, KeyEvent.VK_X); menu.setIcon(LaTeXDrawResources.insertPSTricksIcon); menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_IMPORT_TEX); importM.add(menu); exportAsMenu = new JMenu(LaTeXDrawResources.LABEL_EXPORT_AS); exportAsMenu.setIcon(LaTeXDrawResources.exportIcon); fileMenu.add(exportAsMenu); exportAsMenu.setEnabled(false); menu = new JMenuItem(LaTeXDrawResources.LABEL_EXPORT_TRICKS, KeyEvent.VK_T); menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_EXPORT_TRICKS); exportAsMenu.add(menu); menu = new JMenuItem(LaTeXDrawResources.LABEL_EXPORT_JPG, KeyEvent.VK_J); menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_EXPORT_JPG); exportAsMenu.add(menu); menu = new JMenuItem(LaTeXDrawResources.LABEL_EXPORT_PNG, KeyEvent.VK_P); menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_EXPORT_PNG); exportAsMenu.add(menu); menu = new JMenuItem(LaTeXDrawResources.LABEL_EXPORT_EPS, KeyEvent.VK_E); menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_EXPORT_EPS); exportAsMenu.add(menu); menu = new JMenuItem(LaTeXDrawResources.LABEL_EXPORT_BMP, KeyEvent.VK_B); menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_EXPORT_BMP); exportAsMenu.add(menu); menu = new JMenuItem(LaTeXDrawResources.LABEL_EXPORT_PPM, KeyEvent.VK_N); menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_EXPORT_PPM); exportAsMenu.add(menu); menu = new JMenuItem("eps (latex) picture", KeyEvent.VK_S); menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_EXPORT_EPS_LATEX); exportAsMenu.add(menu); menu = new JMenuItem("pdf (latex) picture", KeyEvent.VK_F); menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_EXPORT_PDF_LATEX); exportAsMenu.add(menu); menu = new JMenuItem("pdf (latex+pdfcrop) picture", KeyEvent.VK_C); menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_EXPORT_PDF_LATEX_CROP); exportAsMenu.add(menu); exportTemplateMenu = new JMenuItem(LaTeXDrawResources.LABEL_TEMPLATE_EXPORT); exportTemplateMenu.addActionListener(ml); exportTemplateMenu.setActionCommand(LaTeXDrawResources.LABEL_TEMPLATE_EXPORT); exportAsMenu.add(exportTemplateMenu); exportTemplateMenu.setEnabled(false); fileMenu.addSeparator(); menu = new JMenuItem(LaTeXDrawResources.LABEL_BATCH_CONVERT, KeyEvent.VK_V); menu.addActionListener(ml); menu.setIcon(LaTeXDrawResources.copyIcon); menu.setActionCommand(LaTeXDrawResources.LABEL_BATCH_CONVERT); fileMenu.add(menu); fileMenu.addSeparator(); preferencesMenu = new JMenuItem(LaTeXDrawResources.LABEL_PREFERENCES, KeyEvent.VK_P); preferencesMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P,InputEvent.CTRL_MASK)); preferencesMenu.setIcon(LaTeXDrawResources.preferencesIcon); preferencesMenu.addActionListener(parentFrame); preferencesMenu.setActionCommand(LaTeXDrawResources.LABEL_PREFERENCES); fileMenu.add(preferencesMenu); fileMenu.addSeparator(); menu = new JMenuItem(LaTeXDrawResources.LABEL_PRINT_CODE, KeyEvent.VK_E); menu.setIcon(LaTeXDrawResources.printIcon); menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_PRINT_CODE); fileMenu.add(menu); menu = new JMenuItem(LaTeXDrawResources.LABEL_PRINT_DRAW, KeyEvent.VK_D); menu.setIcon(LaTeXDrawResources.printIcon); menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_PRINT_DRAW); fileMenu.add(menu); fileMenu.addSeparator(); menu = new JMenuItem(LaTeXDrawResources.LABEL_QUIT, KeyEvent.VK_Q); menu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W,InputEvent.CTRL_MASK)); menu.setIcon(LaTeXDrawResources.emptyIcon); menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_QUIT); fileMenu.add(menu); menu = new JMenuItem(LaTeXDrawResources.LABEL_HELP, KeyEvent.VK_H); menu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)); menu.setIcon(LaTeXDrawResources.helpIcon); menu.addActionListener(parentFrame); menu.setActionCommand(LaTeXDrawResources.LABEL_HELP); helpMenu.add(menu); menu = new JMenuItem(LaTeXDrawLang.getString1_9("LaTeXDrawFrame.3"), KeyEvent.VK_S); //$NON-NLS-1$ menu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)); menu.setIcon(LaTeXDrawResources.helpIcon); menu.addActionListener(ml); menu.setActionCommand(MenusListener.ACTION_CMD_SHORTCUTS); helpMenu.add(menu); helpMenu.addSeparator(); if(LaTeXDrawFrame.WITH_UPDATE) { menu = new JMenuItem(LaTeXDrawLang.getString1_9("LaTeXDrawFrame.4"), KeyEvent.VK_U); //$NON-NLS-1$ menu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0)); menu.setIcon(LaTeXDrawResources.updateIcon); menu.addActionListener(ml); menu.setActionCommand(MenusListener.LABEL_CHECK_UPDATE); helpMenu.add(menu); helpMenu.addSeparator(); } menu = new JMenuItem(LaTeXDrawResources.LABEL_ABOUT, KeyEvent.VK_A); menu.setIcon(LaTeXDrawResources.aboutIcon); menu.addActionListener(parentFrame); menu.setActionCommand(LaTeXDrawResources.LABEL_ABOUT); helpMenu.add(menu); drawMenu.add(createTemplateMenu()); drawMenu.addSeparator(); menu = new JMenu(LaTeXDrawLang.getString1_9("LaTeXDrawFrame.5")); //$NON-NLS-1$ menu.setIcon(LaTeXDrawResources.emptyIcon); drawMenu.add(menu); menuLine = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_LINE, LaTeXDrawResources.lineIcon); menuLine.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, 0)); menuLine.setMnemonic(KeyEvent.VK_L); menuLine.addActionListener(ml); menuLine.setActionCommand(LaTeXDrawResources.LABEL_LINE); menu.add(menuLine); drawMenuGroup.add(menuLine); menuJoinedLines = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_JOINED_LINES, LaTeXDrawResources.joinedLinesIcon); menuJoinedLines.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_J,0)); menuJoinedLines.setMnemonic(KeyEvent.VK_J); menuJoinedLines.addActionListener(ml); menuJoinedLines.setActionCommand(LaTeXDrawResources.LABEL_JOINED_LINES); menu.add(menuJoinedLines); drawMenuGroup.add(menuJoinedLines); menuPoly = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_POLY, LaTeXDrawResources.polygonIcon); menuPoly.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P,0)); menuPoly.setMnemonic(KeyEvent.VK_P); menuPoly.addActionListener(ml); menuPoly.setActionCommand(LaTeXDrawResources.LABEL_POLY); menu.add(menuPoly); drawMenuGroup.add(menuPoly); menuPoly.setSelected(false); menuDot = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_DOT, LaTeXDrawResources.dotIcon); menuDot.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D,0)); menuDot.setMnemonic(KeyEvent.VK_D); menuDot.addActionListener(ml); menuDot.setActionCommand(LaTeXDrawResources.LABEL_DOT); menu.add(menuDot); drawMenuGroup.add(menuDot); menuDot.setSelected(false); menuRect = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_RECT, LaTeXDrawResources.rectIcon); menuRect.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R,0)); menuRect.setMnemonic(KeyEvent.VK_R); menuRect.addActionListener(ml); menuRect.setActionCommand(LaTeXDrawResources.LABEL_RECT); menu.add(menuRect); drawMenuGroup.add(menuRect); menuRect.setSelected(false); menuSquare = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_SQUARE, LaTeXDrawResources.squareIcon); menuSquare.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,0)); menuSquare.setMnemonic(KeyEvent.VK_S); menuSquare.addActionListener(ml); menuSquare.setActionCommand(LaTeXDrawResources.LABEL_SQUARE); menu.add(menuSquare); drawMenuGroup.add(menuSquare); menuSquare.setSelected(false); menuRhombus = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_RHOMBUS, LaTeXDrawResources.rhombusIcon); menuRhombus.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H,0)); menuRhombus.setMnemonic(KeyEvent.VK_H); menuRhombus.addActionListener(ml); menuRhombus.setActionCommand(LaTeXDrawResources.LABEL_RHOMBUS); menu.add(menuRhombus); drawMenuGroup.add(menuRhombus); menuRhombus.setSelected(false); menuTriangle = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_TRIANGLE, LaTeXDrawResources.triangleIcon); menuTriangle.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T,0)); menuTriangle.setMnemonic(KeyEvent.VK_T); menuTriangle.addActionListener(ml); menuTriangle.setActionCommand(LaTeXDrawResources.LABEL_TRIANGLE); menu.add(menuTriangle); drawMenuGroup.add(menuTriangle); menuTriangle.setSelected(false); menuEllipse = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_ELLIPSE, LaTeXDrawResources.ellipseIcon); menuEllipse.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E,0)); menuEllipse.setMnemonic(KeyEvent.VK_E); menuEllipse.addActionListener(ml); menuEllipse.setActionCommand(LaTeXDrawResources.LABEL_ELLIPSE); menu.add(menuEllipse); drawMenuGroup.add(menuEllipse); menuEllipse.setSelected(false); menuCircle = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_CIRCLE, LaTeXDrawResources.circleIcon); menuCircle.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,0)); menuCircle.setMnemonic(KeyEvent.VK_C); menuCircle.addActionListener(ml); menuCircle.setActionCommand(LaTeXDrawResources.LABEL_CIRCLE); menu.add(menuCircle); drawMenuGroup.add(menuCircle); menuCircle.setSelected(false); menuArc = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_ARC, LaTeXDrawResources.arcIcon); menuArc.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A,0)); menuArc.setMnemonic(KeyEvent.VK_A); menuArc.addActionListener(ml); menuArc.setActionCommand(LaTeXDrawResources.LABEL_ARC); menu.add(menuArc); drawMenuGroup.add(menuArc); menuArc.setSelected(false); menuWedge = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_WEDGE, LaTeXDrawResources.wedgeIcon); menuWedge.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W,0)); menuWedge.setMnemonic(KeyEvent.VK_W); menuWedge.addActionListener(ml); menuWedge.setActionCommand(LaTeXDrawResources.LABEL_WEDGE); menu.add(menuWedge); drawMenuGroup.add(menuWedge); menuWedge.setSelected(false); menuChord = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_CHORD, LaTeXDrawResources.chordIcon); menuChord.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O,0)); menuChord.setMnemonic(KeyEvent.VK_O); menuChord.addActionListener(ml); menuChord.setActionCommand(LaTeXDrawResources.LABEL_CHORD); menu.add(menuChord); drawMenuGroup.add(menuChord); menuChord.setSelected(false); menuBezierCurve = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_BEZIER_CURVE, LaTeXDrawResources.bezierCurveIcon); menuBezierCurve.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B,0)); menuBezierCurve.setMnemonic(KeyEvent.VK_B); menuBezierCurve.addActionListener(ml); menuBezierCurve.setActionCommand(LaTeXDrawResources.LABEL_BEZIER_CURVE); menu.add(menuBezierCurve); drawMenuGroup.add(menuBezierCurve); menuBezierCurve.setSelected(false); menuClosedBezierCurve = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_CLOSED_BEZIER_CURVE, LaTeXDrawResources.closedBezierIcon); menuClosedBezierCurve.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,0)); menuClosedBezierCurve.setMnemonic(KeyEvent.VK_B); menuClosedBezierCurve.addActionListener(ml); menuClosedBezierCurve.setActionCommand(LaTeXDrawResources.LABEL_CLOSED_BEZIER_CURVE); menu.add(menuClosedBezierCurve); drawMenuGroup.add(menuClosedBezierCurve); menuClosedBezierCurve.setSelected(false); menuGrid = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_GRID, LaTeXDrawResources.gridIcon); menuGrid.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G,0)); menuGrid.setMnemonic(KeyEvent.VK_G); menuGrid.addActionListener(ml); menuGrid.setActionCommand(LaTeXDrawResources.LABEL_GRID); menu.add(menuGrid); drawMenuGroup.add(menuGrid); menuGrid.setSelected(false); menuAxes = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_AXES, LaTeXDrawResources.axesIcon); menuAxes.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z,0)); menuAxes.setMnemonic(KeyEvent.VK_Z); menuAxes.addActionListener(ml); menuAxes.setActionCommand(LaTeXDrawResources.LABEL_AXES); menu.add(menuAxes); drawMenuGroup.add(menuAxes); menuAxes.setSelected(false); menuPointsAkin = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_POINTS_AKIN, LaTeXDrawResources.pointsAkinIcon); menuPointsAkin.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_K,0)); menuPointsAkin.setMnemonic(KeyEvent.VK_K); menuPointsAkin.addActionListener(ml); menuPointsAkin.setActionCommand(LaTeXDrawResources.LABEL_POINTS_AKIN); menu.add(menuPointsAkin); drawMenuGroup.add(menuPointsAkin); menuPointsAkin.setSelected(false); menuText = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_TEXT, LaTeXDrawResources.textIcon); menuText.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,0)); menuText.setMnemonic(KeyEvent.VK_X); menuText.addActionListener(ml); menuText.setActionCommand(LaTeXDrawResources.LABEL_TEXT); menu.add(menuText); drawMenuGroup.add(menuText); menuText.setSelected(false); menuSelect = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_SELECT_FIGURE, LaTeXDrawResources.selectIcon); menuSelect.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F,0)); menuSelect.addActionListener(ml); menuSelect.setActionCommand(LaTeXDrawResources.LABEL_SELECT_FIGURE); drawMenu.add(menuSelect); drawMenuGroup.add(menuSelect); menuSelect.setSelected(true); deleteFigure = new JMenuItem(LaTeXDrawResources.LABEL_DELETE, LaTeXDrawResources.delIcon); deleteFigure.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0)); deleteFigure.addActionListener(ml); deleteFigure.setActionCommand(LaTeXDrawResources.LABEL_DELETE); deleteFigure.setEnabled(false); drawMenu.add(deleteFigure); updateToGridMenu = new JMenuItem(DrawPanel.LABEL_UPDATE_TO_GRID, LaTeXDrawResources.emptyIcon); updateToGridMenu.setActionCommand(DrawPanel.ACTION_CMD_UPDATETOGRID); updateToGridMenu.addActionListener(ml); drawMenu.add(updateToGridMenu); menu = new JMenuItem(LaTeXDrawLang.getString1_9("LaTeXDrawFrame.6"), LaTeXDrawResources.emptyIcon); //$NON-NLS-1$ menu.setToolTipText(LaTeXDrawLang.getString1_9("LaTeXDrawFrame.7")); //$NON-NLS-1$ menu.setActionCommand(MenusListener.ACTION_VISIBLE_ALL_FIGURES); menu.addActionListener(ml); drawMenu.add(menu); drawMenu.addSeparator(); propertiesFigureMenu = new JMenuItem(LaTeXDrawResources.LABEL_FIGURE_PROPERTIES, LaTeXDrawResources.propertiesIcon); propertiesFigureMenu.addActionListener(ml); propertiesFigureMenu.setActionCommand(LaTeXDrawResources.LABEL_FIGURE_PROPERTIES); propertiesFigureMenu.setEnabled(false); drawMenu.add(propertiesFigureMenu); menu = new JMenuItem(LaTeXDrawResources.LABEL_DRAW_PROPERTIES, LaTeXDrawResources.drawingPropIcon); menu.addActionListener(parentFrame); menu.setActionCommand(LaTeXDrawResources.LABEL_DRAW_PROPERTIES); drawMenu.add(menu); drawMenu.addSeparator(); displayBorders = new JCheckBoxMenuItem(LaTeXDrawResources.LABEL_DISPLAY_BORDERS, LaTeXDrawResources.bordersIcon); displayBorders.addActionListener(ml); displayBorders.setActionCommand(LaTeXDrawResources.LABEL_DISPLAY_BORDERS); displayBorders.setSelected(false); drawMenu.add(displayBorders); autoAdjustBorders = new JCheckBoxMenuItem(LaTeXDrawResources.LABEL_AUTO_ADJUST_BORDERS, LaTeXDrawResources.autoBordersIcon); autoAdjustBorders.addActionListener(ml); autoAdjustBorders.setActionCommand(LaTeXDrawResources.LABEL_AUTO_ADJUST_BORDERS); autoAdjustBorders.setSelected(true); drawMenu.add(autoAdjustBorders); displayXScale = new JCheckBoxMenuItem(LaTeXDrawResources.LABEL_DISPLAY_XSCALE, LaTeXDrawResources.emptyIcon); displayXScale.addActionListener(ml); displayXScale.setActionCommand(LaTeXDrawResources.LABEL_DISPLAY_XSCALE); displayXScale.setSelected(LaTeXDrawFrame.DEFAULT_DISPLAY_XSCALE); displayM.add(displayXScale); displayYScale = new JCheckBoxMenuItem(LaTeXDrawResources.LABEL_DISPLAY_YSCALE, LaTeXDrawResources.emptyIcon); displayYScale.addActionListener(ml); displayYScale.setActionCommand(LaTeXDrawResources.LABEL_DISPLAY_YSCALE); displayYScale.setSelected(LaTeXDrawFrame.DEFAULT_DISPLAY_YSCALE); displayM.add(displayYScale); JMenu menuGrill = new JMenu(LaTeXDrawLang.getDialogFrameString("PreferencesFrame.grid")); //$NON-NLS-1$ menuGrill.setIcon(LaTeXDrawResources.displayGridIcon); displayGrid = new JCheckBoxMenuItem(LaTeXDrawResources.LABEL_DISPLAY_GRID, LaTeXDrawResources.emptyIcon); displayGrid.setToolTipText(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.10")); //$NON-NLS-1$ displayGrid.addActionListener(parentFrame); displayGrid.setActionCommand(LaTeXDrawResources.LABEL_DISPLAY_GRID); displayGrid.setSelected(LaTeXDrawFrame.DEFAULT_DISPLAY_GRID && MagneticGrid.DEFAULT_TYPE!=MagneticGrid.TYPE_PERSONAL); menuGrill.add(displayGrid); displayM.add(menuGrill); displayPersoGrid = new JCheckBoxMenuItem(LaTeXDrawResources.LABEL_DISPLAY_PERSO_GRID, LaTeXDrawResources.emptyIcon); displayPersoGrid.setToolTipText(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.11")); //$NON-NLS-1$ displayPersoGrid.addActionListener(parentFrame); displayPersoGrid.setActionCommand(LaTeXDrawResources.LABEL_DISPLAY_PERSO_GRID); displayPersoGrid.setSelected(LaTeXDrawFrame.DEFAULT_DISPLAY_GRID && MagneticGrid.DEFAULT_TYPE==MagneticGrid.TYPE_PERSONAL); menuGrill.add(displayPersoGrid); displayCodePanel = new JCheckBoxMenuItem(LaTeXDrawResources.LABEL_DISPLAY_CODE_PANEL, LaTeXDrawResources.emptyIcon); displayCodePanel.addActionListener(parentFrame); displayCodePanel.setActionCommand(LaTeXDrawResources.LABEL_DISPLAY_CODE_PANEL); displayCodePanel.setSelected(LaTeXDrawFrame.DEFAULT_DISPLAY_CODEPANEL); displayCodePanel.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E,InputEvent.CTRL_MASK)); displayM.add(displayCodePanel); displayM.addSeparator(); menu = new JMenuItem(LaTeXDrawResources.LABEL_ZOOM_IN, LaTeXDrawResources.zoomInIcon); menu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ADD,0)); menu.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.94")); //$NON-NLS-1$ menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_ZOOM_IN); displayM.add(menu); menu = new JMenuItem(LaTeXDrawResources.LABEL_ZOOM_OUT, LaTeXDrawResources.zoomOutIcon); menu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT,0)); menu.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.95")); //$NON-NLS-1$ menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_ZOOM_OUT); displayM.add(menu); menu = new JMenuItem(LaTeXDrawResources.LABEL_ZOOM_DEFAULT, LaTeXDrawResources.zoomDefaultIcon); menu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F9,0)); menu.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.96")); //$NON-NLS-1$ menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_ZOOM_DEFAULT); displayM.add(menu); menu = new JMenuItem(LaTeXDrawResources.LABEL_INSERT_CODE, LaTeXDrawResources.insertPSTricksIcon); menu.setToolTipText(LaTeXDrawLang.getString1_6("LaTeXDrawFrame.11")); //$NON-NLS-1$ menu.addActionListener(parentFrame); menu.setActionCommand(LaTeXDrawResources.LABEL_INSERT_CODE); insertMenu.add(menu); menu = new JMenuItem(LaTeXDrawResources.LABEL_INSERT_PIX, LaTeXDrawResources.insertPicIcon); menu.setToolTipText(LaTeXDrawLang.getString1_6("LaTeXDrawFrame.1")); //$NON-NLS-1$ menu.addActionListener(ml); menu.setActionCommand(LaTeXDrawResources.LABEL_INSERT_PIX); insertMenu.add(menu); menu = new JMenuItem(LaTeXDrawResources.LABEL_COMMENTS, LaTeXDrawResources.commentIcon); menu.addActionListener(parentFrame); menu.setActionCommand(LaTeXDrawResources.LABEL_COMMENTS); codeMenu.add(menu); codeMenu.addSeparator(); menu = new JMenuItem(CodePanel.LABEL_COPY_ALL, LaTeXDrawResources.copyIcon); menu.addActionListener(parentFrame.getCodePanel()); menu.setActionCommand(CodePanel.LABEL_COPY_ALL); codeMenu.add(menu); codeMenu.addSeparator(); menuAutoUpdate = new JCheckBoxMenuItem(CodePanel.LABEL_AUTO_UPDATE, LaTeXDrawResources.emptyIcon); menuAutoUpdate.addActionListener(parentFrame.getCodePanel()); menuAutoUpdate.setToolTipText(LaTeXDrawLang.getOthersString("CodePanel.tip")); //$NON-NLS-1$ menuAutoUpdate.setActionCommand(CodePanel.LABEL_AUTO_UPDATE); menuAutoUpdate.setSelected(CodePanel.DEFAULT_AUTO_UPDATE); codeMenu.add(menuAutoUpdate); menuReloadCode = new JMenuItem(CodePanel.LABEL_RELOAD, LaTeXDrawResources.reloadIcon); menuReloadCode.addActionListener(parentFrame.getCodePanel()); menuReloadCode.setToolTipText(LaTeXDrawLang.getOthersString("CodePanel.updateCode")); //$NON-NLS-1$ menuReloadCode.setActionCommand(CodePanel.LABEL_RELOAD); menuReloadCode.setSelected(!CodePanel.DEFAULT_AUTO_UPDATE); codeMenu.add(menuReloadCode); add(fileMenu); add(editMenu); add(displayM); add(drawMenu); add(insertMenu); add(codeMenu); add(helpMenu); } /** * Allows to create the menu "template". * @return The menu template. */ private JMenu createTemplateMenu() { try { menuTemplate = new MenuTemplate(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.103"), parentFrame); //$NON-NLS-1$ menuTemplate.setIcon(LaTeXDrawResources.emptyIcon); }catch(Exception e) { parentFrame.setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.105")); //$NON-NLS-1$ e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } return menuTemplate; } /** * @return the menuTemplate. * @since 2.0.0 */ public MenuTemplate getMenuTemplate() { return menuTemplate; } /** * @return the cutMenu. * @since 2.0.0 */ public JMenuItem getCutMenu() { return cutMenu; } /** * @return the pasteMenu. * @since 2.0.0 */ public JMenuItem getPasteMenu() { return pasteMenu; } /** * @return the copyMenu. * @since 2.0.0 */ public JMenuItem getCopyMenu() { return copyMenu; } /** * @return the exportTemplateMenu. * @since 2.0.0 */ public JMenuItem getExportTemplateMenu() { return exportTemplateMenu; } /** * @return the undoMenu. * @since 2.0.0 */ public JMenuItem getUndoMenu() { return undoMenu; } /** * @return the redoMenu. * @since 2.0.0 */ public JMenuItem getRedoMenu() { return redoMenu; } /** * @return the exportAsMenu. * @since 2.0.0 */ public JMenu getExportAsMenu() { return exportAsMenu; } /** * @return the recentFilesMenu. * @since 2.0.0 */ public JMenu getRecentFilesMenu() { return recentFilesMenu; } /** * @return the drawMenu. * @since 2.0.0 */ public JMenu getDrawMenu() { return drawMenu; } /** * @return the preferencesMenu. * @since 2.0.0 */ public JMenuItem getPreferencesMenu() { return preferencesMenu; } /** * @return the propertiesFigureMenu. * @since 2.0.0 */ public JMenuItem getPropertiesFigureMenu() { return propertiesFigureMenu; } /** * @return the deleteFigure. * @since 2.0.0 */ public JMenuItem getDeleteFigure() { return deleteFigure; } /** * @return the displayBorders. * @since 2.0.0 */ public JCheckBoxMenuItem getDisplayBorders() { return displayBorders; } /** * @return the displayXScale. * @since 2.0.0 */ public JCheckBoxMenuItem getDisplayXScale() { return displayXScale; } /** * @return the displayYScale. * @since 2.0.0 */ public JCheckBoxMenuItem getDisplayYScale() { return displayYScale; } /** * @return the displayGrid. * @since 2.0.0 */ public JCheckBoxMenuItem getDisplayGrid() { return displayGrid; } /** * @return the displayPersoGrid. * @since 2.0.0 */ public JCheckBoxMenuItem getDisplayPersoGrid() { return displayPersoGrid; } /** * @return the displayCodePanel. * @since 2.0.0 */ public JCheckBoxMenuItem getDisplayCodePanel() { return displayCodePanel; } /** * @return the autoAdjustBorders. * @since 2.0.0 */ public JCheckBoxMenuItem getAutoAdjustBorders() { return autoAdjustBorders; } /** * @return the menuPoly. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuPoly() { return menuPoly; } /** * @return the menuLine. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuLine() { return menuLine; } /** * @return the menuRect. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuRect() { return menuRect; } /** * @return the menuSquare. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuSquare() { return menuSquare; } /** * @return the menuDot. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuDot() { return menuDot; } /** * @return the menuRhombus. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuRhombus() { return menuRhombus; } /** * @return the menuTriangle. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuTriangle() { return menuTriangle; } /** * @return the menuJoinedLines. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuJoinedLines() { return menuJoinedLines; } /** * @return the menuCircle. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuCircle() { return menuCircle; } /** * @return the menuAxes. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuAxes() { return menuAxes; } /** * @return the menuChord. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuChord() { return menuChord; } /** * @return the menuEllipse. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuEllipse() { return menuEllipse; } /** * @return the menuBezierCurve. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuBezierCurve() { return menuBezierCurve; } /** * @return the menuClosedBezierCurve. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuClosedBezierCurve() { return menuClosedBezierCurve; } /** * @return the menuSelect. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuSelect() { return menuSelect; } /** * @return the menuArc. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuArc() { return menuArc; } /** * @return the menuWedge. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuWedge() { return menuWedge; } /** * @return the menuText. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuText() { return menuText; } /** * @return the menuPointsAkin. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuPointsAkin() { return menuPointsAkin; } /** * @return the menuGrid. * @since 2.0.0 */ public JRadioButtonMenuItem getMenuGrid() { return menuGrid; } /** * @return the menuAutoUpdate. * @since 2.0.0 */ public JCheckBoxMenuItem getMenuAutoUpdate() { return menuAutoUpdate; } /** * @return the menuReloadCode. * @since 2.0.0 */ public JMenuItem getMenuReloadCode() { return menuReloadCode; } /** * @return the updateToGridMenu. * @since 2.0.0 */ public JMenuItem getUpdateToGridMenu() { return updateToGridMenu; } /** * @return the parentFrame. * @since 2.0.0 */ public LaTeXDrawFrame getParentFrame() { return parentFrame; } /** * Updates the menus related to the grid. * @param displayed Defines if the grid is shown or not. * @param classic Defines if the grid is classic or defined by the user. * @since 2.0.0 */ public void setGridDisplayed(boolean displayed, boolean classic) { if(displayed) { displayGrid.setSelected(classic); displayPersoGrid.setSelected(!classic); } else { displayGrid.setSelected(false); displayPersoGrid.setSelected(false); } } /** * Create the menu item of the menu "recent files". * @since 1.9 */ public void updateRecentFilesMenu() { Vector recentFilesName = parentFrame.getPreferencesFrame().getRecentFilesName(); recentFilesMenu.removeAll(); for(String fileName : recentFilesName) { String shortName = fileName.substring(fileName.lastIndexOf(System.getProperty("file.separator"))+1);//$NON-NLS-1$ JMenuItem menuItem = new JMenuItem(shortName); menuItem.setToolTipText(fileName); menuItem.addActionListener(parentFrame.getRecentFilesListener()); menuItem.setActionCommand(RecentFilesListener.RECENT_PREFIX_CMD+fileName); recentFilesMenu.add(menuItem); } recentFilesMenu.addSeparator(); JMenuItem delMenu = new JMenuItem(LaTeXDrawLang.getString1_9("LaTeXDrawFrame.2"), LaTeXDrawResources.delIcon); //$NON-NLS-1$ delMenu.setActionCommand(RecentFilesListener.ACTION_CMD_RECENT_CLEAR); delMenu.addActionListener(parentFrame.getRecentFilesListener()); recentFilesMenu.add(delMenu); } } latexdraw-2.0.8+1.orig/latexDraw/ui/components/CopyPasteMenu.java0000644000000000000000000001053511347255510021640 0ustar package latexDraw.ui.components; import java.awt.Point; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JEditorPane; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import latexDraw.lang.LaTeXDrawLang; import latexDraw.ui.dialog.ExceptionFrameDialog; /** * This class define a popup menu allowing to cut, paste and copy text from an {@link JEditorPane}. *
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 10/24/06
* @author Arnaud BLOUIN
* @version 2.0.0
* @since 1.9
*/ public class CopyPasteMenu extends JPopupMenu implements ActionListener, MouseListener { private static final long serialVersionUID = 1L; /** The editor to manage. */ protected JEditorPane editor; public static final String LABEL_COPY = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.40"); //$NON-NLS-1$ public static final String LABEL_CUT = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.44"); //$NON-NLS-1$ public static final String LABEL_PASTE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.43"); //$NON-NLS-1$ protected JMenuItem copyM; protected JMenuItem cutM; protected JMenuItem pasteM; /** * The constructor. * @param edit The editor, must not be null. */ public CopyPasteMenu(JEditorPane edit) { if(edit==null) throw new IllegalArgumentException("Invalid editor.");//$NON-NLS-1$ editor = edit; copyM = new JMenuItem(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.40")); //$NON-NLS-1$ copyM.setActionCommand(LABEL_COPY); copyM.addActionListener(this); add(copyM); cutM = new JMenuItem(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.44")); //$NON-NLS-1$ cutM.setActionCommand(LABEL_CUT); cutM.addActionListener(this); add(cutM); pasteM = new JMenuItem(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.43")); //$NON-NLS-1$ pasteM.setActionCommand(LABEL_PASTE); pasteM.addActionListener(this); add(pasteM); } /** * Update the {@link JMenuItem} of the menu. * @since 1.9 */ public void updateMenus() { boolean ok = editor.getSelectedText()!=null; try { Transferable transf = editor.getToolkit().getSystemClipboard().getContents(null); Object o = transf.getTransferData(DataFlavor.stringFlavor); pasteM.setEnabled(o!=null && o instanceof String); } catch(Exception e) { pasteM.setEnabled(false); } copyM.setEnabled(ok); cutM.setEnabled(ok); } public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if(o instanceof JMenuItem) { String actionCmd = ((JMenuItem)o).getActionCommand(); if(actionCmd.equals(LABEL_COPY)) { editor.copy(); return ; } if(actionCmd.equals(LABEL_CUT)) { editor.cut(); return ; } if(actionCmd.equals(LABEL_PASTE)) { editor.paste(); return ; } return ; } } public void mouseClicked(MouseEvent e) { try { switch(e.getButton()) { case MouseEvent.BUTTON3 : Point point = e.getPoint(); updateMenus(); show(e.getComponent(), point.x, point.y); break; } } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } e.consume(); } public void mouseEntered(MouseEvent e) { /* No action to do. */ } public void mouseExited(MouseEvent e) { /* No action to do. */ } public void mousePressed(MouseEvent e) { /* No action to do. */ } public void mouseReleased(MouseEvent e) { /* No action to do. */ } } latexdraw-2.0.8+1.orig/latexDraw/ui/components/ButtonIcon.java0000644000000000000000000000554411347255510021174 0ustar package latexDraw.ui.components; import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.io.Serializable; import javax.swing.Icon; /** * This class defines an icon in a JButton.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class ButtonIcon implements Icon, Serializable { private static final long serialVersionUID = 1L; /** The colour of the icon */ private Color color; /** The colour of the borders of the icon */ public final static Color EDGE = Color.BLACK; /** The width of the icon */ public final static int WIDTH = 11; /** he height of the icon */ public final static int HEIGHT = 11; /** * The constructor using a colour. * @param color The colour of the icon. */ public ButtonIcon(Color color) { if(color==null) throw new IllegalArgumentException(); this.color = color; } /** * This method allows to paint the icon in the graphics g. */ public void paintIcon(Component c, Graphics g, int x, int y) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); Color former = g2.getColor(); g2.setColor(EDGE); g2.fillRect(x, y, getIconWidth(), getIconHeight()); g2.setColor(color); g2.fillRect(x+2, y+2, getIconWidth()-4, getIconHeight()-4); g2.setColor(former); } /** * Allows to get the colour of the interior of the icon * @return The colour of the interior of the icon */ public synchronized Color getColor() { return color; } /** * Allows to set the colour of the interior of the icon * @param c The new Colour of the interior of the icon */ public synchronized void setColor(Color c) { if(c==null) throw new IllegalArgumentException(); color = c; } /** * Allows to get the width of the icon */ public int getIconWidth() { return WIDTH; } /** * Allows to get the height of the icon */ public int getIconHeight() { return HEIGHT; } } latexdraw-2.0.8+1.orig/latexDraw/ui/components/LabelListCellRenderer.java0000644000000000000000000000355011347255510023245 0ustar package latexDraw.ui.components; import java.awt.Color; import java.awt.Component; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.ListCellRenderer; import latexDraw.ui.dialog.ExceptionFrameDialog; /** * This class allows the change the renderer of JComboBox. it allows to display a icon in the list
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class LabelListCellRenderer extends JLabel implements ListCellRenderer { private static final long serialVersionUID = 1L; /** The colour displayed when a item is selected in the list */ public static final Color selectcolor = new Color(120, 160, 195); /** * The constructor by default */ public LabelListCellRenderer() { setOpaque(true); } public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { try { setBackground(isSelected ? selectcolor : Color.white); if(value instanceof JLabel) setIcon(((JLabel)value).getIcon()); setEnabled(list.isEnabled()); setFont(list.getFont()); } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } return this; } } latexdraw-2.0.8+1.orig/latexDraw/ui/components/YScale.java0000644000000000000000000001124511347255510020263 0ustar package latexDraw.ui.components; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.geom.Line2D; import javax.swing.JComponent; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.DrawPanel; import latexDraw.ui.dialog.ExceptionFrameDialog; /** * This class defines the Y-scale.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class YScale extends JComponent implements MouseListener { private static final long serialVersionUID = 1L; /** The drawPanl which contains the pixels per centimetre */ private DrawPanel drawPanel; /** The X-scale of the program */ private XScale xScale; /** * The constructor. * @param drawP The drawPanel which contains the pixels per centimetre. * @param xScale The XScale bounds to the YScale. * @throws IllegalArgumentException If drawP is null. */ public YScale(DrawPanel drawP, XScale xScale) { super(); if(drawP==null) throw new IllegalArgumentException(); setPreferredSize(new Dimension(XScale.SIZE, 500)); drawPanel = drawP; this.xScale = xScale; addMouseListener(this); setDoubleBuffered(true); } @Override public void paintComponent(Graphics g) { try { Dimension d = getSize(); double zoom = drawPanel.getZoom(); double height = d.getHeight()*(1/zoom), i, j, cpt; double pixPerCm = drawPanel.getPixelsPerCm(); Graphics2D g2 = (Graphics2D)g; g2.scale(zoom, zoom); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2.setStroke(new BasicStroke(0, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER)); Color formerCol = g2.getColor(); g2.setColor(Color.BLACK); if(xScale.inchMenu.isSelected()) pixPerCm*=PSTricksConstants.INCH_VAL_CM; if(pixPerCm/10.!=(int)(pixPerCm/10.)) { double tmp = pixPerCm/10.; tmp = tmp-(int)tmp>0.5 ? ((int)tmp)+1 : (int)tmp; pixPerCm = tmp*10; } if(pixPerCm>20/zoom) { double pixPerCm10 = pixPerCm/10.; for(i=pixPerCm10; i *
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class DisplayCanvas extends Canvas { private static final long serialVersionUID = 1L; /** The image to display */ protected transient Image image; /** * The constructor by default * @param i The image to display */ public DisplayCanvas(Image i) { image = i; prepareImage(image, this); setPreferredSize(new Dimension(image.getWidth(this), image.getHeight(this))); } @Override public void paint(Graphics g) { if(image!=null) g.drawImage(image, 0, 0, this); } } latexdraw-2.0.8+1.orig/latexDraw/ui/components/progressbars/0000755000000000000000000000000011347255510020751 5ustar latexdraw-2.0.8+1.orig/latexDraw/ui/components/progressbars/AbstractProgressBarManager.java0000644000000000000000000000516511347255510027033 0ustar package latexDraw.ui.components.progressbars; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import javax.swing.JButton; import javax.swing.JProgressBar; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.util.LaTeXDrawResources; /** * Defines an abstract progress bar manager for latexdraw.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 02/04/08
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public abstract class AbstractProgressBarManager implements Runnable, ActionListener { /** The thread of the parser. */ protected transient Thread parsingThread; /** The main frame. */ protected LaTeXDrawFrame frame; /** The file to parse. */ protected File fileToParse; public AbstractProgressBarManager(LaTeXDrawFrame f) { if(f==null) throw new IllegalArgumentException(); frame = f; frame.getStopButton().addActionListener(this); fileToParse = null; } public void actionPerformed(ActionEvent e) { Object src = e.getSource(); if(src instanceof JButton && LaTeXDrawResources.LABEL_STOP.equals(((JButton)(src)).getActionCommand())) { frame.getStopButton().setVisible(false); frame.getProgressBar().setVisible(false); frame.requestFocus(); } } public void resetProgressBar() { JProgressBar progressBar = frame.getProgressBar(); JButton stopButton = frame.getStopButton(); parsingThread=null; progressBar.setVisible(false); stopButton.setVisible(false); fileToParse = null; } public void startProgressBar() { JProgressBar progressBar = frame.getProgressBar(); JButton stopButton = frame.getStopButton(); progressBar.setMinimum(0); progressBar.setVisible(true); if(stopButton!=null) stopButton.setVisible(true); parsingThread = new Thread(this); parsingThread.start(); } /** * @return the fileToParse. * @since 2.0.0 */ public File getFileToParse() { return fileToParse; } /** * @param fileToParse the fileToParse to set. * @since 2.0.0 */ public void setFileToParse(File fileToParse) { this.fileToParse = fileToParse; } } latexdraw-2.0.8+1.orig/latexDraw/ui/components/progressbars/PSTProgressBarManager.java0000644000000000000000000001102011347255510025721 0ustar package latexDraw.ui.components.progressbars; import java.awt.event.ActionEvent; import java.util.Vector; import javax.swing.JButton; import javax.swing.JOptionPane; import javax.swing.JProgressBar; import latexDraw.figures.Figure; import latexDraw.lang.LaTeXDrawLang; import latexDraw.parsers.Parser; import latexDraw.parsers.pstricks.LaTeXDrawPSTricksParserActions; import latexDraw.parsers.pstricks.PSTricksParameters; import latexDraw.parsers.pstricks.PSTricksParser; import latexDraw.ui.CodePanel; import latexDraw.ui.DrawContainer; import latexDraw.ui.DrawPanel; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.util.LaTeXDrawResources; /** * Defines a progress bar manager of PSTricks import.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 02/04/08
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class PSTProgressBarManager extends AbstractProgressBarManager { /** The TeX parser */ private transient PSTricksParser texParser; /** The code to parse. */ protected String codeToParse; public PSTProgressBarManager(LaTeXDrawFrame frame) { super(frame); codeToParse = null; } @Override public void actionPerformed(ActionEvent e) { super.actionPerformed(e); Object src = e.getSource(); if(src instanceof JButton && LaTeXDrawResources.LABEL_STOP.equals(((JButton)(src)).getActionCommand())) if(parsingThread!=null) texParser.stop(); } public void run() { if(codeToParse==null && fileToParse==null) return ; JProgressBar progressBar = frame.getProgressBar(); JButton stopButton = frame.getStopButton(); LaTeXDrawPSTricksParserActions ltpa = new LaTeXDrawPSTricksParserActions(); texParser = new PSTricksParser(ltpa); progressBar.setValue(0); stopButton.setVisible(true); progressBar.setVisible(true); int res; if(fileToParse!=null) res = texParser.parse(fileToParse, frame, progressBar); else res = texParser.parse(codeToParse, frame, progressBar); Vector
fig = ltpa.getFigures(); switch(res) { case Parser.ERROR_PARSING : frame.setStatusBarText(LaTeXDrawLang.getString1_6("LaTeXDrawFrame.34")); //$NON-NLS-1$ break; case Parser.CANCEL_PARSING : frame.setStatusBarText(LaTeXDrawLang.getString1_6("LaTeXDrawFrame.35")); //$NON-NLS-1$ break; case Parser.OK_PARSING : if(fig==null || fig.isEmpty()) { JOptionPane.showMessageDialog(frame, LaTeXDrawLang.getString1_6("LaTeXDrawFrame.30") //$NON-NLS-1$ + LaTeXDrawResources.MAIL_ME + LaTeXDrawLang.getString1_6("LaTeXDrawFrame.31"), //$NON-NLS-1$ LaTeXDrawLang.getString1_6("LaTeXDrawFrame.32"), //$NON-NLS-1$ JOptionPane.WARNING_MESSAGE ); frame.setStatusBarText(LaTeXDrawLang.getString1_6("LaTeXDrawFrame.33")); //$NON-NLS-1$ } else { LaTeXDrawPSTricksParserActions.optimizeCode(fig); DrawPanel drawPanel = frame.getDrawPanel(); CodePanel codePanel = frame.getCodePanel(); DrawContainer draw = drawPanel.getDraw(); for(Figure f : fig) draw.addFigure(f, frame.getUndoManager()); draw.recenterFigures(); codePanel.setPositionHoriToken(PSTricksParameters.isCentered ? CodePanel.TOKEN_HORI_CENTER_START : CodePanel.TOKEN_HORI_VERT_DEFAULT); codePanel.setPositionVertToken(PSTricksParameters.tokenPosition); drawPanel.updateDraw(true); frame.setStatusBarText(LaTeXDrawLang.getString1_6("LaTeXDrawFrame.36")); //$NON-NLS-1$ frame.getLMenuBar().getExportAsMenu().setEnabled(true); frame.getToolbar().getButtonPdfExport().setEnabled(true); drawPanel.setIsModified(true); } break; } resetProgressBar(); } @Override public void resetProgressBar() { super.resetProgressBar(); codeToParse = null; } /** * @return the codeToParse. * @since 2.0.0 */ public String getCodeToParse() { return codeToParse; } /** * @param codeToParse the codeToParse to set. * @since 2.0.0 */ public void setCodeToParse(String codeToParse) { this.codeToParse = codeToParse; } } latexdraw-2.0.8+1.orig/latexDraw/ui/components/progressbars/SVGProgressBarManager.java0000644000000000000000000000475011347255510025726 0ustar package latexDraw.ui.components.progressbars; import javax.swing.JOptionPane; import latexDraw.figures.Draw; import latexDraw.figures.Figure; import latexDraw.generators.svg.SVGDocumentGenerator; import latexDraw.lang.LaTeXDrawLang; import latexDraw.ui.DrawPanel; import latexDraw.ui.LaTeXDrawFrame; /** * Defines a progress bar manager of SVG import.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 02/04/08
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class SVGProgressBarManager extends AbstractProgressBarManager { public SVGProgressBarManager(LaTeXDrawFrame f) { super(f); } public void run() { try { Draw figures = SVGDocumentGenerator.toLatexdraw(fileToParse, frame, frame.getProgressBar()); DrawPanel drawPanel = frame.getDrawPanel(); if(figures!=null) { for(Figure f : figures.getFigures()) drawPanel.getDraw().addFigure(f, null); if(!figures.isEmpty()) frame.setIsModified(true); drawPanel.updateDraw(true); } else frame.setStatusBarText(LaTeXDrawLang.getOthersString("SVGManager.0")); //$NON-NLS-1$ frame.setTitle(); frame.getUndoManager().clear(); frame.updateUndoRedo(); frame.setSelection(false); frame.setIsModified(false); frame.getPreferencesFrame().addRecentFile(fileToParse.getAbsolutePath()); frame.getLMenuBar().updateRecentFilesMenu(); frame.setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.202")); //$NON-NLS-1$ } catch(Exception ex) { frame.setIsModified(false); frame.setCurrentFile(null); frame.setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.203")); //$NON-NLS-1$ ex.printStackTrace(); JOptionPane.showMessageDialog(frame, LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.204") + ex.toString(), //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.86"), JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$ } resetProgressBar(); } } latexdraw-2.0.8+1.orig/latexDraw/ui/components/XScale.java0000644000000000000000000002033611347255510020263 0ustar package latexDraw.ui.components; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.geom.Line2D; import javax.swing.ButtonGroup; import javax.swing.JCheckBoxMenuItem; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JPopupMenu; import latexDraw.lang.LaTeXDrawLang; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.DrawPanel; import latexDraw.ui.dialog.ExceptionFrameDialog; /** * This class defines the X-scale.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class XScale extends JComponent implements MouseListener,ItemListener { private static final long serialVersionUID = 1L; /** The drawPanel which contains the pixels per centimetre */ private DrawPanel drawPanel; /** The other scale : the Y-scale (Useful for a good display) */ private YScale yScale; /** The size of the lines in axes */ public static final int SIZE = 10; /** The popup menu which allows to set the type of measure (inch, cm, ...) */ private JPopupMenu popupMenu; /** The label of the centimetre menu */ public static final String LABEL_CM = LaTeXDrawLang.getOthersString("XScale.cm"); //$NON-NLS-1$ /** The label of the inch menu */ public static final String LABEL_INCH = LaTeXDrawLang.getOthersString("XScale.inch"); //$NON-NLS-1$ /** The unit of length by default */ public static final String DEFAULT_UNIT = LABEL_CM; /** The menu for centimetres */ protected JCheckBoxMenuItem cmMenu; /** The menu for inches */ protected JCheckBoxMenuItem inchMenu; /** * The constructor. * @param drawP The drawPanel which contains the pixels per centimetre. * @param y The YScale bounds to the XScale. * @throws IllegalArgumentException If drawP or y is null. */ public XScale(DrawPanel drawP, YScale y) { super(); if(drawP==null || y==null) throw new IllegalArgumentException(); setPreferredSize(new Dimension(500, SIZE)); drawPanel = drawP; yScale = y; /* Creation of the popup menu */ ButtonGroup buttonGroup = new ButtonGroup(); popupMenu = new JPopupMenu(); cmMenu = new JCheckBoxMenuItem(LABEL_CM); cmMenu.setActionCommand(LABEL_CM); cmMenu.addItemListener(this); inchMenu = new JCheckBoxMenuItem(LABEL_INCH); inchMenu.addItemListener(this); inchMenu.setActionCommand(LABEL_INCH); cmMenu.setSelected(true); popupMenu.add(cmMenu); popupMenu.add(inchMenu); buttonGroup.add(cmMenu); buttonGroup.add(inchMenu); addMouseListener(this); setDoubleBuffered(true); } /** * Sets the Y-scale. * @param y The new Y-scale. * @throws IllegalArgumentException If y is null. */ public void setYScale(YScale y) { if(y==null) throw new IllegalArgumentException(); yScale = y; } /** * Allows to access to the popup menu. * @return The popup menu. */ public JPopupMenu getPopupMenu() { return popupMenu; } /** * Allows to know the X-coordinates of the start of the X-Scale. * @return The X-coordinates of the start of the X-Scale. */ public float getStart() { float start; if(yScale==null) start = 0; else if(yScale.isVisible()) start = SIZE; else start = 0; return start; } @Override public void paintComponent(Graphics g) { try { Dimension d = getSize(); double zoom = drawPanel.getZoom(); double width = d.getWidth()*(1/zoom), i, j, start, cpt; double pixPerCm = drawPanel.getPixelsPerCm(); Graphics2D g2 = (Graphics2D)g; g2.scale(zoom, zoom); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2.setStroke(new BasicStroke(0, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER)); Color formerCol = g2.getColor(); g2.setColor(Color.BLACK); if(yScale==null) start = 0.; else if(yScale.isVisible()) start = SIZE; else start = 0.; if(inchMenu.isSelected()) pixPerCm*=PSTricksConstants.INCH_VAL_CM; if(pixPerCm/10.!=(int)(pixPerCm/10.)) { double tmp = pixPerCm/10.; tmp = tmp-(int)tmp>0.5 ? ((int)tmp)+1 : (int)tmp; pixPerCm = tmp*10; } if(pixPerCm>20/zoom) { double pixPerCm10 = pixPerCm/10.; for(i=start/zoom+pixPerCm10; i *
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 03/15/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class ColorButton extends JButton { private static final long serialVersionUID = 1L; public static final Insets INSET_BUTTON = new Insets(1,1,1,1); public ColorButton() { super(); } public ColorButton(Action a) { super(a); } public ColorButton(Icon icon) { super(icon); } public ColorButton(String text, Icon icon) { super(text, icon); } public ColorButton(String text) { super(text); } /** * Set a new colour to the button. * @param c The new colour. * @since 1.9.1 */ public void setColor(Color c) { ((ButtonIcon)getIcon()).setColor(c); repaint(); } /** * @return The colour of the icon of the button. * @since 1.9.1 */ public Color getColor() { if(((ButtonIcon)getIcon())==null) return null; return ((ButtonIcon)getIcon()).getColor(); } } latexdraw-2.0.8+1.orig/latexDraw/ui/components/CloseButton.java0000644000000000000000000000545611347255510021353 0ustar package latexDraw.ui.components; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JPanel; import latexDraw.lang.LaTeXDrawLang; import latexDraw.ui.dialog.ExceptionFrameDialog; /** * This class defines a button which allows the user to close a window
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 05/23/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class CloseButton extends JButton implements ActionListener { private static final long serialVersionUID = 1L; /** The panel to close */ private JPanel closePanel; /** The width of the button */ public static final int ICON_WIDTH = 14; /** The height of the button */ public static final int ICON_HEIGHT = 14; /** The image of the button. */ protected final static ImageIcon closeOut = new ImageIcon(Class.class.getClass().getResource("/res/closeOut.png"));//$NON-NLS-1$ /** The image of the button when the mouse is on. */ protected final static ImageIcon closeIn = new ImageIcon(Class.class.getClass().getResource("/res/closeIn.png"));//$NON-NLS-1$ /** The name and the action command of the button. */ public static final String NAME_BUTTON = "CLOSE_BUTTON";//$NON-NLS-1$ /** * The constructor by default. * @param panel The panel to close (can be null). */ public CloseButton(JPanel panel) { try { closePanel = panel; addActionListener(this); setSize(ICON_WIDTH, ICON_HEIGHT); setPreferredSize(new Dimension(ICON_WIDTH, ICON_HEIGHT)); setMinimumSize(new Dimension(ICON_WIDTH, ICON_HEIGHT)); setMaximumSize(new Dimension(ICON_WIDTH, ICON_HEIGHT)); setActionCommand(NAME_BUTTON); setName(NAME_BUTTON); setIcon(closeOut); setRolloverIcon(closeIn); setToolTipText(LaTeXDrawLang.getOthersString("CloseButton.closePanel")); //$NON-NLS-1$ }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if(o instanceof CloseButton && closePanel!=null) { closePanel.setVisible(false); return ; } } } latexdraw-2.0.8+1.orig/latexDraw/ui/components/ListJToggleButton.java0000644000000000000000000002213611347255510022467 0ustar package latexDraw.ui.components; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowEvent; import java.awt.event.WindowFocusListener; import java.awt.image.BufferedImage; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import latexDraw.ui.dialog.ExceptionFrameDialog; /** * This class defines a button which displays a frame containing * others buttons; a kind of menu with buttons.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 05/02/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class ListJToggleButton extends JToggleButton implements ActionListener, ChangeListener, WindowFocusListener { private static final long serialVersionUID = 1L; /** The frame which displays the toolbar */ JWindow buttonsFrame; /** The toolbar which contains the buttons */ JToolBar toolbar; /** The width of the triangle drawn in the button */ public static final int WIDTH_TRIANGLE = 8; /** The height of the triangle drawn in the button */ public static final int HEIGHT_TRIANGLE = 6; /** Define the location of the panel of buttons. */ protected int location; /** The frame is at the north of the button. */ public static final short LOCATION_NORTH = 1; /** The frame is at the south of the button. */ public static final short LOCATION_SOUTH = 2; /** * The constructor using a text. * @param frame The main frame containing the ListJToggleButton. * @param txt The text of the ListJToggleButton. * @param locate The position of the mini toolbar. * @since 1.9.1 */ public ListJToggleButton(JFrame frame, String txt, int locate) { super(txt); setIcon(); intializing(frame, locate); } /** * The constructor using an icon. * @param icon The icon of the ListJToggleButton. * @param locate The position of the mini toolbar. * @param frame The main frame containing the ListJToggleButton. */ public ListJToggleButton(JFrame frame, Icon icon, int locate) { super(icon); intializing(frame, locate); } /** * Initialises the ListJToggleButton. * @param frame The main frame containing the ListJToggleButton. * @param locate The position of the mini toolbar. * @since 1.9.1 */ protected void intializing(JFrame frame, int locate) { try { try{setLocation(locate);} catch(Exception e) {location = LOCATION_SOUTH; } toolbar = new JToolBar(); JPanel buttonsPanel = new JPanel(); toolbar.setFloatable(false); buttonsFrame = new JWindow(frame); buttonsFrame.setVisible(false); buttonsFrame.setAlwaysOnTop(true); buttonsPanel.add(toolbar); buttonsPanel.setBorder(BorderFactory.createEtchedBorder()); buttonsFrame.add(buttonsPanel); buttonsFrame.pack(); buttonsFrame.addWindowFocusListener(this); addActionListener(this); setMargin(new Insets(1,1,1,1)); JButton closeB = new CloseButton(null); addComponent(closeB); } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } /** * @return Creates an imageIcon containing the triangle icon. * @since 1.9.1 */ protected ImageIcon createTriangleIcon() { int width = 10, height = 20; BufferedImage bufferImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D graphic = bufferImage.createGraphics(); paintTriangle(graphic, width, height); return new ImageIcon(bufferImage); } /** * Sets the location of the mini toolbar. * @param locat The position of the mini toolbar. * @throws IllegalArgumentException If the location is neither LOCATION_NORTH nor LOCATION_SOUTH. */ public void setLocation(int locat) { if(locat==LOCATION_NORTH || locat==LOCATION_SOUTH) location = locat; else throw new IllegalArgumentException(); } @Override public void setSelected(boolean sel) { updateSelected(); } /** * Adds a separator to the toolbar. */ public void addSeparator() { Component c = toolbar.getComponentAtIndex(toolbar.getComponentCount()-1); toolbar.remove(c); toolbar.addSeparator(); toolbar.add(c); buttonsFrame.pack(); } /** * Adds a button to the toolbar of the listJToggleButton. * @param b The new button to add. */ public void addComponent(Component b) { toolbar.add(b, null, toolbar.getComponentCount()-1); buttonsFrame.pack(); if(b instanceof AbstractButton) { ((AbstractButton)b).addActionListener(this); ((AbstractButton)b).addChangeListener(this); } } /** * Paints the triangle icon in a graphic. * @param g The graphic. * @param width The width of the object. * @param height The height of the object. * @since 1.9.1 */ public void paintTriangle(Graphics g, int width, int height) { if(g==null || width<1 || height<1) throw new IllegalArgumentException(); Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); int nbPts = 3; int gap = 4; int xs[] = new int[nbPts]; int ys[] = new int[nbPts]; if(location==LOCATION_SOUTH) { xs[0] = (width-WIDTH_TRIANGLE)>>1; xs[1] = (width+WIDTH_TRIANGLE)>>1; xs[2] = width>>1; ys[0] = height-HEIGHT_TRIANGLE-gap; ys[1] = height-HEIGHT_TRIANGLE-gap; ys[2] = height-gap; } else { xs[0] = (width-WIDTH_TRIANGLE)>>1; xs[1] = (width+WIDTH_TRIANGLE)>>1; xs[2] = width>>1; ys[0] = HEIGHT_TRIANGLE+gap; ys[1] = HEIGHT_TRIANGLE+gap; ys[2] = gap; } g.setColor(Color.red); g.fillPolygon(xs, ys, nbPts); g.setColor(Color.black); g.drawPolygon(xs, ys, nbPts); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if(getText().equals(""))//$NON-NLS-1$ paintTriangle(g,getSize().width, getSize().height); } /** * Defines the position of the mini-toolbar. * @since 1.9.1 */ public void defineToolbarLocation() { buttonsFrame.setLocation(getLocationOnScreen().x, getLocationOnScreen().y + (location==LOCATION_SOUTH ? getHeight() : -buttonsFrame.getHeight())); } public void actionPerformed(ActionEvent e) { Object src = e.getSource(); if(src instanceof ListJToggleButton) { defineToolbarLocation(); updateSelected(); buttonsFrame.setVisible(!buttonsFrame.isVisible()); return ; } if(src instanceof JCheckBox || src instanceof JRadioButton) return ; if(src instanceof CloseButton) { buttonsFrame.setVisible(false); return; } if(src instanceof JToggleButton || src instanceof JButton) { buttonsFrame.setVisible(false); updateSelected(); return ; } } public void stateChanged(ChangeEvent e) { Object src = e.getSource(); if(src instanceof JToggleButton && !(src instanceof JCheckBox || src instanceof JRadioButton)) setSelected(((JToggleButton)src).isSelected()); } /** * @return The location of the panel of buttons. */ public int getLocationButtonPanel() { return location; } /** * Sets the main button to selected or not following if a button is selected or not. */ public void updateSelected() { int i, size = toolbar.getComponentCount(); boolean selected = false; Component src; for(i=0; i *
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* * 09/22/07
* @author Arnaud BLOUIN
* @version 2.0.0
* @since 2.0.0
*/ public class LToolbar extends JToolBar { private static final long serialVersionUID = 1L; protected JSpinner zoomField; protected JSpinner persoGridGapField; protected JCheckBox magneticCB; protected JSlider sliderDelimitor; /** This button allows to copy the generated code when the code panel is closed. */ protected JButton copyCodeButton; protected JButton copyCodeSelButton; protected JToggleButton buttonImageLine; protected JToggleButton buttonImageDot; protected JToggleButton buttonImageRect; protected JToggleButton buttonImageSquare; protected JToggleButton buttonImageRhombus; protected JToggleButton buttonImageTriangle; protected JToggleButton buttonImageEllipse; protected JToggleButton buttonImageCircle; protected JToggleButton buttonImageSelect; protected JToggleButton buttonImageBorders; protected JToggleButton buttonImageWedge; protected JToggleButton buttonImageChord; protected JToggleButton buttonImageArc; protected JToggleButton buttonImagePoly; protected JToggleButton buttonImageText; protected JToggleButton buttonImagePointsAkin; protected JToggleButton buttonImageGrid; protected JToggleButton buttonImageAxes; protected JToggleButton buttonImageBezierCurve; protected JToggleButton buttonImageClosedBezierCurve; protected JToggleButton buttonImageJoinedLines; protected JButton buttonImageDel; protected JButton buttonImageProperties; protected JButton buttonImageRedo; protected JButton buttonImageUndo; protected LaTeXDrawFrame parentFrame; protected JButton buttonPdfExport; public LToolbar(LaTeXDrawFrame parent) { super(); if(parent==null) throw new IllegalArgumentException(); parentFrame = parent; MenusListener ml = parentFrame.getMenuListener(); setName(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.107")); //$NON-NLS-1$ ButtonGroup drawButtonGroup = new ButtonGroup(); JButton button; button = new JButton(LaTeXDrawResources.newIcon); button.addActionListener(ml); button.setMargin(LaTeXDrawFrame.INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.108")); //$NON-NLS-1$ button.setActionCommand(LaTeXDrawResources.LABEL_NEW); add(button); button = new JButton(LaTeXDrawResources.openIcon); button.addActionListener(ml); button.setMargin(LaTeXDrawFrame.INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.109")); //$NON-NLS-1$ button.setActionCommand(LaTeXDrawResources.LABEL_OPEN); add(button); button = new JButton(LaTeXDrawResources.saveIcon); button.addActionListener(ml); button.setMargin(LaTeXDrawFrame.INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.110")); //$NON-NLS-1$ button.setActionCommand(LaTeXDrawResources.LABEL_SAVE); add(button); buttonPdfExport = new JButton(LaTeXDrawResources.pdfIcon); buttonPdfExport.addActionListener(ml); buttonPdfExport.setEnabled(false); buttonPdfExport.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonPdfExport.setToolTipText("Export the drawing as a pdf document (the drawing is compiled using your latex distribution)"); buttonPdfExport.setActionCommand(LaTeXDrawResources.LABEL_EXPORT_PDF_LATEX); add(buttonPdfExport); addSeparator(); SpinnerNumberModel model = new SpinnerNumberModel(DrawContainer.DEFAULT_ZOOM*100, DrawContainer.MIN_ZOOM*100, DrawContainer.MAX_ZOOM*100,DrawContainer.DEFAULT_ADD_ZOOM*100); zoomField = new JSpinner(model); zoomField.setMaximumSize(new Dimension(50, 28)); zoomField.setToolTipText(LaTeXDrawLang.getString1_9("ShortcutsFrame.30")); zoomField.setName(LaTeXDrawResources.LABEL_ZOOM_CHANGE); zoomField.addChangeListener(parentFrame); add(zoomField); button = new JButton(LaTeXDrawResources.zoomDefaultIcon); button.addActionListener(ml); button.setMargin(LaTeXDrawFrame.INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.113")); //$NON-NLS-1$ button.setActionCommand(LaTeXDrawResources.LABEL_ZOOM_DEFAULT); add(button); addSeparator(); ListJToggleButton listGrid = new ListJToggleButton(parentFrame, LaTeXDrawResources.displayGridIcon, ListJToggleButton.LOCATION_SOUTH); listGrid.setToolTipText(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.12")); //$NON-NLS-1$ magneticCB = new JCheckBox(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.13")); //$NON-NLS-1$ magneticCB.setMargin(LaTeXDrawFrame.INSET_BUTTON); magneticCB.setActionCommand(LaTeXDrawResources.LABEL_MAGNETIC_CB); magneticCB.addActionListener(parentFrame); magneticCB.setToolTipText(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.14")); //$NON-NLS-1$ listGrid.addComponent(magneticCB); listGrid.addSeparator(); JLabel label = new JLabel(LaTeXDrawResources.loadImageIcon("/res/gridGap.png"));//$NON-NLS-1$ listGrid.addComponent(label); model = new SpinnerNumberModel(MagneticGrid.DEFAULT_PERSONAL_GRID_GAP, 2, 100000, 1); persoGridGapField = new JSpinner(model); persoGridGapField.setEditor(new JSpinner.NumberEditor(persoGridGapField, "0"));//$NON-NLS-1$ persoGridGapField.addChangeListener(parentFrame); persoGridGapField.setName(LaTeXDrawResources.LABEL_PERSO_GRID_GAP_FIELD); persoGridGapField.setPreferredSize(new Dimension(45,25)); persoGridGapField.setMaximumSize(new Dimension(45,25)); persoGridGapField.addChangeListener(parentFrame); persoGridGapField.setEnabled(false); persoGridGapField.setToolTipText(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.15")); //$NON-NLS-1$ listGrid.addComponent(persoGridGapField); listGrid.addSeparator(); add(listGrid); ListJToggleButton listDelimitor = new ListJToggleButton(parentFrame, LaTeXDrawResources.delimitorIcon, ListJToggleButton.LOCATION_SOUTH); listDelimitor.setToolTipText(LaTeXDrawLang.getString1_9("LaTeXDrawFrame.8")); //$NON-NLS-1$ JPanel panelSliderDel = new JPanel(); JLabel sliderLabel = new JLabel(LaTeXDrawLang.getString1_9("LaTeXDrawFrame.9"), SwingConstants.CENTER); //$NON-NLS-1$ panelSliderDel.setLayout(new BoxLayout(panelSliderDel, BoxLayout.PAGE_AXIS)); panelSliderDel.add(sliderLabel); sliderLabel.setAlignmentX(Component.CENTER_ALIGNMENT); sliderDelimitor = new JSlider(0, 255); sliderDelimitor.setToolTipText(LaTeXDrawLang.getString1_9("LaTeXDrawFrame.10")); //$NON-NLS-1$ sliderDelimitor.setName(LaTeXDrawResources.NAME_SLIDER_DELIMITOR); sliderDelimitor.setMajorTickSpacing(50); sliderDelimitor.setPaintTicks(true); sliderDelimitor.setPaintLabels(true); sliderDelimitor.addChangeListener(parentFrame); panelSliderDel.add(sliderDelimitor); listDelimitor.addComponent(panelSliderDel); listDelimitor.addSeparator(); add(listDelimitor); addSeparator(); buttonImageUndo = new JButton(LaTeXDrawResources.undoIcon); buttonImageUndo.addActionListener(ml); buttonImageUndo.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageUndo.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.114")); //$NON-NLS-1$ buttonImageUndo.setActionCommand(LaTeXDrawResources.LABEL_UNDO); add(buttonImageUndo); buttonImageRedo = new JButton(LaTeXDrawResources.redoIcon); buttonImageRedo.addActionListener(ml); buttonImageRedo.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageRedo.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.115")); //$NON-NLS-1$ buttonImageRedo.setActionCommand(LaTeXDrawResources.LABEL_REDO); add(buttonImageRedo); addSeparator(); ListJToggleButton ltb = new ListJToggleButton(parentFrame, LaTeXDrawResources.lineIcon, ListJToggleButton.LOCATION_SOUTH); ltb.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.116")); //$NON-NLS-1$ add(ltb); buttonImageLine = new JToggleButton(LaTeXDrawResources.lineIcon); buttonImageLine.addActionListener(ml); buttonImageLine.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageLine.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.116")); //$NON-NLS-1$ buttonImageLine.setActionCommand(LaTeXDrawResources.LABEL_LINE); drawButtonGroup.add(buttonImageLine); ltb.addComponent(buttonImageLine); buttonImageJoinedLines = new JToggleButton(LaTeXDrawResources.joinedLinesIcon); buttonImageJoinedLines.addActionListener(ml); buttonImageJoinedLines.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageJoinedLines.setToolTipText(LaTeXDrawLang.getString1_6("LaTeXDrawFrame.14")); //$NON-NLS-1$ buttonImageJoinedLines.setActionCommand(LaTeXDrawResources.LABEL_JOINED_LINES); drawButtonGroup.add(buttonImageJoinedLines); ltb.addComponent(buttonImageJoinedLines); ltb.addSeparator(); buttonImageDot = new JToggleButton(LaTeXDrawResources.dotIcon); buttonImageDot.addActionListener(ml); buttonImageDot.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageDot.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.117")); //$NON-NLS-1$ buttonImageDot.setActionCommand(LaTeXDrawResources.LABEL_DOT); drawButtonGroup.add(buttonImageDot); add(buttonImageDot); ltb = new ListJToggleButton(parentFrame, LaTeXDrawResources.rectIcon, ListJToggleButton.LOCATION_SOUTH); ltb.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.118")); //$NON-NLS-1$ add(ltb); buttonImageRect = new JToggleButton(LaTeXDrawResources.rectIcon); buttonImageRect.addActionListener(ml); buttonImageRect.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageRect.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.119")); //$NON-NLS-1$ buttonImageRect.setActionCommand(LaTeXDrawResources.LABEL_RECT); drawButtonGroup.add(buttonImageRect); ltb.addComponent(buttonImageRect); buttonImageSquare = new JToggleButton(LaTeXDrawResources.squareIcon); buttonImageSquare.addActionListener(ml); buttonImageSquare.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageSquare.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.120")); //$NON-NLS-1$ buttonImageSquare.setActionCommand(LaTeXDrawResources.LABEL_SQUARE); drawButtonGroup.add(buttonImageSquare); ltb.addComponent(buttonImageSquare); ltb.addSeparator(); ltb = new ListJToggleButton(parentFrame, LaTeXDrawResources.polygonIcon, ListJToggleButton.LOCATION_SOUTH); ltb.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.121")); //$NON-NLS-1$ add(ltb); buttonImagePoly = new JToggleButton(LaTeXDrawResources.polygonIcon); buttonImagePoly.addActionListener(ml); buttonImagePoly.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImagePoly.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.121")); //$NON-NLS-1$ buttonImagePoly.setActionCommand(LaTeXDrawResources.LABEL_POLY); drawButtonGroup.add(buttonImagePoly); ltb.addComponent(buttonImagePoly); buttonImageRhombus = new JToggleButton(LaTeXDrawResources.rhombusIcon); buttonImageRhombus.addActionListener(ml); buttonImageRhombus.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageRhombus.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.123")); //$NON-NLS-1$ buttonImageRhombus.setActionCommand(LaTeXDrawResources.LABEL_RHOMBUS); drawButtonGroup.add(buttonImageRhombus); ltb.addComponent(buttonImageRhombus); buttonImageTriangle = new JToggleButton(LaTeXDrawResources.triangleIcon); buttonImageTriangle.addActionListener(ml); buttonImageTriangle.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageTriangle.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.124")); //$NON-NLS-1$ buttonImageTriangle.setActionCommand(LaTeXDrawResources.LABEL_TRIANGLE); drawButtonGroup.add(buttonImageTriangle); ltb.addComponent(buttonImageTriangle); ltb.addSeparator(); ltb = new ListJToggleButton(parentFrame, LaTeXDrawResources.ellipseIcon, ListJToggleButton.LOCATION_SOUTH); ltb.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.125")); //$NON-NLS-1$ add(ltb); buttonImageEllipse = new JToggleButton(LaTeXDrawResources.ellipseIcon); buttonImageEllipse.addActionListener(ml); buttonImageEllipse.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageEllipse.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.125")); //$NON-NLS-1$ buttonImageEllipse.setActionCommand(LaTeXDrawResources.LABEL_ELLIPSE); drawButtonGroup.add(buttonImageEllipse); ltb.addComponent(buttonImageEllipse); buttonImageCircle = new JToggleButton(LaTeXDrawResources.circleIcon); buttonImageCircle.addActionListener(ml); buttonImageCircle.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageCircle.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.127")); //$NON-NLS-1$ buttonImageCircle.setActionCommand(LaTeXDrawResources.LABEL_CIRCLE); drawButtonGroup.add(buttonImageCircle); ltb.addComponent(buttonImageCircle); ltb.addSeparator(); ltb = new ListJToggleButton(parentFrame, LaTeXDrawResources.arcIcon, ListJToggleButton.LOCATION_SOUTH); ltb.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.128")); //$NON-NLS-1$ add(ltb); buttonImageArc = new JToggleButton(LaTeXDrawResources.arcIcon); buttonImageArc.addActionListener(ml); buttonImageArc.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageArc.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.128")); //$NON-NLS-1$ buttonImageArc.setActionCommand(LaTeXDrawResources.LABEL_ARC); drawButtonGroup.add(buttonImageArc); ltb.addComponent(buttonImageArc); buttonImageWedge = new JToggleButton(LaTeXDrawResources.wedgeIcon); buttonImageWedge.addActionListener(ml); buttonImageWedge.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageWedge.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.130")); //$NON-NLS-1$ buttonImageWedge.setActionCommand(LaTeXDrawResources.LABEL_WEDGE); drawButtonGroup.add(buttonImageWedge); ltb.addComponent(buttonImageWedge); buttonImageChord = new JToggleButton(LaTeXDrawResources.chordIcon); buttonImageChord.addActionListener(ml); buttonImageChord.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageChord.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.131")); //$NON-NLS-1$ buttonImageChord.setActionCommand(LaTeXDrawResources.LABEL_CHORD); drawButtonGroup.add(buttonImageChord); ltb.addComponent(buttonImageChord); ltb.addSeparator(); ltb = new ListJToggleButton(parentFrame, LaTeXDrawResources.closedBezierIcon, ListJToggleButton.LOCATION_SOUTH); ltb.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.132")); //$NON-NLS-1$ add(ltb); buttonImageClosedBezierCurve = new JToggleButton(LaTeXDrawResources.closedBezierIcon); buttonImageClosedBezierCurve.addActionListener(ml); buttonImageClosedBezierCurve.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageClosedBezierCurve.setToolTipText(LaTeXDrawLang.getString1_9("LaTeXDrawFrame.11")); //$NON-NLS-1$ buttonImageClosedBezierCurve.setActionCommand(LaTeXDrawResources.LABEL_CLOSED_BEZIER_CURVE); drawButtonGroup.add(buttonImageClosedBezierCurve); ltb.addComponent(buttonImageClosedBezierCurve); buttonImageBezierCurve = new JToggleButton(LaTeXDrawResources.bezierCurveIcon); buttonImageBezierCurve.addActionListener(ml); buttonImageBezierCurve.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageBezierCurve.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.132")); //$NON-NLS-1$ buttonImageBezierCurve.setActionCommand(LaTeXDrawResources.LABEL_BEZIER_CURVE); drawButtonGroup.add(buttonImageBezierCurve); ltb.addComponent(buttonImageBezierCurve); ltb.addSeparator(); ltb = new ListJToggleButton(parentFrame, LaTeXDrawResources.gridIcon, ListJToggleButton.LOCATION_SOUTH); ltb.setToolTipText(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.16")); //$NON-NLS-1$ buttonImageGrid = new JToggleButton(LaTeXDrawResources.gridIcon); buttonImageGrid.addActionListener(ml); buttonImageGrid.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageGrid.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.133")); //$NON-NLS-1$ buttonImageGrid.setActionCommand(LaTeXDrawResources.LABEL_GRID); drawButtonGroup.add(buttonImageGrid); ltb.addComponent(buttonImageGrid); buttonImageAxes = new JToggleButton(LaTeXDrawResources.axesIcon); buttonImageAxes.addActionListener(ml); buttonImageAxes.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageAxes.setToolTipText(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.17")); //$NON-NLS-1$ buttonImageAxes.setActionCommand(LaTeXDrawResources.LABEL_AXES); drawButtonGroup.add(buttonImageAxes); ltb.addComponent(buttonImageAxes); ltb.addSeparator(); add(ltb); buttonImagePointsAkin = new JToggleButton(LaTeXDrawResources.pointsAkinIcon); buttonImagePointsAkin.addActionListener(ml); buttonImagePointsAkin.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImagePointsAkin.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.7")); //$NON-NLS-1$ buttonImagePointsAkin.setActionCommand(LaTeXDrawResources.LABEL_POINTS_AKIN); drawButtonGroup.add(buttonImagePointsAkin); add(buttonImagePointsAkin); buttonImageText = new JToggleButton(LaTeXDrawResources.textIcon); buttonImageText.addActionListener(ml); buttonImageText.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageText.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.60")); //$NON-NLS-1$ buttonImageText.setActionCommand(LaTeXDrawResources.LABEL_TEXT); drawButtonGroup.add(buttonImageText); add(buttonImageText); addSeparator(); buttonImageSelect = new JToggleButton(LaTeXDrawResources.selectIcon); buttonImageSelect.addActionListener(ml); buttonImageSelect.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageSelect.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.136") + //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.137") + //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.138")); //$NON-NLS-1$ buttonImageSelect.setActionCommand(LaTeXDrawResources.LABEL_SELECT_FIGURE); drawButtonGroup.add(buttonImageSelect); drawButtonGroup.setSelected(buttonImageSelect.getModel(), true); add(buttonImageSelect); buttonImageDel = new JButton(LaTeXDrawResources.delIcon); buttonImageDel.addActionListener(ml); buttonImageDel.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageDel.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.139")); //$NON-NLS-1$ buttonImageDel.setActionCommand(LaTeXDrawResources.LABEL_DELETE); buttonImageDel.setEnabled(false); add(buttonImageDel); addSeparator(); buttonImageProperties = new JButton(LaTeXDrawResources.propertiesIcon); buttonImageProperties.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.140")); //$NON-NLS-1$ buttonImageProperties.addActionListener(ml); buttonImageProperties.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageProperties.setActionCommand(LaTeXDrawResources.LABEL_FIGURE_PROPERTIES); buttonImageProperties.setEnabled(false); add(buttonImageProperties); addSeparator(); buttonImageBorders = new JToggleButton(LaTeXDrawResources.bordersIcon); buttonImageBorders.addActionListener(ml); buttonImageBorders.setMargin(LaTeXDrawFrame.INSET_BUTTON); buttonImageBorders.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.141") + //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.142") + //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.143") + //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.144")); //$NON-NLS-1$ buttonImageBorders.setActionCommand(LaTeXDrawResources.LABEL_DISPLAY_BORDERS); add(buttonImageBorders); button = new JButton(LaTeXDrawResources.texEditorIcon); button.addActionListener(parentFrame); button.setMargin(LaTeXDrawFrame.INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.18")); //$NON-NLS-1$ button.setActionCommand(LaTeXDrawResources.LABEL_TEX_EDITOR); add(button); copyCodeButton = new JButton(LaTeXDrawResources.copyIcon); copyCodeButton.addActionListener(parentFrame.getCodePanel()); copyCodeButton.setMargin(LaTeXDrawFrame.INSET_BUTTON); copyCodeButton.setToolTipText(CodePanel.LABEL_COPY_ALL); copyCodeButton.setActionCommand(CodePanel.LABEL_COPY_ALL); copyCodeButton.setVisible(!LaTeXDrawFrame.DEFAULT_DISPLAY_CODEPANEL); add(copyCodeButton); copyCodeSelButton = new JButton(LaTeXDrawResources.copySelIcon); copyCodeSelButton.addActionListener(parentFrame.getCodePanel()); copyCodeSelButton.setMargin(LaTeXDrawFrame.INSET_BUTTON); copyCodeSelButton.setToolTipText(CodePanel.LABEL_COPY_SELECTED_FIG); copyCodeSelButton.setActionCommand(CodePanel.LABEL_COPY_SELECTED_FIG); add(copyCodeSelButton); } /** * @return the persoGridGapField. * @since 2.0.0 */ public JSpinner getPersoGridGapField() { return persoGridGapField; } /** * @return the magneticCB. * @since 2.0.0 */ public JCheckBox getMagneticCB() { return magneticCB; } /** * @return the sliderDelimitor. * @since 2.0.0 */ public JSlider getSliderDelimitor() { return sliderDelimitor; } /** * @return the copyCodeButton. * @since 2.0.0 */ public JButton getCopyCodeButton() { return copyCodeButton; } /** * @return the copyCodeSelButton. * @since 2.0.0 */ public JButton getCopyCodeSelButton() { return copyCodeSelButton; } /** * @return the buttonImageLine. * @since 2.0.0 */ public JToggleButton getButtonImageLine() { return buttonImageLine; } /** * @return the buttonImageDot. * @since 2.0.0 */ public JToggleButton getButtonImageDot() { return buttonImageDot; } /** * @return the buttonImageRect. * @since 2.0.0 */ public JToggleButton getButtonImageRect() { return buttonImageRect; } /** * @return the buttonImageSquare. * @since 2.0.0 */ public JToggleButton getButtonImageSquare() { return buttonImageSquare; } /** * @return the buttonImageRhombus. * @since 2.0.0 */ public JToggleButton getButtonImageRhombus() { return buttonImageRhombus; } /** * @return the buttonImageTriangle. * @since 2.0.0 */ public JToggleButton getButtonImageTriangle() { return buttonImageTriangle; } /** * @return the buttonImageEllipse. * @since 2.0.0 */ public JToggleButton getButtonImageEllipse() { return buttonImageEllipse; } /** * @return the buttonImageCircle. * @since 2.0.0 */ public JToggleButton getButtonImageCircle() { return buttonImageCircle; } /** * @return the buttonImageSelect. * @since 2.0.0 */ public JToggleButton getButtonImageSelect() { return buttonImageSelect; } /** * @return the buttonImageBorders. * @since 2.0.0 */ public JToggleButton getButtonImageBorders() { return buttonImageBorders; } /** * @return the buttonImageWedge. * @since 2.0.0 */ public JToggleButton getButtonImageWedge() { return buttonImageWedge; } /** * @return the buttonImageChord. * @since 2.0.0 */ public JToggleButton getButtonImageChord() { return buttonImageChord; } /** * @return the buttonImageArc. * @since 2.0.0 */ public JToggleButton getButtonImageArc() { return buttonImageArc; } /** * @return the buttonImagePoly. * @since 2.0.0 */ public JToggleButton getButtonImagePoly() { return buttonImagePoly; } /** * @return the buttonImageText. * @since 2.0.0 */ public JToggleButton getButtonImageText() { return buttonImageText; } /** * @return the buttonImagePointsAkin. * @since 2.0.0 */ public JToggleButton getButtonImagePointsAkin() { return buttonImagePointsAkin; } /** * @return the buttonImageGrid. * @since 2.0.0 */ public JToggleButton getButtonImageGrid() { return buttonImageGrid; } /** * @return the buttonImageAxes. * @since 2.0.0 */ public JToggleButton getButtonImageAxes() { return buttonImageAxes; } /** * @return the buttonImageBezierCurve. * @since 2.0.0 */ public JToggleButton getButtonImageBezierCurve() { return buttonImageBezierCurve; } /** * @return the buttonImageClosedBezierCurve. * @since 2.0.0 */ public JToggleButton getButtonImageClosedBezierCurve() { return buttonImageClosedBezierCurve; } /** * @return the buttonImageJoinedLines. * @since 2.0.0 */ public JToggleButton getButtonImageJoinedLines() { return buttonImageJoinedLines; } /** * @return the buttonImageDel. * @since 2.0.0 */ public JButton getButtonImageDel() { return buttonImageDel; } /** * @return the buttonImageProperties. * @since 2.0.0 */ public JButton getButtonImageProperties() { return buttonImageProperties; } /** * @return the buttonImageRedo. * @since 2.0.0 */ public JButton getButtonImageRedo() { return buttonImageRedo; } /** * @return the buttonImageUndo. * @since 2.0.0 */ public JButton getButtonImageUndo() { return buttonImageUndo; } /** * @return the zoomField. * @since 2.0.0 */ public JSpinner getZoomField() { return zoomField; } public JButton getButtonPdfExport() { return buttonPdfExport; } } latexdraw-2.0.8+1.orig/latexDraw/ui/components/MenuTemplate.java0000644000000000000000000002532711347255510021511 0ustar package latexDraw.ui.components; import java.awt.Image; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.util.Vector; import javax.swing.ImageIcon; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import latexDraw.figures.Draw; import latexDraw.filters.LaTeXDrawTemplateFilter; import latexDraw.filters.SVGFilter; import latexDraw.generators.svg.SVGDocumentGenerator; import latexDraw.lang.LaTeXDrawLang; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.ui.dialog.ExceptionFrameDialog; import latexDraw.util.LaTeXDrawException; import latexDraw.util.LaTeXDrawPath; import latexDraw.util.LaTeXDrawResources; /** * Defines the menu that contains the templates menu items.
*
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 04/10/07
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class MenuTemplate extends JMenu implements MouseListener { private static final long serialVersionUID = 1L; /** Define if the menu has been constructed. @since 1.9.2 */ protected boolean constructed; /** The parent frame. @since 1.9.2 */ protected LaTeXDrawFrame frame; /** * The constructor. * @param txt The text of the menu. * @param f The parent frame * @since 1.9.2 */ public MenuTemplate(String txt, LaTeXDrawFrame f) { super(txt); frame = f; constructed = false; addMouseListener(this); } public void mouseClicked(MouseEvent e) { // nothing to do. } public void mouseEntered(MouseEvent e) { constructMenu(); } /** * Constructs the menu, only is constructed = false. * @since 1.9.2 */ public void constructMenu() { if(constructed) return ; Vector menus = createMenuItems(LaTeXDrawPath.PATH_TEMPLATES_DIR_USER, LaTeXDrawPath.PATH_CACHE_DIR, false); constructed = true; removeAll(); for(JMenuItem menu : menus) add(menu); if(LaTeXDrawPath.PATH_TEMPLATES_SHARED!=null) { addSeparator(); menus = createMenuItems(LaTeXDrawPath.PATH_TEMPLATES_SHARED, LaTeXDrawPath.PATH_CACHE_SHARE_DIR, true); for(JMenuItem menu : menus) add(menu); } addSeparator(); JMenuItem menu = new JMenuItem(LaTeXDrawResources.LABEL_TEMPLATE_UPDATE, LaTeXDrawResources.reloadIcon); menu.addActionListener(frame); menu.setActionCommand(LaTeXDrawResources.LABEL_TEMPLATE_UPDATE); add(menu); } /** * Creates a list of JMenuItem from the given directory of templates. * @param pathTemplate The path of the templates. * @param pathCache The path of the cache of the templates. * @param sharedTemplates True if the templates are shared templates (in the shared directory). * @return The created JMenuItem. * @since 1.9.2 */ private Vector createMenuItems(String pathTemplate, String pathCache, boolean sharedTemplates) { File templateDir = new File(pathTemplate); int i, id; SVGFilter filter = new SVGFilter(); File[] files = templateDir.listFiles(); char shared = sharedTemplates ? '1' : '0'; Vector menuItems = new Vector(); if(files!=null) for(i=0; i * @param nameThumb The name of the jpg file: file.jpg * @return The created JMenuItem. */ private JMenuItem createTemplateMenuItem(String nameThumb, String path) { JMenuItem menu=null; ImageIcon icon=null; String name = nameThumb; boolean updated = false; boolean imageOk = false; int id; while(!imageOk) try { Image image = LaTeXDrawFrame.convertFrame.getImage(new File(path+File.separator+name)); icon = new ImageIcon(image); image.flush(); imageOk = true; } catch(Exception e) { if(updated) imageOk = true; else { updateTemplates(); updated = true; } } id = name.indexOf(LaTeXDrawResources.PNG_EXTENSION); if(id!=-1) { name = name.substring(0, id); id = name.indexOf(name.endsWith(SVGFilter.SVG_EXTENSION) ? SVGFilter.SVG_EXTENSION : LaTeXDrawResources.TEMPLATE_EXTENSION); if(id!=-1) { name = name.substring(0, id); if(icon==null) icon = LaTeXDrawResources.emptyIcon; menu = new JMenuItem(name,icon); menu.addActionListener(frame); } } return menu; } public void mouseExited(MouseEvent e) { // nothing to do. } public void mousePressed(MouseEvent e) { // nothing to do. } public void mouseReleased(MouseEvent e) { // nothing to do. } /** * @return the constructed. * @since 1.9.2 */ public boolean isConstructed() { return constructed; } /** * @param constructed the constructed to set. * @since 1.9.2 */ public void setConstructed(boolean constructed) { this.constructed = constructed; } /** * Adds a menu item to the menu. * @param templateName The name of the new template item. * @since 1.9.2 */ public void addItem(String templateName) { if(templateName==null) throw new IllegalArgumentException(); JMenuItem menu = createTemplateMenuItem(templateName + SVGFilter.SVG_EXTENSION + LaTeXDrawResources.PNG_EXTENSION, LaTeXDrawPath.PATH_CACHE_DIR); int i, size = getItemCount(); boolean found = false; String ac = LaTeXDrawResources.TEMPLATE_START_ACTION_CMD+'0'+templateName, ac2; for(i=0; i */ public void updateTemplates() { try { convertOldTemplates(); updateTemplates(LaTeXDrawPath.PATH_TEMPLATES_DIR_USER, LaTeXDrawPath.PATH_CACHE_DIR); updateTemplates(LaTeXDrawPath.PATH_TEMPLATES_SHARED, LaTeXDrawPath.PATH_CACHE_SHARE_DIR); } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } /** * Allows to get the figures from a templates * @param file The file containing the template * @return The figures */ public static Draw readOldTemplate(File file) { try { Draw template; FileInputStream fis = new FileInputStream(file); ObjectInputStream in = new ObjectInputStream(fis); String nameApp = (String)in.readObject(); if(!nameApp.equals(LaTeXDrawResources.TOKEN_TEMPLATE_FILE)) throw new LaTeXDrawException(LaTeXDrawException.NOT_TEXDRAW_FILE); LaTeXDrawFrame.setVersionOfFile((String)in.readObject()); template = (Draw)in.readObject(); in.close(); fis.close(); return template; }catch(LaTeXDrawException e) { JOptionPane.showMessageDialog(null, LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.161")//$NON-NLS-1$ + file.getAbsolutePath()+", "+e.toString(), //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.86"), //$NON-NLS-1$ JOptionPane.WARNING_MESSAGE); }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } return null; } public void convertOldTemplates() { convertOldTemplates(LaTeXDrawPath.PATH_TEMPLATES_DIR_USER, LaTeXDrawPath.PATH_CACHE_DIR); convertOldTemplates(LaTeXDrawPath.PATH_TEMPLATES_SHARED, LaTeXDrawPath.PATH_CACHE_SHARE_DIR); } private void convertOldTemplates(String pathTemplates, String pathCache) { if(pathTemplates==null || pathCache==null) return ; LaTeXDrawTemplateFilter oldFilter = new LaTeXDrawTemplateFilter(); File dir = new File(pathTemplates); if(dir.isDirectory() && dir.canRead() && dir.canWrite()) { File[] files = new File(pathTemplates).listFiles(); String path; int id; File testFile; Draw d; for(File f : files) if(oldFilter.accept(f)) { path = f.getPath(); id = path.indexOf(LaTeXDrawResources.TEMPLATE_EXTENSION); if(id!=-1) { testFile = new File(path.substring(0, id) + SVGFilter.SVG_EXTENSION); if(!testFile.exists()) { d = readOldTemplate(f); try { SVGDocumentGenerator.exportAsSVG(testFile.getPath(), d); } catch(IOException e) { e.printStackTrace(); } } } } } } /** * Updates the templates from the given path, in the given cache path. * @param pathTemplate The path of the templates to update. * @param pathCache The path where the cache of the thumbnails of the templates will be stored. * @since 1.9.2 */ private void updateTemplates(String pathTemplate, String pathCache) { File templateDir = new File(pathTemplate); File thumbnail; if(!templateDir.exists() || !templateDir.isDirectory()) return ; // There is no template // We get the list of the templates SVGFilter filter = new SVGFilter(); File[] files = templateDir.listFiles(); int i; Draw template; // We export the updated template if(files!=null) for(i=0; i *
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/21/08
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class MagneticGrid { /** The max dimension of the grid. */ public static final int MAX_WIDTH_HEIGHT = 2000; public static final BasicStroke STROKE = new BasicStroke(0, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER); /** The gap by default between two lines of the personal grid. */ public static final int DEFAULT_PERSONAL_GRID_GAP = 10; public static final short TYPE_PERSONAL = 0; public static final short TYPE_INCH = 1; public static final short TYPE_CM = 2; public static final short DEFAULT_TYPE = TYPE_PERSONAL; /** Allows to know if the grid is magnetic or not. */ protected boolean isMagnetic; protected int persoInterval; protected transient BufferedImage buffer; protected int width; protected int height; protected short type; protected double zoom; protected int pixelsPerCm; /** Allows to know if the grid must be displayed */ protected boolean isGridDisplayed; public MagneticGrid(int width, int height, int ppc, double zoom) { if(width<0 || height<0 || ppc<1 || zoom<=0) throw new IllegalArgumentException(); isMagnetic = false; this.width = width>MAX_WIDTH_HEIGHT ? MAX_WIDTH_HEIGHT : width; this.height = height>MAX_WIDTH_HEIGHT ? MAX_WIDTH_HEIGHT : height; buffer = null; this.zoom = zoom; pixelsPerCm = ppc; isGridDisplayed = true; persoInterval = DEFAULT_PERSONAL_GRID_GAP; reInitGrid(); } public void paint(Graphics2D g) { if(buffer!=null && isGridDisplayed()) g.drawImage(buffer, 0, 0, null); } @SuppressWarnings("fallthrough") public void updateBuffer() { if(getHeight()==0 || getWidth()==0) { if(buffer!=null) buffer.flush(); buffer = null; } else { if(buffer==null) buffer = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g = (Graphics2D)buffer.getGraphics(); double ppc = pixelsPerCm, i, j, gap = persoInterval; g.setColor(Color.WHITE); g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(Color.BLACK); g.setStroke(STROKE); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); switch(type) { case TYPE_INCH: ppc*=PSTricksConstants.INCH_VAL_CM; case TYPE_CM: gap = ppc; if(ppc>20) { if(ppc/10.!=(int)(ppc/10.)) { ppc = Math.rint(ppc/10.)*10.; gap = ppc; } double pixPerCm10 = ppc/10.; int cpt; ppc*=getZoom(); pixPerCm10*=getZoom(); for(i=pixPerCm10-1; i * for instance, if the grid is not magnetic, considerGridIsMagnetic=false and a grid is * displayed, the returned point will be a transformed point according to the magnetic grid.
* If the grid is not magnetic and considerGridIsMagnetic=true, the returned point will * be a clone of the point given in parameter. * @return The transformed point or if there is no magnetic grid, a clone of the given point. */ public Point getTransformedPointToGrid(Point pt, boolean considerGridIsMagnetic) { if(isMagnetic() || (!considerGridIsMagnetic && isGridDisplayed())) { Point point = (Point)pt.clone(); double modulo = getMagneticGridGap(); double x = point.x; double y = point.y; int base = (int)(((int)(x/modulo))*modulo); if(x>modulo) x = x%((int)modulo); double res = modulo-x; x = base; if(resmodulo) y = y%((int)modulo); res = modulo-y; y = base; if(res0.5? ((int)gap)+1 : (int)gap; } return gap; } public void reInitGrid() { type = DEFAULT_TYPE; persoInterval = DEFAULT_PERSONAL_GRID_GAP; isMagnetic = false; updateBuffer(); } /** * @return the isMagnetic * @since 2.0.0 */ public boolean isMagnetic() { return isMagnetic; } /** * @param isMagnetic the isMagnetic to set * @since 2.0.0 */ public void setMagnetic(boolean isMagnetic) { this.isMagnetic = isMagnetic; } /** * @return the interval * @since 2.0.0 */ public int getPersoInterval() { return persoInterval; } /** * @param interval the interval to set * @since 2.0.0 */ public void setPersoInterval(int interval) { if(interval>1) { int oldInter = this.persoInterval; this.persoInterval = interval; if(oldInter!=persoInterval && isGridDisplayed()) updateBuffer(); } } public boolean isPersonalGrid() { return getType()==TYPE_PERSONAL; } /** * @return the width * @since 2.0.0 */ public int getWidth() { return width; } /** * @param width the width to set * @since 2.0.0 */ public void setWidth(int width) { if(width>=0) { int oldW = this.width; this.width = width>MAX_WIDTH_HEIGHT ? MAX_WIDTH_HEIGHT : width; if(oldW!=getWidth() && getHeight()>0 && getWidth()>0) { if(buffer!=null) buffer.flush(); buffer = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); updateBuffer(); } } } /** * @return the height * @since 2.0.0 */ public int getHeight() { return height; } /** * @param height the height to set * @since 2.0.0 */ public void setHeight(int height) { if(height>=0) { int oldH = this.height; this.height = height>MAX_WIDTH_HEIGHT ? MAX_WIDTH_HEIGHT : height; if(oldH!=getHeight() && getWidth()>0 && getHeight()>0) { if(buffer!=null) buffer.flush(); buffer = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); updateBuffer(); } } } /** * @return the buffer * @since 2.0.0 */ public BufferedImage getBuffer() { return buffer; } /** * @return the type * @since 2.0.0 */ public short getType() { return type; } /** * @param type the type to set * @since 2.0.0 */ public void setType(short type) { if(type==TYPE_CM || type==TYPE_INCH || type==TYPE_PERSONAL) { short oldType = this.type; this.type = type; if(oldType!=type && isGridDisplayed()) updateBuffer(); } } /** * @return The zoom. * @since 2.0.0 */ public double getZoom() { return zoom; } /** * @param zoom The zoom to set. * @since 2.0.0 */ public void setZoom(double zoom) { if(zoom>0) { double oldZ = this.zoom; this.zoom = zoom; if(oldZ!=zoom && isGridDisplayed()) updateBuffer(); } } /** * @return the pixelsPerCm * @since 2.0.0 */ public int getPixelsPerCm() { return pixelsPerCm; } /** * @param pixelsPerCm the pixelsPerCm to set * @since 2.0.0 */ public void setPixelsPerCm(int pixelsPerCm) { if(pixelsPerCm>0) { int oldPPC = this.pixelsPerCm; this.pixelsPerCm = pixelsPerCm; if(oldPPC!=pixelsPerCm && isGridDisplayed()) updateBuffer(); } } /** * @return The isGridDisplayed. * @since 2.0.0 */ public boolean isGridDisplayed() { return isGridDisplayed; } /** * @param isGridDisplayed The isGridDisplayed to set. * @since 2.0.0 */ public void setGridDisplayed(boolean isGridDisplayed) { this.isGridDisplayed = isGridDisplayed; if(isGridDisplayed) updateBuffer(); } } latexdraw-2.0.8+1.orig/latexDraw/ui/components/LaTeXDrawComboBox.java0000644000000000000000000000447211347255510022333 0ustar package latexDraw.ui.components; import java.awt.event.ItemEvent; import javax.swing.JComboBox; import javax.swing.JLabel; import latexDraw.ui.dialog.ExceptionFrameDialog; /** * This class change only on function of the mother class ComboBox : the method * setSelectedItem ; by default this method selected a given object in the list. but * in our case, we want the selected the object whose name is the string given in parameter *
* This file is part of LaTeXDraw
* Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public class LaTeXDrawComboBox extends JComboBox { private static final long serialVersionUID = 1L; @Override public void setSelectedItem(Object anObject) { try { int i, size = getItemCount(); boolean found = false; Object o=null; if(anObject instanceof JLabel) o = anObject; else { if(!(anObject instanceof String)) throw new ClassCastException(); if(size==0) return ; for(i=0; i * Copyright (c) 2005-2008 Arnaud BLOUIN
*
* LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
*
* LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
*
* 01/20/06
* @author Arnaud BLOUIN
* @version 2.0.0
*/ public final class DrawContainer extends JComponent implements Scrollable, Printable { private static final long serialVersionUID = 1L; /** Correspond to the figures of the drawing */ private Vector
figures; /** The parent of the DrawContainer (a @see DrawPanel) */ private transient DrawPanel parentPanel; /** Allow to adjust (and to see) the complete borders of the drawing.
* @see #bordersReal for more informations */ private DrawBorders bordersComplete; /** Define the real borders of the drawing:
* It's different from @see bordersComplete because bordersComplete considers the thickness, * the double borders, ... of the figures ; whereas bordersReal just consider the coordinates * of the figures (Useful for the code generation, because bordersComplete is not adapted for that. */ private DrawBorders bordersReal; /** Allow to know if the user want or not to display to borders of the drawing */ private boolean drawBorders; /** Correspond to the @see Figure selected by the user */ private Draw selected; /** Allows to know if the user want to adjust automatically the borders * of the drawing */ private boolean autoAdjustement; /** Allows to know if the menu "selection" is selected */ private boolean inSelection; /** Corresponds to the number of pixels per centimetre */ private int pixelsPerCm; /** The unit used to measure the number of pixels per cm */ private String unitForPixelsPerCm; /** Allows to know if the drawing has been modified */ private boolean isModified; /** The value of the antialiasing (cf. RenderingHints.VALUE_ANTIALIAS_ON/OFF) */ private transient Object antiAliasingValue; /** The value of the rendering (cf. RenderingHints.VALUE_RENDER_QUALITY/SPEED) */ private transient Object renderingValue; /** The value of the colour rendering (cf. RenderingHints.VALUE_COLOR_RENDER_QUALITY/SPEED) */ private transient Object colorRenderingValue; /** The value of the alpha-interpolation ( cf. RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY/SPEED */ private transient Object alphaInterpolValue; /** The value by default of the anti-aliasing */ public static final Object DEFAULT_ANTIALIASING_VAL = RenderingHints.VALUE_ANTIALIAS_ON; /** The value by default of the rendering */ public static final Object DEFAULT_RENDERING_VAL = RenderingHints.VALUE_RENDER_QUALITY; /** The value by default of the colour rendering */ public static final Object DEFAULT_COLORRENDER_VAL = RenderingHints.VALUE_COLOR_RENDER_QUALITY; /** The value by default of the alpha-interpolation */ public static final Object DEFAULT_ALPHAINTER_VAL = RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY; /** The value we add to the zoom when to user click on a zoom button */ public static final double DEFAULT_ADD_ZOOM = 0.25; /** The number by default of pixels per cm */ public static final int DEFAULT_PIXPERCM = 50; /** The zoom by default (100%) */ public static final double DEFAULT_ZOOM = 1.; /** The biggest zoom we can do */ public static final double MAX_ZOOM = 4.5; /** The smallest zoom we can do */ public static final double MIN_ZOOM = 0.25; /** Corresponds to a possible value of whichCodeOutput attribute. @since 2.0.0 */ public static final short CODE_PSTRICKS = 0; /** Contains to figure copied or cut */ protected Draw copiedFigure; /** The zoom : MIN_ZOOM<=zoom<=MAX_ZOOM */ private double zoom; /** Define if the figure must be rotated. */ private boolean onRotation; /** Define the code that will be generated. @since 2.0.0 */ protected short whichCodeOutput; /** The grid of the panel. @since 2.0.0 */ protected MagneticGrid grid; /** * The constructor by default. */ public DrawContainer() { this(false); } /** * The constructor by default. * @param displayBorders Allow to know if the borders of the drawing. * must be displayed */ public DrawContainer(boolean displayBorders) { setWhichCodeOutput(CODE_PSTRICKS); onRotation = false; zoom = DEFAULT_ZOOM; drawBorders = displayBorders; selected = new Draw(false, false); figures = new Vector
(); pixelsPerCm = DEFAULT_PIXPERCM; inSelection = true; setIsModified(false); renderingValue = DEFAULT_RENDERING_VAL; alphaInterpolValue = DEFAULT_ALPHAINTER_VAL; colorRenderingValue = DEFAULT_COLORRENDER_VAL; antiAliasingValue = DEFAULT_ANTIALIASING_VAL; setDoubleBuffered(true); grid = new MagneticGrid(getWidth(), getHeight(), pixelsPerCm, zoom); } /** * Allows to delete a given figure of the drawing * @param f The figure to remove */ public void deleteFigure(Figure f, UndoRedoManager manager) { if(f!=null && figures.contains(f)) { if(manager!=null) manager.add(UndoRedoManager.LABEL_DEL, figures.indexOf(f), f); figures.remove(f); selected.removeFigure(f); parentPanel.updateDraw(true); } } /** * Allows to set if figures must be in rotation or not * @param on True : the figures must be in rotation */ public void setOnRotation(boolean on) { onRotation = on; if(!selected.isEmpty()) { selected.setOnRotation(on); repaint(); } } /** * Allows to know if figures are in rotation or not * @return True : figures are in rotation */ public boolean isOnRotation() { return onRotation; } /** * Allows to know if a a figure is selected * @return True if a figure is selected */ public boolean isAFigureSelected() { return !selected.isEmpty(); } /** * Allows to get the vector containing the figures * @return The vector containing the figures */ public Vector
getFigures() { return figures; } /** * Allows to put some figures f1 behind the figure f2 * @param f1 The drawing to put behind f2 * @param f2 The figure to put in front of f1 */ public void putBehind(Draw f1, Figure f2) { if(f1==f2 || f1==null || f2==null || f1.isEmpty()) return ; try { int i, size = f1.size(); int[] oldId = new int[size], id = new int[size]; Figure f; for(i=size-1; i>=0; i--) { f = f1.getFigureAt(i); oldId[i] = figures.indexOf(f); putBehind(f, f2); id[i] = figures.indexOf(f); } UndoRedoManager manager = parentPanel.getFrameParent().getUndoManager(); manager.add(UndoRedoManager.LABEL_CHANGE_DISPOSITION, id, oldId, false); parentPanel.getFrameParent().updateUndoRedo(); }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } /** * Allows to put the figure f1 behind the figure f2 * @param f1 The figure to put behind f2 * @param f2 The figure to put in front of f1 */ public void putBehind(Figure f1, Figure f2) { if(f1==f2 || f1==null || f2==null) return; try { if(!figures.contains(f1) || !figures.contains(f2)) throw new IllegalArgumentException(); int id1 = figures.indexOf(f1), id2 = figures.indexOf(f2); if(id1>=id2) { figures.remove(f1); figures.add(id2, f1); repaint(); } }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } /** * Allows to put some figures f1 in front of the figure f2 * @param f1 The drawing to put in front of f2 * @param f2 The figure to put behind f1 */ public void putInFrontOf(Draw f1, Figure f2) { if(f1==f2 || f1==null || f2==null || f1.isEmpty()) return ; try { int i, size = f1.size(); int[] oldId = new int[size], id = new int[size]; for(i=0; i=0; i--) { Figure f = selected.getFigureAt(i); if(figures.contains(f)) { oldId[i] = figures.indexOf(f); figures.remove(f); figures.add(0, f); id[i] = 0; repaint(); } else throw new LaTeXDrawException(LaTeXDrawException.INCORRECT_VALUE); } UndoRedoManager manager = parentPanel.getFrameParent().getUndoManager(); manager.add(UndoRedoManager.LABEL_CHANGE_DISPOSITION, id, oldId, false); parentPanel.getFrameParent().updateUndoRedo(); } } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } /** * Allows to put the selected figure in the foreground */ public void selectedInForeground() { try { if(selected!=null && !selected.isEmpty()) { int i, size = selected.size(); int[] oldId = new int[size], id = new int[size]; for(i=0; i=MIN_ZOOM) { zoom=z; grid.setZoom(z); repaint(); updatePreferredSize(); revalidate(); setIsModified(true); } } /** * Allows to zoom out the drawing (up to 25%). */ public void zoomOut() { if(zoom-DEFAULT_ADD_ZOOM>=MIN_ZOOM) { zoom-=DEFAULT_ADD_ZOOM; grid.setZoom(zoom); repaint(); updatePreferredSize(); revalidate(); setIsModified(true); } } /** * Allows to set the zoom to default. */ public void zoomDefault() { if(zoom!=DEFAULT_ZOOM) { zoom = DEFAULT_ZOOM; grid.setZoom(zoom); repaint(); updatePreferredSize(); revalidate(); setIsModified(true); } } /** * Allows to get the current zoom. * @return The zoom. */ public double getZoom() { return zoom; } /** * Allows to set the value of the anti-aliasing by default. */ public void setAntiAliasByDefault() { antiAliasingValue = DEFAULT_ANTIALIASING_VAL; } /** * Allows to set the value of the colour rendering by default. */ public void setRenderingcolorByDefault() { colorRenderingValue = DEFAULT_COLORRENDER_VAL; } /** * Allows to set the value of the rendering by default. */ public void setRenderingByDefault() { renderingValue = DEFAULT_RENDERING_VAL; } /** * Allows to set the value of the alpha interpolation by default. */ public void setAlphaInterByDefault() { alphaInterpolValue = DEFAULT_ALPHAINTER_VAL; } /** * Allows to set the value of the anti-aliasing value * @param useAntiAlias True : anti-aliasing must be used */ public void setAntiAliasingValue(boolean useAntiAlias) { if(useAntiAlias) antiAliasingValue = RenderingHints.VALUE_ANTIALIAS_ON; else antiAliasingValue = RenderingHints.VALUE_ANTIALIAS_OFF; } /** * Allows to set the value of the colour rendering value * @param useRenderCol True : colour rendering must be of quality */ public void setRenderingcolorValue(boolean useRenderCol) { if(useRenderCol) colorRenderingValue = RenderingHints.VALUE_COLOR_RENDER_QUALITY; else colorRenderingValue = RenderingHints.VALUE_COLOR_RENDER_SPEED; } /** * Allows to set the value of the rendering value * @param useRender True : rendering must be of quality */ public void setRenderingValue(boolean useRender) { if(useRender) renderingValue = RenderingHints.VALUE_RENDER_QUALITY; else renderingValue = RenderingHints.VALUE_RENDER_SPEED; } /** * Allows to set the value of the anti-aliasing value * @param useAlphaInter True : anti-aliasing must be used */ public void setAlphaInterValue(boolean useAlphaInter) { if(useAlphaInter) alphaInterpolValue = RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY; else alphaInterpolValue = RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED; } /** * Allows to get the anti-aliasing value * @return The anti-aliasing value */ public Object getAntiAliasingValue() { return antiAliasingValue; } /** * Allows to get the alpha-interpolation value * @return The alpha-interpolation value */ public Object getAlphaInterValue() { return alphaInterpolValue; } /** * Allows to get the colour rendering value * @return The colour rendering value */ public Object getColorRenderValue() { return colorRenderingValue; } /** * Allows to get the rendering value * @return The rendering value */ public Object getRenderingValue() { return renderingValue; } /** * Allows to add a figure to the vector of figures * @param f The figure to add */ public void addFigure(Figure f, UndoRedoManager manager) { if(figures.add(f)) setIsModified(true); if(manager!=null) manager.add(UndoRedoManager.LABEL_CREATE, figures.size()-1, null); } /** * Allows to copy a drawContainer is the current drawContainer * @param draw The drawContainer to copy */ public void copy(DrawContainer draw) { try { if(figures!=null) figures.clear(); figures = draw.figures; for(int i=0, size=figures.size(); i1) selected.getFigureAt(0).setSelected(false); } else for(Figure f : figures) if(f!=null && f.intersected(r) && selected.contains(f)) { f.setSelected(false); selected.removeFigure(f); } selected.setSelected(true); selected.setOnRotation(isOnRotation()); } /** * Defines the borders of the drawing. */ public void updateBorders() { int i, size = figures.size(); Figure f; try { if(size>0) { f = figures.firstElement(); // We must define the entire borders (considering the double boundary, the thickness,...) // and the real borders (consider only the real coordinates of the figures). LaTeXDrawPoint2D NWpt = f.getTheNWBoundPoint(); LaTeXDrawPoint2D SEpt = f.getTheSEBoundPoint(); LaTeXDrawPoint2D NWptReal = (LaTeXDrawPoint2D)f.getTheNWRotatedPoint().clone(); LaTeXDrawPoint2D SEptReal = (LaTeXDrawPoint2D)f.getTheSERotatedPoint().clone(); for(i=1; iSEpt.x) SEpt.x = curSEpt.x; if(curSEpt.y>SEpt.y) SEpt.y = curSEpt.y; if(curNWptReal.xSEptReal.x) SEptReal.x = curSEptReal.x; if(curSEptReal.y>SEptReal.y) SEptReal.y = curSEptReal.y; } if(bordersReal==null) bordersReal = new DrawBorders(NWptReal, SEptReal, true, false, false); else { bordersReal.setFirstPoint(NWptReal); bordersReal.setLastPoint(SEptReal); } if(bordersComplete==null) { bordersComplete = new DrawBorders(NWpt, SEpt, autoAdjustement, inSelection, false); boolean state = parentPanel.getFrameParent().isAutoAdjustBorders(); bordersComplete.setSelected(!state && inSelection); autoAdjustement = state; } else { LaTeXDrawPoint2D NW = bordersComplete.getTheNWPoint(); LaTeXDrawPoint2D SE = bordersComplete.getTheSEPoint(); if(!autoAdjustement) { if(NW.x>NWpt.x) if(NW.y>NWpt.y) bordersComplete.setFirstPoint(NWpt); else bordersComplete.setFirstPoint(new LaTeXDrawPoint2D(NWpt.x, NW.y)); else if(NW.y>NWpt.y) bordersComplete.setFirstPoint(new LaTeXDrawPoint2D(NW.x, NWpt.y)); if(SE.x0) else { if(bordersComplete!=null) { bordersComplete.setFirstPoint(0, 0); bordersComplete.setLastPoint(0, 0); } if(bordersReal!=null) { bordersReal.setFirstPoint(0, 0); bordersReal.setLastPoint(0, 0); } } }catch(Exception e) { e.printStackTrace(); } } /** * This method allows the user to delete the selected figure */ public void deleteSelection(UndoRedoManager manager) { if(figures!=null && !selected.isEmpty()) { int i, size = selected.size(); int[] id = new int[size]; for(i=0; i0) { showErrorDialogLatexCompilation(log); pdfFile = null; } tmpDir.delete(); return pdfFile; } /** * Allows to export the drawing as a eps file * @param file The new eps file */ public void exportAsEPS(File file) { try { if(bordersComplete==null) updateBorders(); LaTeXDrawPoint2D NW = bordersComplete.getTheNWPoint(), SE = bordersComplete.getTheSEPoint(); int dec = 5; FileOutputStream finalImage = new FileOutputStream(file); EpsGraphics2D g = new EpsGraphics2D("LaTeXDraw", //$NON-NLS-1$ finalImage, (int)(NW.x-dec), (int)(NW.y-dec), (int)(SE.x+dec), (int)(SE.y+dec)); selected.setSelected(false); paintFigures(g, false, false); g.flush(); g.close(); finalImage.close(); selected.setSelected(true); } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } /** * Allows to export the drawing as a PPM file * @param file The new PPM file */ public void exportAsPPMFile(File file) { BufferedImage bufImage = createRenderedImage(); if(bufImage==null) return ; try { PNMCodec codec = new PNMCodec(); codec.setFile(file.getAbsolutePath(), CodecMode.SAVE); BufferedRGB24Image img = new BufferedRGB24Image(bufImage); codec.setImage(img); codec.process(); codec.close(); bufImage.flush(); bufImage = null; img = null; codec = null; } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } /** * Allows to export the drawing as a bmp file * @param file The new bmp file */ public void exportAsBMP(File file) { RenderedImage rendImage = createRenderedImage(); if(rendImage==null) return ; try { ImageWriteParam iwparam = new BMPImageWriteParam(); iwparam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); ImageWriter iw = ImageIO.getImageWritersByFormatName("bmp").next();//$NON-NLS-1$ ImageOutputStream ios = ImageIO.createImageOutputStream(file); iw.setOutput(ios); iw.write(null, new IIOImage(rendImage, null, null), iwparam); iw.dispose(); ios.close(); } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } /** * Allows to export the drawing as a png file * @param file The new png file */ public void exportAsPNG(File file) { RenderedImage rendImage = createRenderedImage(); if(rendImage==null) return ; try { ImageIO.write(rendImage, "png", file); } //$NON-NLS-1$ catch(IOException e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } /** * Allows to export the drawing as a jpg file. * @param file The new jpg file. * @param compressionRate The compression rate of the pictures. */ public void exportAsJPG(File file, float compressionRate) { RenderedImage rendImage = createRenderedImage(); if(rendImage==null) return ; try { ImageWriteParam iwparam = new JPEGImageWriteParam(Locale.getDefault()); iwparam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); iwparam.setCompressionQuality(compressionRate); ImageWriter iw = ImageIO.getImageWritersByFormatName("jpg").next();//$NON-NLS-1$ ImageOutputStream ios = ImageIO.createImageOutputStream(file); iw.setOutput(ios); iw.write(null, new IIOImage(rendImage, null, null), iwparam); iw.dispose(); ios.close(); } catch(IOException e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } public BufferedImage createRenderedImage() { try {// Creation of the first buffer : the drawing and the empty white space if(bordersComplete==null) updateBorders(); LaTeXDrawPoint2D NW = bordersComplete.getTheNWPoint(), SE = bordersComplete.getTheSEPoint(); double dec = 5.; double width = Math.abs(NW.x - SE.x)+dec; double height = Math.abs(NW.y - SE.y)+dec; BufferedImage bufferImage = new BufferedImage( (int)(SE.x+dec), (int)(SE.y+dec), BufferedImage.TYPE_INT_RGB); Graphics2D graphic = bufferImage.createGraphics(); graphic.setColor(Color.WHITE); graphic.fillRect(0, 0, (int)(SE.x+dec), (int)(SE.y+dec)); Draw selection = getSelected(); isSelection(false); paintFigures(graphic, false, false); setSelected(selection); // To delete the empty whitespace, we do a translation to // the North-West point of the drawing (dec : to avoid to cut // the start of some figures, we let a few white space around // the drawing. AffineTransform aff = new AffineTransform(); aff.translate(-NW.x+dec, -NW.y+dec); BufferedImage bufferImage2 = new BufferedImage( (int)(width+dec), (int)(height+dec), BufferedImage.TYPE_INT_RGB); Graphics2D graphic2 = bufferImage2.createGraphics(); graphic2.setColor(Color.WHITE); graphic2.fillRect(0, 0, (int)(width+dec), (int)(height+dec)); // We add quality to the drawing graphic2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); graphic2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); graphic2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); graphic2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); graphic2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); // We draw the new picture graphic2.drawImage(bufferImage, aff, null); graphic.dispose(); graphic2.dispose(); bufferImage.flush(); graphic = null; graphic2 = null; bufferImage = null; return bufferImage2; } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); return null; } } /** * This method allows to know if the project has been * modified or not * @return true if the project has been modified */ public boolean isModified() { return isModified; } /** * This method allow to set the variable "selected" to null * if the user doesn't want to select a figure. * @param is false : the user doesn't want to select a figure */ public void isSelection(boolean is) { try { inSelection = is; if(bordersComplete!=null) { bordersComplete.setSelected(is && !parentPanel.getFrameParent().isAutoAdjustBorders()); repaint(); } if(!is && !selected.isEmpty()) { selected.setSelected(false); selected = new Draw(false, false); selected.setOnRotation(isOnRotation()); repaint(); } } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } public boolean onClick(Point pt, MouseEvent e) { if(pt==null) return false; if(!autoAdjustement && !figures.isEmpty()) { bordersComplete.setSelected(true); if(drawBorders && bordersComplete.isIn(pt)) { selected.setSelected(false); selected.clear(); bordersComplete.onClick(pt); return false; } bordersComplete.onDelimitorRelease(); } boolean isIn = false; int size = figures.size(), i=size-1; try { while(i>=0 && !isIn) if(figures.elementAt(i).isIn(pt)) isIn = true; else i--; if(e.getModifiers()==InputEvent.CTRL_MASK+InputEvent.BUTTON1_MASK) { if(isIn) { Figure f = figures.elementAt(i); if(!selected.contains(f))//Don't add twice the same figure. { selected.addFigure(f); selected.setSelected(true); } return true; } return false; } if(e.getModifiers()==InputEvent.SHIFT_MASK+InputEvent.BUTTON1_MASK) { if(isIn) { Figure f = figures.elementAt(i); if(selected.contains(f)) { f.setSelected(false); selected.removeFigure(f); selected.setSelected(true); } return true; } return false; } if(isIn) { if(selected!=null && selected.contains(figures.elementAt(i))) { selected.setSelected(true); selected.onClick(pt); return true; } if(selected!=null) selected.setSelected(false); selected = new Draw(false, false); selected.setOnRotation(isOnRotation()); selected.addFigure(figures.elementAt(i)); selected.setSelected(true); return true; } if(selected!=null && selected.size()>1 && selected.isIn(pt)) { selected.setSelected(true); selected.onClick(pt); return true; } if(selected!=null) { selected.setSelected(false); selected.clear(); } selected = new Draw(false, false); return false; } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); return false; } } /** * Allows to set the boolean autoAdjustement * @param state It's new state */ public void setAutoAdjustement(boolean state) { if(state!=autoAdjustement) { autoAdjustement = state; setIsModified(true); } if(bordersComplete!=null) if(autoAdjustement) { updateBorders(); bordersComplete.setSelected(false); } else bordersComplete.setSelected(inSelection); updateDraw(); } /** * Allows to set the new selected figure * @param newSelected The new selected figure */ public void setSelected(Figure newSelected) { if(!selected.isEmpty()) selected.setSelected(false); if(newSelected instanceof Draw && !((Draw)newSelected).isDrawFigures()) selected = (Draw) newSelected; else { selected = new Draw(false,false); if(newSelected!=null) selected.addFigure(newSelected); } selected.setSelected(true); selected.setOnRotation(isOnRotation()); } /** * Allows to set the variable isModified * @param state The new state of isModified */ public void setIsModified(boolean state) { isModified = state; if(parentPanel!=null && parentPanel.frameParent!=null) parentPanel.frameParent.setTitle(); } /** * Allows to set the parent of this container * @param p The new parent */ public void setParentPanel(DrawPanel p) { parentPanel = p; } /** * Allows to set the number of pixels per centimetre * @param pPerCm The new number of pixels per centimetre */ public void setPixelsPerCm(int pPerCm) { if(this.pixelsPerCm!=pPerCm) { pixelsPerCm = pPerCm; setIsModified(true); grid.setPixelsPerCm(pPerCm); } } public void paintFigures(Graphics g, boolean withZoom, boolean withGrid) { if(g==null || figures==null) return; Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, antiAliasingValue); g2.setRenderingHint(RenderingHints.KEY_RENDERING, renderingValue); g2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, alphaInterpolValue); g2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, colorRenderingValue); try { if(isGridDisplayed() && withGrid) { if(grid.getHeight()!=getHeight()) grid.setHeight(getHeight()); if(grid.getWidth()!=getWidth()) grid.setWidth(getWidth()); grid.paint(g2); } if(withZoom) g2.scale(getZoom(), getZoom()); int size = figures.size(), i; Figure currentFigure = parentPanel.getCurrentFigure(); for(i = 0; i0) { if(bordersComplete==null) updateBorders(); bordersComplete.draw(g2, antiAliasingValue, renderingValue, alphaInterpolValue, colorRenderingValue); } } catch(Exception e) { e.printStackTrace(); } g.dispose(); } /** * Allows to access to the borders (the axes) of the drawing;
* see bordersReal for more informations. * @return The complete borders of the drawing */ public DrawBorders getCompleteBorders() { return bordersComplete; } /** * Allows to access to the real borders of the drawing;
* see bordersReal for more informations. * @return The real borders of the drawing */ public DrawBorders getRealBorders() { return bordersReal; } /** * Allows to get the pstricks code of the drawing. * @return the pstricks code. */ public String getPSTricksCode() { int i, size = figures.size(); String code = ""; //$NON-NLS-1$ try { for(i=0; i= 1) return Printable.NO_SUCH_PAGE; Graphics2D g2 = (Graphics2D)g; if(bordersComplete==null) updateBorders(); try { LaTeXDrawPoint2D SE = bordersComplete.getTheSEPoint(); g2.translate(pformat.getImageableX(), pformat.getImageableY()); g2.translate(pformat.getImageableWidth()/2, pformat.getImageableHeight()/2); // Id the drawing is to big for the page, we resize the drawing double scale = Math.min( pformat.getImageableWidth()/SE.x, pformat.getImageableHeight()/SE.y); if(scale<1.0) // We resize the drawing g2.scale(scale, scale); g2.translate(-SE.x/2.0, -SE.y/2.0); g2.dispose(); paintFigures(g2, false, false); } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } return Printable.PAGE_EXISTS; } public Dimension getPreferredScrollableViewportSize() { return new Dimension(-100, 100); } public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { return (orientation == SwingConstants.VERTICAL) ? visibleRect.height : visibleRect.width; } public boolean getScrollableTracksViewportHeight() { return getParent() instanceof JViewport ? ((JViewport)getParent()).getHeight() > getPreferredSize().height : false; } public boolean getScrollableTracksViewportWidth() { return getParent() instanceof JViewport ? ((JViewport)getParent()).getWidth() > getPreferredSize().width : false; } public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { return 4; } /** * Copies the selected figures. */ public void copy() { copy(false); } protected void copy(boolean cut) { try { if(!selected.isEmpty()) { final int size = selected.size(); int[] index = new int[size]; int i; copiedFigure = new Draw(false, false); for(i=0; i=0)//$NON-NLS-1$ { int nbFigures = ois.readInt(), i; figures = new Vector
(); for(i=0; i) ois.readObject(); } catch(Exception e) { System.out.println("A figure cannot be read !"); //$NON-NLS-1$ } bordersComplete = (DrawBorders) ois.readObject(); drawBorders = ois.readBoolean(); autoAdjustement = ois.readBoolean(); inSelection = ois.readBoolean(); pixelsPerCm = ois.readInt(); zoom = ois.readDouble(); onRotation = ois.readBoolean(); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.5")>=0)//$NON-NLS-1$ { unitForPixelsPerCm = (String)ois.readObject(); bordersReal = (DrawBorders)ois.readObject(); boolean is18 = LaTeXDrawFrame.getVersionOfFile().compareTo("1.8")>=0;//$NON-NLS-1$ boolean is17 = LaTeXDrawFrame.getVersionOfFile().compareTo("1.7")>=0;//$NON-NLS-1$ for(Figure f : figures)// We have to update the value which were not is pixels in the former releases. { if(is17) f.setShadowSize(f.getShadowSize()*pixelsPerCm); if(is18) f.setHatchingSep(f.getHatchingSep()*pixelsPerCm); if(f instanceof Arrowable) { ArrowHead ah1 = ((Arrowable)f).getArrowHead1(); ArrowHead ah2 = ((Arrowable)f).getArrowHead2(); if(ah1!=null) { ah1.setFigure(f); ah1.setDotSizeDim(ah1.getDotSizeDim()*pixelsPerCm); ah1.setTBarSizeDim(ah1.getTBarSizeDim()*pixelsPerCm); ah1.setArrowSizeDim(ah1.getArrowSizeDim()*pixelsPerCm); } if(ah2!=null) { ah2.setFigure(f); ah2.setDotSizeDim(ah2.getDotSizeDim()*pixelsPerCm); ah2.setTBarSizeDim(ah2.getTBarSizeDim()*pixelsPerCm); ah2.setArrowSizeDim(ah2.getArrowSizeDim()*pixelsPerCm); } } if(f instanceof Axe) ((Axe)f).setTicksSize(((Axe)f).getTicksSize()*pixelsPerCm); if(f instanceof Grid) { ((Grid)f).setGridWidth(((Grid)f).getGridWidth()*pixelsPerCm); ((Grid)f).setSubGridWidth(((Grid)f).getSubGridWidth()*pixelsPerCm); } } } else { unitForPixelsPerCm = XScale.DEFAULT_UNIT; updateBorders(); } grid = new MagneticGrid(getWidth(), getHeight(), pixelsPerCm, zoom); isModified = false; copiedFigure = null; selected = new Draw(false, false); setZoom(zoom); setPixelsPerCm(pixelsPerCm); } /** * Allows to join the selected figures * @param undoManager The undo/redo manager */ public void joinSelection(UndoRedoManager undoManager) { try { if(selected!=null && !selected.isEmpty()) { int size = selected.size(), i, min; if(size<2) return ; Figure f; int[] id = new int[size]; Draw d = new Draw(true, true); Hashtable table = new Hashtable(); for(i=0; i=0; i--) { f = d.getFigureAt(i); figures.add(index, f); selected.addFigure(f, 0); } selected.updateBorders(); selected.setSelected(true); } } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } /** * Creates a thumbnail from the given selection in the given file. * @param templateFile The file of the future thumbnail. * @param selection The drawing the export. * @return True if the creation is successful * @since 1.9.2 */ public boolean createTemplateThumbnail(File templateFile, Draw selection) { try { BufferedImage bufferImage; LaTeXDrawPoint2D SE = selection.getTheSEBoundPoint(); LaTeXDrawPoint2D NW = selection.getTheNWBoundPoint(); double dec=8; double width = Math.abs(SE.x-NW.x)+2*dec, height = Math.abs(SE.y-NW.y)+2*dec, maxSize = 20; bufferImage = new BufferedImage((int)width, (int)height, BufferedImage.TYPE_INT_RGB); Graphics2D graphic = bufferImage.createGraphics(); double scale = Math.min(maxSize/width,maxSize/height); graphic.setColor(Color.WHITE); graphic.fillRect(0, 0, (int)width, (int)height); graphic.scale(scale, scale); graphic.translate(-NW.x+dec, -NW.y+dec); boolean formerIsSelected = selection.isSelected(); boolean formerMustDrawFigures = selection.isDrawFigures(); selection.setSelected(false); selection.setDrawFigures(true); selection.draw(graphic, antiAliasingValue, renderingValue, alphaInterpolValue, colorRenderingValue); selection.setDrawFigures(formerMustDrawFigures); selection.setSelected(formerIsSelected); AffineTransform aff = new AffineTransform(); aff.translate(0, 0); BufferedImage bufferImage2 = new BufferedImage((int)maxSize, (int)maxSize, BufferedImage.TYPE_INT_ARGB); Graphics2D graphic2 = bufferImage2.createGraphics(); graphic2.setColor(Color.WHITE); graphic2.fillRect(0, 0, (int)maxSize, (int)maxSize); graphic2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); graphic2.setRenderingHint(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY); graphic2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); graphic2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,RenderingHints.VALUE_COLOR_RENDER_QUALITY); graphic2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON); // We draw the template graphic2.drawImage(bufferImage, aff, null); // We create the png file with the second picture ImageWriteParam iwparam = new JPEGImageWriteParam(Locale.getDefault()); iwparam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); iwparam.setCompressionQuality(1); ImageWriter iw = ImageIO.getImageWritersByFormatName("png").next();//$NON-NLS-1$ ImageOutputStream ios = ImageIO.createImageOutputStream(templateFile); iw.setOutput(ios); iw.write(null, new IIOImage(bufferImage2, null, null), iwparam); iw.dispose(); ios.close(); graphic.dispose(); graphic2.dispose(); bufferImage.flush(); bufferImage2.flush(); ios = null; iw = null; graphic = null; graphic2 = null; bufferImage = null; bufferImage2 = null; return true; } catch(Exception e) { return false; } } /** * @return Returns the unitForPixelsPerCm. */ public String getUnitForPixelsPerCm() { return unitForPixelsPerCm; } /** * @param unitForPixelsPerCm The unitForPixelsPerCm to set. */ public void setUnitForPixelsPerCm(String unitForPixelsPerCm) { if(unitForPixelsPerCm!=null && !unitForPixelsPerCm.equals(this.unitForPixelsPerCm)) { this.unitForPixelsPerCm = unitForPixelsPerCm; if(!grid.isPersonalGrid()) if(isUnitInCm()) grid.setType(MagneticGrid.TYPE_CM); else grid.setType(MagneticGrid.TYPE_INCH); } } /** * Allows to insert a picture into the drawing * @param undoManager The undo/redo manager * @param path The path of the picture * @return True is the picture is inserted */ public boolean insertPicture(UndoRedoManager undoManager, String path) { try { addFigure(new Picture(true, new LaTeXDrawPoint2D(50,50), path), undoManager); return true; } catch(Exception e) { return false; } } /** * @return the isGridDisplay */ public boolean isGridDisplayed() { return grid.isGridDisplayed(); } @Override public void setSize(int x, int y) { super.setSize(x, y); } /** * @return True is the unit of length is the centimetre. */ public boolean isUnitInCm() { return unitForPixelsPerCm.equals(XScale.LABEL_CM); } /** * @return the personalGridGap. */ public int getPersonalGridGap() { return grid.getPersoInterval(); } /** * @param personalGridGap the personalGridGap to set. * @throws IllegalArgumentException If lesser than 2. */ public void setPersonalGridGap(int personalGridGap) { grid.setPersoInterval(personalGridGap); repaint(); } /** * @return True if a classic grid is displayed. */ public boolean isClassicGridDrawn() { return !grid.isPersonalGrid(); } /** * @param isClassicGridDrawn the isClassicGridDrawn to set. */ public void setClassicGridDrawn(boolean isClassicGridDrawn) { grid.setType(isClassicGridDrawn ? isUnitInCm() ? MagneticGrid.TYPE_CM : MagneticGrid.TYPE_INCH : MagneticGrid.TYPE_PERSONAL); } /** * Rotate the selected figures with a defined angle. * @param angle The angle of rotation in radian. */ public void rotateSelection(double angle) { if(selected!=null && !selected.isEmpty()) { try { Draw clone = (Draw)selected.clone(); int[] id = new int[selected.size()]; for(int i=0, size=selected.size(); i=dec && yMin>=dec) return ; // Already centred double shiftX = 0, shiftY = 0; if(xMin1) selected.clear(); if(selected.size()==1) { Figure f1 = selected.getFigureAt(0); id = figures.indexOf(f1); if(id==-1) return ; if(id==figures.size()-1) id = 0; else id++; selected.removeFigure(f1); f1.setSelected(false); } f2 = figures.elementAt(id); selected.addFigure(f2); selected.setSelected(true); repaint(); parentPanel.frameParent.setSelection(true); } /** * @return the whichCodeOutput. * @since 2.0.0 */ public short getWhichCodeOutput() { return whichCodeOutput; } /** * @param whichCodeOutput the whichCodeOutput to set. * @exception IllegalArgumentException If the given code is not valid. * @since 2.0.0 */ public void setWhichCodeOutput(short whichCodeOutput) { if(whichCodeOutput!= CODE_PSTRICKS) throw new IllegalArgumentException(String.valueOf(whichCodeOutput)); this.whichCodeOutput = whichCodeOutput; } /** * @return The code of the drawing in the language specified by the attribute whichCodeOutput. * @since 2.0.0 */ public String getCode() { switch(whichCodeOutput) { case CODE_PSTRICKS: return getPSTricksCode(); default: throw new IllegalArgumentException(String.valueOf(whichCodeOutput)); } } /** * Define an Element containing the XML attributes of a LaTeXDraw DrawContainer. * @param document The XML document. * @param meta The meta data to complete. * @throws IllegalArgumentException If meta or document is null. * @since 2.0.0 */ public void getXMLMetadata(SVGDocument document, Element meta) { if(document==null || meta==null) throw new IllegalArgumentException(); Element elt = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_DRAW_BORDERS); elt.appendChild(document.createTextNode(String.valueOf(drawBorders))); meta.appendChild(elt); elt = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_AUTO_ADJUST); elt.appendChild(document.createTextNode(String.valueOf(isAutoAdjustement()))); meta.appendChild(elt); if(!isAutoAdjustement() && bordersComplete!=null) {// We have to save the dimension of the borders. LaTeXDrawPoint2D pt = bordersComplete.getTheNWPoint(); elt = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_BORDER); elt.setAttribute(SVGAttributes.SVG_X, String.valueOf(pt.x)); elt.setAttribute(SVGAttributes.SVG_Y, String.valueOf(pt.y)); elt.setAttribute(SVGAttributes.SVG_HEIGHT, String.valueOf(bordersComplete.getHeight())); elt.setAttribute(SVGAttributes.SVG_WIDTH, String.valueOf(bordersComplete.getWidth())); meta.appendChild(elt); } elt = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_PPC); elt.appendChild(document.createTextNode(String.valueOf(getPixelsPerCm()))); meta.appendChild(elt); elt = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_ZOOM); elt.appendChild(document.createTextNode(String.valueOf(getZoom()))); meta.appendChild(elt); elt = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_UNIT); elt.appendChild(document.createTextNode(getUnitForPixelsPerCm())); meta.appendChild(elt); elt = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_CLASSIC_GRID); elt.appendChild(document.createTextNode(String.valueOf(isClassicGridDrawn()))); meta.appendChild(elt); elt = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_GRID_GAP); elt.appendChild(document.createTextNode(String.valueOf(getPersonalGridGap()))); meta.appendChild(elt); elt = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_CODE); elt.appendChild(document.createTextNode(String.valueOf(getWhichCodeOutput()))); meta.appendChild(elt); elt = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_DISPLAY_GRID); elt.appendChild(document.createTextNode(String.valueOf(isGridDisplayed()))); meta.appendChild(elt); } /** * @return The code of the selected figures. * @since 2.0.0 */ public String getCodeSelection() { if(selected==null || selected.isEmpty()) return null; String code = "";//$NON-NLS-1$ String lineSep = System.getProperty("line.separator");//$NON-NLS-1$ switch(getWhichCodeOutput()) { case CODE_PSTRICKS: for(Figure f : selected.getFigures()) code += f.getCodePSTricks(bordersReal, pixelsPerCm) + lineSep; code = DviPsColors.getUserColoursCode(code) + code; break; default: return null; } return code; } public void open(ObjectInputStream ois) throws IOException, ClassNotFoundException { readObject(ois); } /** * Align the selected figures. * @param alignCode The type of the alignment: *
    *
  • 0: Align the selected figures to the figure on the left
  • *
  • 1: Align the selected figures to the figure on the right
  • *
  • 2: Align the selected figures to the figure on the top
  • *
  • 3: Align the selected figures to the figure on the bottom
  • *
  • 4: Align vertically the selected figures to the figure in the middle
  • *
  • 5: Align horizontally the selected figures to the figure in the middle
  • *
* @since 2.0.0 */ public void align(int alignCode) { if(selected==null || selected.size()<2) return ; try { int[] id = new int[selected.size()]; int i, size; Draw clone = (Draw)selected.clone(); UndoRedoManager manager = parentPanel.getFrameParent().getUndoManager(); for(i=0, size=selected.size(); i *
  • 0: distributes vertically at equal distance between the bottom sides of the selected figures
  • *
  • 1: distributes vertically at equal distance between the middle of the selected figures
  • *
  • 2: distributes vertically at equal distance between the top sides of the selected figures
  • *
  • 3: distributes horizontally at equal distance between the selected figures
  • *
  • 4: distributes vertically at equal distance between the left sides of the selected figures
  • *
  • 5: distributes vertically at equal distance between the middle of the selected figures
  • *
  • 6: distributes vertically at equal distance between the right sides of the selected figures
  • *
  • 7: distributes vertically at equal distance between the selected figures
  • * * @since 2.0.0 */ public void distribute(int distribCode) { if(selected==null || selected.size()<2) return ; try { int[] id = new int[selected.size()]; int i, size; Draw clone = (Draw)selected.clone(); UndoRedoManager manager = parentPanel.getFrameParent().getUndoManager(); for(i=0, size=selected.size(); imetadata SVG tag. * @param meta The tag source of the parameters. * @since 2.0.0 */ public void setXMLMetadata(SVGMetadataElement meta) { if(meta==null) return ; Node n; String name; int i = 0, size; boolean displayGrid = false; NodeList nl = meta.getElementsByTagNameNS(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE_URI, SVGElements.SVG_METADATA); if(nl==null || nl.getLength()==0) return; nl = nl.item(0).getChildNodes(); for(i=0, size=nl.getLength(); i *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2010 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 07/01/09
    * @author Arnaud BLOUIN
    * @version 2.0.8
    */ public final class LaTeXDrawFrame extends JFrame implements ActionListener, ItemListener, ChangeListener, WindowStateListener { private static final long serialVersionUID = 1L; /** The version of the application */ public final static String VERSION = "2.0.8";//$NON-NLS-1$ public final static String VERSION_STABILITY = ""; //$NON-NLS-1$ /** To change if update is needed or not. */ public static final boolean WITH_UPDATE = true; public static final Insets INSET_BUTTON = new Insets(1,1,1,1); /** The path by default */ public static final String DEFAULT_PATH = System.getProperty("user.home");//$NON-NLS-1$ protected ShortcutsFrame shortcutsFrame; protected PSTProgressBarManager progressbarPST = null; protected SVGProgressBarManager progressbarSVG = null; protected transient MenusListener menusListener; protected transient RecentFilesListener recentFilesListener; private String latexIncludes = null; private String pathDistribLatex = null; /** The path of the location of the LaTeX editor. */ private String pathTexEditor = null; /** This frame allows the user to insert PSTricks code in the drawing. */ private InsertPSTricksCodeFrame insertCodeFrame; /** The panel containing the generated code*/ protected CodePanel codePanel; /** The panel containing the drawing made by the user*/ protected DrawPanel drawPanel; /** The toolbar of the application*/ protected LToolbar toolbar; /** The progress bar for the parsing */ protected JProgressBar progressBar; /** The button stop for the parsing */ protected JButton stopButton; /** The menu bar of the application */ protected LMenuBar menuBar; /** The identifier of the build */ private static final String ID_BUILD = "20100314";//$NON-NLS-1$ /** Allows to realize undo and redo */ protected transient UndoRedoManager undoManager; /** This frame allows to set the parameters of a line */ private ParametersLineFrame paramLineFrame; /** This frame allows to set the parameters of axes. */ private ParametersAxeFrame paramAxesFrame; /** This frame allows to set the parameters of a circle */ private ParametersCircleSquareFrame paramCircleFrame; /** This frame allows to set the parameters of an ellipse */ private ParametersEllipseRectangleFrame paramEllipseFrame; /** This frame allows to set the parameters of a Bézier curve */ private ParametersBezierCurveFrame paramBezierCurveFrame; /** This frame allows to set the parameters of akin points */ private ParametersAkinPointsFrame paramAkinPointsFrame; /** This frame allows to set the parameters of a dot */ private ParametersDotFrame paramDotFrame; /** This frame allows to set the parameters of a text */ private ParametersTextFrame paramTextFrame; /** This frame allows to set the parameters of a triangle */ private ParametersTriangleFrame paramTriangleFrame; // /** This frame allows to set the parameters of a drawing */ // private ParametersDrawFrame paramDrawFrame; /** This frame allows to set the parameters of a grid */ private ParametersGridFrame paramGridFrame; /** This frame allows to set the parameters of a rhombus */ private ParametersRhombusFrame paramRhombusFrame; /** This frame allows to set the parameters of an arc */ private ParametersArcFrame paramArcFrame; /** This frame allows to set the parameters of a polygon */ private ParametersPolygonJoinedLinesFrame paramPolygonFrame; /** This frame allows to set the parameters of several joined lines */ private ParametersPolygonJoinedLinesFrame paramJoinedLinesFrame; /** This frame allows the user to add comments to his drawing */ private AddCommentsFrame addCommentsFrame; /** This frame allows to set the parameters of the drawing (not the * Figure.Draw */ private DrawPropertiesFrame drawPropertiesFrame; /** Allows to display a frame displaying the LaTeXDraw help */ private JFrame helpFrame; /** The current file of the project */ private File currentFile; /** The path used on open/save actions */ private static String pathOpen = DEFAULT_PATH; /** The path used on exportation actions */ private static String pathExport = DEFAULT_PATH; /** The frame which allows to convert pictures */ public final static BatchConvertFrame convertFrame; /** Allows to know if the program must check new version */ private boolean checkNewVersion; /** The About LaTeXDraw box */ protected JFrame aboutTeXDraw; /** This frame allows the user to set his preferences */ private PreferencesFrame preferencesFrame; /** Correspond to the current choice of the user (draw a line, ...). */ private static String currentChoice; /** Corresponds to the name of the current project */ private String projectName; /** The fileChooser used to save projects. */ private JFileChooser fileChooserSave; /** The fileChooser used to open projects. @since 2.0.0 */ private JFileChooser fileChooserOpen; /** The PictureChooser for 'insert picture' actions */ private PictureChooser fileChooserPicture; /** The fileChooser for save/open actions */ private ExportDialog fileChooserExport; /** The PictureChooser for import actions */ private PictureChooser fileChooserImport; /** Allows to know if by default the grid must be displayed */ public static final boolean DEFAULT_DISPLAY_GRID = true; /** Allows to know if by default the XScale must be displayed */ public static final boolean DEFAULT_DISPLAY_XSCALE = true; /** Allows to know if by default the YScaleC must be displayed */ public static final boolean DEFAULT_DISPLAY_YSCALE = true; /** Allows to know if by default the codePane must be displayed */ public static final boolean DEFAULT_DISPLAY_CODEPANEL = true; /** Allows to know if by default the borders of the drawing must be displayed */ public static final boolean DEFAULT_DISPLAY_BORDERS = false; /** Allows to know if by default the program must check new version on start-up */ public static final boolean DEFAULT_CHECK_VERSION = true; /** The splitpane of the program */ protected JSplitPane splitPane; /** The field which allows to change the thickness of figures */ private JSpinner thicknessField; /** Allows to set the colour of the borders of a figure */ private ColorButton buttonBordersColor; /** Allows the attribute "filled" in Figure class */ private JCheckBox filledCheckBox; /** Set/unset a shadow to a figure. */ private JCheckBox shadowCheckBox; /** Allows have double boundaries on a figure */ private JCheckBox dbleBoundCheckBox; /** Allows to set the colour of the interior of a figure */ private ColorButton buttonInteriorColor; /** Allows to set the colour of the shadow of a figure */ private ColorButton buttonShadowColor; /** Allows to change the colour of the hatch */ private ColorButton buttonHatchColor; /** Contains buttons allowing to rotate figures. */ private ListJToggleButton rotationButtons; /** Contains the buttons allowing to return figures (mirrors). */ private ListJToggleButton mirrorButtons; private ListJToggleButton alignButtons; private ListJToggleButton distribButtons; /** Allows to select the type of the dot */ private LaTeXDrawComboBox dotChoice; /** Allows to select the position of the borders of the figure (if possible) */ private LaTeXDrawComboBox bordersPositionChoice; /** Allows to change the colour of the space between the double boundaries */ private ColorButton buttonDbleBoundColor; /** This button allows to join several figures */ private JButton joinButton; /** This button allows to separate several figures */ private JButton separateButton; /** Allows to change the style of the left-end of the line */ private LaTeXDrawComboBox lineArrowLChoice; /** Allows to change the style of the right-end of the line */ private LaTeXDrawComboBox lineArrowRChoice; /** Allows to change the style of the line */ private LaTeXDrawComboBox lineChoice; /** Allows to change the style of hatch */ private LaTeXDrawComboBox hatchChoice; /** Allows to choose the first colour of a gradient. */ private ColorButton buttonGradientStartC; /** Allows to choose the second colour of a gradient. */ private ColorButton buttonGradientEndC; /** The former location of the divider location (used to show or hide the codepanel) */ private int formerDividerLocation; private ListJToggleButton locationButtons; /** The version of the LaTeXDraw file loaded */ private static String versionOfFile = "";//$NON-NLS-1$ /** The X-scale of the drawing */ private XScale xScale; /** The Y-scale of the drawing */ private YScale yScale; /** This label is behind the field thickness in the paramsToolbar */ private JLabel labelThickness; /** The older version of java that this program can used */ public static final String VERSION_MIN = "1.5"; //$NON-NLS-1$ /** This attribute is used to save the value of the "updateCode" checkBox * of the code panel when we hide to code panel (we disactivate the auto-update when to code panel is hidden */ private boolean formerIsInAutoUpdate; /** The status-bar of the frame */ private JTextField statusBar; /** The look and feel of the program. */ private static String lookAndFeel; protected transient ShortcutsListener shortcutsListener; protected JToggleButton rotateButton; /* Save of the general parameters. */ protected ColorButton genGradientEndCB; protected ColorButton genGradientStartCB; protected ColorButton genLineCB; protected ColorButton genInteriorCB; protected ColorButton genDbleBordCB; protected ColorButton genHatchCB; protected ColorButton genShadowCB; protected Color genGradientEndC; protected Color genGradientStartC; protected Color genLineC; protected Color genInteriorC; protected Color genDbleC; protected Color genHatchC; protected Color genShadowC; protected float genThickness; protected float genDotSize; protected boolean genIsFilled; protected boolean genHasDbleBord; protected boolean genHasShadow; protected String genHatchS; protected String genDotS; protected String genLineStyleS; protected String genLeftArrS; protected String genRightArrS; protected String genBordPosS; protected ListJToggleButton genColorL; protected JSpinner dotSizeField; protected JLabel labelDotSize; /** The position of the divider in ]0,1[. @since 2.0.0 */ protected double dividerPosition; static { LaTeXDrawPath.checkDirectories(); try { lookAndFeel = PreferencesFrame.readTheme(); UIManager.setLookAndFeel(lookAndFeel); } catch(Exception ex) { /* Dommage ! */ } convertFrame = new BatchConvertFrame(); } /** The constructor by default. */ public LaTeXDrawFrame(String[] args, boolean splash) { dividerPosition = 0.8; SplashScreen splashScreen = new SplashScreen(lookAndFeel); if(splash) splashScreen.setVisible(true); try { splashScreen.addToProgressBar(5); statusBar = new JTextField("");//$NON-NLS-1$ statusBar.setEditable(false); progressBar = new JProgressBar(); progressBar.setMaximumSize(new Dimension(300, 20)); progressBar.setPreferredSize(new Dimension(300, 20)); progressBar.setVisible(false); menusListener = new MenusListener(this); splashScreen.addToProgressBar(15); setIconImage(LaTeXDrawResources.latexdrawIcon.getImage()); checkNewVersion = DEFAULT_CHECK_VERSION && WITH_UPDATE; codePanel = new CodePanel(this); codePanel.setVisible(DEFAULT_DISPLAY_CODEPANEL); splashScreen.addToProgressBar(5); DrawContainer draw = new DrawContainer(DEFAULT_DISPLAY_BORDERS); splashScreen.addToProgressBar(10); drawPanel = new DrawPanel(draw, codePanel, this); splashScreen.addToProgressBar(5); JPanel paramsToolbar = new JPanel(new FlowLayout(FlowLayout.LEFT)); JPanel p= new JPanel(); projectName = null; fileChooserSave = null; fileChooserExport = null; currentFile = null; splashScreen.addToProgressBar(5); menuBar = new LMenuBar(this); splashScreen.addToProgressBar(10); createToolbar(); splashScreen.addToProgressBar(10); undoManager = new UndoRedoManager(draw.getFigures(), draw, this); splashScreen.addToProgressBar(5); yScale = new YScale(drawPanel, xScale); yScale.setVisible(DEFAULT_DISPLAY_YSCALE); xScale = new XScale(drawPanel, yScale); yScale.setXScale(xScale); xScale.setVisible(DEFAULT_DISPLAY_XSCALE); p.setLayout(new BorderLayout()); p.add(yScale, BorderLayout.WEST); p.add(xScale, BorderLayout.NORTH); p.add(drawPanel, BorderLayout.CENTER); setJMenuBar(menuBar); updateUndoRedo(); splashScreen.addToProgressBar(10); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, p, codePanel); splitPane.setContinuousLayout(true); splitPane.setOneTouchExpandable(true); splitPane.setDividerSize(6); getContentPane().setLayout(new BorderLayout()); getContentPane().add(toolbar, BorderLayout.NORTH); getContentPane().add(splitPane, BorderLayout.CENTER); addCommentsFrame = new AddCommentsFrame(this); SpinnerModel model = new SpinnerNumberModel(Figure.DEFAULT_THICKNESS,0.1,1000,0.1); thicknessField = new JSpinner(model); thicknessField.setEditor(new JSpinner.NumberEditor(thicknessField, "0.0"));//$NON-NLS-1$ thicknessField.addChangeListener(this); thicknessField.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.65")); //$NON-NLS-1$ thicknessField.setName(LaTeXDrawResources.NAME_THICKNESS_FIELD); thicknessField.setMaximumSize(new Dimension(55, 30)); thicknessField.setMinimumSize(new Dimension(55, 30)); thicknessField.setPreferredSize(new Dimension(55, 30)); model = new SpinnerNumberModel(Dot.DEFAULT_WIDTH,0.1,1000,0.1); dotSizeField = new JSpinner(model); dotSizeField.setEditor(new JSpinner.NumberEditor(dotSizeField, "0.0"));//$NON-NLS-1$ dotSizeField.addChangeListener(this); dotSizeField.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.0")); //$NON-NLS-1$ dotSizeField.setName(LaTeXDrawResources.NAME_DOT_SIZE_FIELD); dotSizeField.setMaximumSize(new Dimension(55, 30)); dotSizeField.setMinimumSize(new Dimension(55, 30)); dotSizeField.setPreferredSize(new Dimension(55, 30)); labelDotSize = new JLabel(LaTeXDrawResources.dotStyleNoneIcon); buttonBordersColor = new ColorButton(LaTeXDrawResources.LABEL_COLOR_BUTTON, new ButtonIcon(Color.BLACK)); buttonBordersColor.setMargin(INSET_BUTTON); buttonBordersColor.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.66")); //$NON-NLS-1$ buttonBordersColor.setActionCommand(LaTeXDrawResources.LABEL_COLOR_BUTTON); buttonBordersColor.addActionListener(this); genLineCB = new ColorButton(LaTeXDrawResources.LABEL_COLOR_BUTTON, new ButtonIcon(Color.BLACK)); genLineCB.setMargin(INSET_BUTTON); genLineCB.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.66")); //$NON-NLS-1$ genLineCB.setActionCommand(LaTeXDrawResources.LABEL_COLOR_BUTTON); genLineCB.addActionListener(this); filledCheckBox = new JCheckBox(LaTeXDrawResources.LABEL_FILLED_CHECKBOX); filledCheckBox.setMargin(LaTeXDrawFrame.INSET_BUTTON); filledCheckBox.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.67")); //$NON-NLS-1$ filledCheckBox.setActionCommand(LaTeXDrawResources.LABEL_FILLED_CHECKBOX); filledCheckBox.addActionListener(this); buttonInteriorColor = new ColorButton(LaTeXDrawResources.LABEL_COLOR_INTERIOR_BUTTON, new ButtonIcon(Figure.DEFAULT_INTERIOR_COL)); buttonInteriorColor.setMargin(INSET_BUTTON); buttonInteriorColor.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.68")); //$NON-NLS-1$ buttonInteriorColor.setActionCommand(LaTeXDrawResources.LABEL_COLOR_INTERIOR_BUTTON); buttonInteriorColor.addActionListener(this); genInteriorCB = new ColorButton(LaTeXDrawResources.LABEL_COLOR_INTERIOR_BUTTON, new ButtonIcon(Figure.DEFAULT_INTERIOR_COL)); genInteriorCB.setMargin(INSET_BUTTON); genInteriorCB.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.68")); //$NON-NLS-1$ genInteriorCB.setActionCommand(LaTeXDrawResources.LABEL_COLOR_INTERIOR_BUTTON); genInteriorCB.addActionListener(this); buttonHatchColor = new ColorButton(LaTeXDrawResources.LABEL_COLOR_HATCH, new ButtonIcon(Figure.DEFAULT_BORDERS_COL)); buttonHatchColor.setMargin(INSET_BUTTON); buttonHatchColor.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.69")); //$NON-NLS-1$ buttonHatchColor.setActionCommand(LaTeXDrawResources.LABEL_COLOR_HATCH); buttonHatchColor.addActionListener(this); genHatchCB = new ColorButton(LaTeXDrawResources.LABEL_COLOR_HATCH, new ButtonIcon(Figure.DEFAULT_BORDERS_COL)); genHatchCB.setMargin(INSET_BUTTON); genHatchCB.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.69")); //$NON-NLS-1$ genHatchCB.setActionCommand(LaTeXDrawResources.LABEL_COLOR_HATCH); genHatchCB.addActionListener(this); dotChoice = Dot.createDotStyleChoice(); dotChoice.setName(LaTeXDrawResources.CHOICE_DOT_NAME); dotChoice.addItemListener(this); dotChoice.setPreferredSize(new Dimension(55,30)); dotChoice.setMaximumSize(new Dimension(55,30)); lineChoice = Figure.createStyleLineChoice(); lineChoice.setName(LaTeXDrawResources.CHOICE_LINE_NAME); lineChoice.addItemListener(this); lineChoice.setPreferredSize(new Dimension(70,30)); lineChoice.setMaximumSize(new Dimension(70,30)); hatchChoice = Figure.createFillChoice(); hatchChoice.addItemListener(this); hatchChoice.setPreferredSize(new Dimension(65,30)); hatchChoice.setMaximumSize(new Dimension(65,30)); lineArrowLChoice = ArrowHead.createLeftArrowStyleList(); lineArrowLChoice.setName(LaTeXDrawResources.CHOICE_ARROW_LEFT_NAME); lineArrowLChoice.addItemListener(this); lineArrowLChoice.setPreferredSize(new Dimension(80,30)); lineArrowLChoice.setMaximumSize(new Dimension(80,30)); lineArrowRChoice = ArrowHead.createRightArrowStyleList(); lineArrowRChoice.setName(LaTeXDrawResources.CHOICE_ARROW_RIGHT_NAME); lineArrowRChoice.addItemListener(this); lineArrowRChoice.setPreferredSize(new Dimension(80,30)); lineArrowRChoice.setMaximumSize(new Dimension(80,30)); splashScreen.addToProgressBar(5); JButton buttonImageForeground = new JButton(LaTeXDrawResources.foregroundIcon); buttonImageForeground.setMargin(INSET_BUTTON); buttonImageForeground.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.70")); //$NON-NLS-1$ buttonImageForeground.addActionListener(this); buttonImageForeground.setActionCommand(LaTeXDrawResources.LABEL_FOREGROUND); JButton buttonImageBackground = new JButton(LaTeXDrawResources.backgroundIcon); buttonImageBackground.setMargin(INSET_BUTTON); buttonImageBackground.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.71")); //$NON-NLS-1$ buttonImageBackground.addActionListener(this); buttonImageBackground.setActionCommand(LaTeXDrawResources.LABEL_BACKGROUND); JButton buttonImageFront = new JButton(LaTeXDrawResources.inFrontOfSelIcon); buttonImageFront.setMargin(INSET_BUTTON); buttonImageFront.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.72")); //$NON-NLS-1$ buttonImageFront.addActionListener(this); buttonImageFront.setActionCommand(LaTeXDrawResources.LABEL_FRONT_SEL); JButton buttonImageBehind = new JButton(LaTeXDrawResources.behindSelIcon); buttonImageBehind.setMargin(INSET_BUTTON); buttonImageBehind.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.73")); //$NON-NLS-1$ buttonImageBehind.addActionListener(this); buttonImageBehind.setActionCommand(LaTeXDrawResources.LABEL_BEHIND_SEL); rotationButtons = new ListJToggleButton(this, LaTeXDrawResources.rotateIcon, ListJToggleButton.LOCATION_NORTH); rotationButtons.setToolTipText(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.2")); //$NON-NLS-1$ rotateButton = new JToggleButton(LaTeXDrawResources.rotateIcon); rotateButton.setMargin(INSET_BUTTON); rotateButton.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.74")); //$NON-NLS-1$ rotateButton.addActionListener(this); rotateButton.setActionCommand(LaTeXDrawResources.LABEL_ROTATE); JButton rotate90Button = new JButton(LaTeXDrawResources.rotate90Icon); rotate90Button.setMargin(INSET_BUTTON); rotate90Button.setToolTipText(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.3")); //$NON-NLS-1$ rotate90Button.addActionListener(this); rotate90Button.setActionCommand(LaTeXDrawResources.LABEL_ROTATE_90); JButton rotate180Button = new JButton(LaTeXDrawResources.rotate180Icon); rotate180Button.setMargin(INSET_BUTTON); rotate180Button.setToolTipText(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.4")); //$NON-NLS-1$ rotate180Button.addActionListener(this); rotate180Button.setActionCommand(LaTeXDrawResources.LABEL_ROTATE_180); JButton rotate270Button = new JButton(LaTeXDrawResources.rotate270Icon); rotate270Button.setMargin(INSET_BUTTON); rotate270Button.setToolTipText(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.5")); //$NON-NLS-1$ rotate270Button.addActionListener(this); rotate270Button.setActionCommand(LaTeXDrawResources.LABEL_ROTATE_270); rotationButtons.addComponent(rotateButton); rotationButtons.addComponent(rotate90Button); rotationButtons.addComponent(rotate180Button); rotationButtons.addComponent(rotate270Button); rotationButtons.addSeparator(); mirrorButtons = new ListJToggleButton(this, LaTeXDrawResources.mirrorHIcon, ListJToggleButton.LOCATION_NORTH); mirrorButtons.setToolTipText(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.6")); //$NON-NLS-1$ JButton button = new JButton(LaTeXDrawResources.mirrorHIcon); button.setMargin(INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.7")); //$NON-NLS-1$ button.addActionListener(this); button.setActionCommand(LaTeXDrawResources.LABEL_MIRROR_H); mirrorButtons.addComponent(button); button = new JButton(LaTeXDrawResources.mirrorVIcon); button.setMargin(INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.8")); //$NON-NLS-1$ button.addActionListener(this); button.setActionCommand(LaTeXDrawResources.LABEL_MIRROR_V); splashScreen.addToProgressBar(5); mirrorButtons.addComponent(button); mirrorButtons.addSeparator(); alignButtons = new ListJToggleButton(this, LaTeXDrawResources.alignLeftIcon, ListJToggleButton.LOCATION_NORTH); alignButtons.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.1")); //$NON-NLS-1$ ToolbarListener tl = new ToolbarListener(this); button = new JButton(LaTeXDrawResources.alignLeftIcon); button.setMargin(INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.2")); //$NON-NLS-1$ button.addActionListener(tl); button.setActionCommand(ToolbarListener.LABEL_ALIGN_LEFT); alignButtons.addComponent(button); button = new JButton(LaTeXDrawResources.alignRightIcon); button.setMargin(INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.3")); //$NON-NLS-1$ button.addActionListener(tl); button.setActionCommand(ToolbarListener.LABEL_ALIGN_RIGHT); alignButtons.addComponent(button); button = new JButton(LaTeXDrawResources.alignTopIcon); button.setMargin(INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.4")); //$NON-NLS-1$ button.addActionListener(tl); button.setActionCommand(ToolbarListener.LABEL_ALIGN_TOP); alignButtons.addComponent(button); button = new JButton(LaTeXDrawResources.alignBottomIcon); button.setMargin(INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.5")); //$NON-NLS-1$ button.addActionListener(tl); button.setActionCommand(ToolbarListener.LABEL_ALIGN_BOTTOM); alignButtons.addComponent(button); button = new JButton(LaTeXDrawResources.alignMiddleHorizIcon); button.setMargin(INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.6")); //$NON-NLS-1$ button.addActionListener(tl); button.setActionCommand(ToolbarListener.LABEL_ALIGN_MIDDLE_H); alignButtons.addComponent(button); button = new JButton(LaTeXDrawResources.alignMiddleVertIcon); button.setMargin(INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.7")); //$NON-NLS-1$ button.addActionListener(tl); button.setActionCommand(ToolbarListener.LABEL_ALIGN_MIDDLE_V); alignButtons.addComponent(button); alignButtons.addSeparator(); distribButtons = new ListJToggleButton(this, LaTeXDrawResources.distVertBottomIcon, ListJToggleButton.LOCATION_NORTH); distribButtons.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.8")); //$NON-NLS-1$ button = new JButton(LaTeXDrawResources.distVertBottomIcon); button.setMargin(INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.9")); //$NON-NLS-1$ button.addActionListener(tl); button.setActionCommand(ToolbarListener.LABEL_DISTRIB_V_BOTTOM); distribButtons.addComponent(button); button = new JButton(LaTeXDrawResources.distVertEqualIcon); button.setMargin(INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.10")); //$NON-NLS-1$ button.addActionListener(tl); button.setActionCommand(ToolbarListener.LABEL_DISTRIB_V_EQ); distribButtons.addComponent(button); button = new JButton(LaTeXDrawResources.distVertMiddleIcon); button.setMargin(INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.11")); //$NON-NLS-1$ button.addActionListener(tl); button.setActionCommand(ToolbarListener.LABEL_DISTRIB_V_MID); distribButtons.addComponent(button); button = new JButton(LaTeXDrawResources.distVertTopIcon); button.setMargin(INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.12")); //$NON-NLS-1$ button.addActionListener(tl); button.setActionCommand(ToolbarListener.LABEL_DISTRIB_V_TOP); distribButtons.addComponent(button); button = new JButton(LaTeXDrawResources.distHorizLeftIcon); button.setMargin(INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.13")); //$NON-NLS-1$ button.addActionListener(tl); button.setActionCommand(ToolbarListener.LABEL_DISTRIB_H_LEFT); distribButtons.addComponent(button); button = new JButton(LaTeXDrawResources.distHorizEqualIcon); button.setMargin(INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.14")); //$NON-NLS-1$ button.addActionListener(tl); button.setActionCommand(ToolbarListener.LABEL_DISTRIB_H_EQ); distribButtons.addComponent(button); button = new JButton(LaTeXDrawResources.distHorizMiddleIcon); button.setMargin(INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.15")); //$NON-NLS-1$ button.addActionListener(tl); button.setActionCommand(ToolbarListener.LABEL_DISTRIB_H_MID); distribButtons.addComponent(button); button = new JButton(LaTeXDrawResources.distHorizRightIcon); button.setMargin(INSET_BUTTON); button.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.16")); //$NON-NLS-1$ button.addActionListener(tl); button.setActionCommand(ToolbarListener.LABEL_DISTRIB_H_RIGHT); distribButtons.addComponent(button); joinButton = new JButton(LaTeXDrawResources.joinIcon); joinButton.setMargin(INSET_BUTTON); joinButton.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.75")); //$NON-NLS-1$ joinButton.addActionListener(this); joinButton.setActionCommand(LaTeXDrawResources.LABEL_JOIN); separateButton = new JButton(LaTeXDrawResources.separateIcon); separateButton.setMargin(INSET_BUTTON); separateButton.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.76")); //$NON-NLS-1$ separateButton.addActionListener(this); separateButton.setActionCommand(LaTeXDrawResources.LABEL_SEPARATE); bordersPositionChoice = Figure.createBordersPositionChoice(); bordersPositionChoice.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.77")); //$NON-NLS-1$ bordersPositionChoice.addItemListener(this); bordersPositionChoice.setPreferredSize(new Dimension(45,30)); bordersPositionChoice.setMaximumSize(new Dimension(45,30)); dbleBoundCheckBox = new JCheckBox(LaTeXDrawResources.LABEL_DBLE_BOUND_CHECKBOX); dbleBoundCheckBox.setMargin(INSET_BUTTON); dbleBoundCheckBox.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.78")); //$NON-NLS-1$ dbleBoundCheckBox.setActionCommand(LaTeXDrawResources.LABEL_DBLE_BOUND_CHECKBOX); dbleBoundCheckBox.addActionListener(this); buttonDbleBoundColor = new ColorButton(LaTeXDrawResources.LABEL_DBLE_BOUND_CHECKBOX, new ButtonIcon(Figure.DEFAULT_DOUBLE_COLOR)); buttonDbleBoundColor.setMargin(INSET_BUTTON); buttonDbleBoundColor.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.79")); //$NON-NLS-1$ buttonDbleBoundColor.setActionCommand(LaTeXDrawResources.LABEL_COLOR_DBLE_BOUND); buttonDbleBoundColor.addActionListener(this); genDbleBordCB = new ColorButton(LaTeXDrawResources.LABEL_DBLE_BOUND_CHECKBOX, new ButtonIcon(Figure.DEFAULT_DOUBLE_COLOR)); genDbleBordCB.setMargin(INSET_BUTTON); genDbleBordCB.setToolTipText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.79")); //$NON-NLS-1$ genDbleBordCB.setActionCommand(LaTeXDrawResources.LABEL_COLOR_DBLE_BOUND); genDbleBordCB.addActionListener(this); stopButton = new JButton(LaTeXDrawResources.stopIcon); stopButton.setMargin(INSET_BUTTON); stopButton.setActionCommand(LaTeXDrawResources.LABEL_STOP); stopButton.addActionListener(this); stopButton.setName(LaTeXDrawResources.LABEL_STOP); stopButton.setToolTipText(LaTeXDrawLang.getString1_6("LaTeXDrawFrame.9")); //$NON-NLS-1$ stopButton.setVisible(false); shadowCheckBox = new JCheckBox(LaTeXDrawResources.LABEL_SHADOW_CHECKBOX); shadowCheckBox.setMargin(INSET_BUTTON); shadowCheckBox.setToolTipText(LaTeXDrawLang.getString1_7("LaTeXDrawFrame.4")); //$NON-NLS-1$ shadowCheckBox.setActionCommand(LaTeXDrawResources.LABEL_SHADOW_CHECKBOX); shadowCheckBox.addActionListener(this); buttonShadowColor = new ColorButton(LaTeXDrawResources.LABEL_COLOR_SHADOW, new ButtonIcon(Figure.DEFAULT_SHADOW_COLOR)); buttonShadowColor.setMargin(INSET_BUTTON); buttonShadowColor.setToolTipText(LaTeXDrawLang.getString1_7("LaTeXDrawFrame.5")); //$NON-NLS-1$ buttonShadowColor.setActionCommand(LaTeXDrawResources.NAME_COLOR_SHADOW); buttonShadowColor.addActionListener(this); genShadowCB = new ColorButton(LaTeXDrawResources.LABEL_COLOR_SHADOW, new ButtonIcon(Figure.DEFAULT_SHADOW_COLOR)); genShadowCB.setMargin(INSET_BUTTON); genShadowCB.setToolTipText(LaTeXDrawLang.getString1_7("LaTeXDrawFrame.5")); //$NON-NLS-1$ genShadowCB.setActionCommand(LaTeXDrawResources.NAME_COLOR_SHADOW); genShadowCB.addActionListener(this); labelThickness = new JLabel(LaTeXDrawResources.thicknessIcon); locationButtons = new ListJToggleButton(this, LaTeXDrawResources.foregroundIcon, ListJToggleButton.LOCATION_NORTH); locationButtons.addComponent(buttonImageForeground); locationButtons.addComponent(buttonImageBackground); locationButtons.addComponent(buttonImageFront); locationButtons.addComponent(buttonImageBehind); locationButtons.addSeparator(); locationButtons.setToolTipText(LaTeXDrawLang.getString1_7("LaTeXDrawFrame.6")); //$NON-NLS-1$ buttonGradientStartC = new ColorButton(LaTeXDrawResources.LABEL_COLOR_GRADIENT_FIRST, new ButtonIcon(PSTricksConstants.DEFAULT_GRADIENT_START_COLOR)); buttonGradientStartC.setMargin(INSET_BUTTON); buttonGradientStartC.setToolTipText(LaTeXDrawLang.getString1_7("LaTeXDrawFrame.7")); //$NON-NLS-1$ buttonGradientStartC.setActionCommand(LaTeXDrawResources.LABEL_COLOR_GRADIENT_FIRST); buttonGradientStartC.addActionListener(this); genGradientStartCB = new ColorButton(LaTeXDrawResources.LABEL_COLOR_GRADIENT_FIRST, new ButtonIcon(PSTricksConstants.DEFAULT_GRADIENT_START_COLOR)); genGradientStartCB.setMargin(INSET_BUTTON); genGradientStartCB.setToolTipText(LaTeXDrawLang.getString1_7("LaTeXDrawFrame.7")); //$NON-NLS-1$ genGradientStartCB.setActionCommand(LaTeXDrawResources.LABEL_COLOR_GRADIENT_FIRST); genGradientStartCB.addActionListener(this); buttonGradientEndC = new ColorButton(LaTeXDrawResources.LABEL_COLOR_GRADIENT_SECOND, new ButtonIcon(PSTricksConstants.DEFAULT_GRADIENT_END_COLOR)); buttonGradientEndC.setMargin(INSET_BUTTON); buttonGradientEndC.setToolTipText(LaTeXDrawLang.getString1_7("LaTeXDrawFrame.8")); //$NON-NLS-1$ buttonGradientEndC.setActionCommand(LaTeXDrawResources.LABEL_COLOR_GRADIENT_SECOND); buttonGradientEndC.addActionListener(this); genGradientEndCB = new ColorButton(LaTeXDrawResources.LABEL_COLOR_GRADIENT_SECOND, new ButtonIcon(PSTricksConstants.DEFAULT_GRADIENT_END_COLOR)); genGradientEndCB.setMargin(INSET_BUTTON); genGradientEndCB.setToolTipText(LaTeXDrawLang.getString1_7("LaTeXDrawFrame.8")); //$NON-NLS-1$ genGradientEndCB.setActionCommand(LaTeXDrawResources.LABEL_COLOR_GRADIENT_SECOND); genGradientEndCB.addActionListener(this); splashScreen.addToProgressBar(5); initializeGeneralFields(); genColorL = new ListJToggleButton(this, LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.17"), ListJToggleButton.LOCATION_NORTH); //$NON-NLS-1$ genColorL.addComponent(genLineCB); genColorL.addComponent(genInteriorCB); genColorL.addComponent(genHatchCB); genColorL.addComponent(genDbleBordCB); genColorL.addComponent(genShadowCB); genColorL.addComponent(genGradientStartCB); genColorL.addComponent(genGradientEndCB); paramsToolbar.add(progressBar); paramsToolbar.add(stopButton); paramsToolbar.add(rotationButtons); paramsToolbar.add(locationButtons); paramsToolbar.add(mirrorButtons); paramsToolbar.add(alignButtons); paramsToolbar.add(distribButtons); paramsToolbar.add(joinButton); paramsToolbar.add(separateButton); paramsToolbar.add(labelThickness); paramsToolbar.add(thicknessField); paramsToolbar.add(labelDotSize); paramsToolbar.add(dotSizeField); paramsToolbar.add(genColorL); paramsToolbar.add(buttonBordersColor); paramsToolbar.add(filledCheckBox); paramsToolbar.add(buttonInteriorColor); paramsToolbar.add(hatchChoice); paramsToolbar.add(buttonGradientStartC); paramsToolbar.add(buttonGradientEndC); paramsToolbar.add(buttonHatchColor); paramsToolbar.add(dotChoice); paramsToolbar.add(lineChoice); paramsToolbar.add(lineArrowLChoice); paramsToolbar.add(lineArrowRChoice); paramsToolbar.add(bordersPositionChoice); paramsToolbar.add(dbleBoundCheckBox); paramsToolbar.add(buttonDbleBoundColor); paramsToolbar.add(shadowCheckBox); paramsToolbar.add(buttonShadowColor); JPanel southPanel = new JPanel(); southPanel.setLayout(new BorderLayout()); southPanel.add(paramsToolbar, BorderLayout.CENTER); southPanel.add(statusBar, BorderLayout.SOUTH); getContentPane().add(southPanel, BorderLayout.SOUTH); splashScreen.addToProgressBar(5); preferencesFrame = new PreferencesFrame(draw, this); formerIsInAutoUpdate = preferencesFrame.isCodeInAutoUpdate(); convertFrame.setPathSelect(pathOpen); convertFrame.setPathOutput(pathExport); codePanel.setIsInAutoUpdate(formerIsInAutoUpdate); recentFilesListener = new RecentFilesListener(preferencesFrame, this); shortcutsListener = new ShortcutsListener(this); addKeyListener(shortcutsListener); drawPanel.isSelection(false); setTitle(LaTeXDrawResources.LABEL_APP); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { onWindowClosing(); } }); setCurrentChoice(LaTeXDrawResources.LABEL_SELECT_FIGURE); setSelection(false); boolean fileIsOk = true; /* Management of command line */ String fName = getFileName(args); if(args.length>1) setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.81")); //$NON-NLS-1$ if(fName!=null) if(fName.toLowerCase().endsWith(TeXFilter.TEX_EXTENSION)) fileIsOk = importPSTricksFile(fName); else fileIsOk = open(fName, false); menuBar.updateRecentFilesMenu(); drawPanel.setIsModified(false); splashScreen.addToProgressBar(5); if(checkNewVersion && WITH_UPDATE) { VersionChecker vc = new VersionChecker(this); vc.start(); } addWindowStateListener(this); splashScreen.setVisible(false); setVisible(true); updateSplitSeparatorPosition(); toolbar.getSliderDelimitor().setValue(Delimitor.getOpacity()); if(!fileIsOk) { projectName = null; setTitle(); JOptionPane.showMessageDialog(this, LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.18"), //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.86"), JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$ } } catch(Exception e1) { splashScreen.setVisible(false); JOptionPane.showMessageDialog(this, LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.82") + //$NON-NLS-1$ e1.toString(), LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.83"), //$NON-NLS-1$ JOptionPane.WARNING_MESSAGE); e1.printStackTrace(); LaTeXDrawFrame.this.windowClosed(); } } /** * deduces the filename that will be open, from the set of parameters. * @param args The parameters given to latexdraw. * @return The filename that will be open. * @since 2.0.2 */ public static String getFileName(String[] args) { if(args==null || args.length==0) return null; String name = args[0]; if(args.length!=1) { File f = new File(name); boolean ok = f.exists(); int i = 1; while(!ok && i1); distribButtons.setVisible(onSelection && listSelected!=null && listSelected.size()>2); menuBar.getCopyMenu().setEnabled(onSelection && !empty); menuBar.getCutMenu().setEnabled(onSelection && !empty); toolbar.getCopyCodeSelButton().setEnabled(onSelection && !empty); if(onSelection && listSelected!=null && listSelected.size()==1 && listSelected.getFigureAt(0).isCustomizable() && !(listSelected.getFigureAt(0) instanceof Draw)) { toolbar.getButtonImageProperties().setEnabled(true); joinButton.setVisible(false); buttonBordersColor.setVisible(true); separateButton.setVisible(listSelected.getFigureAt(0) instanceof Draw ? true : false); Figure selected = listSelected.getFigureAt(0); if(selected != null) { if(selected instanceof Dot) { dotChoice.setVisible(true); // A dot can always filled, or it cannot be filled. filledCheckBox.setVisible(false); buttonInteriorColor.setVisible(selected.canBeFilled()); labelDotSize.setVisible(true); dotSizeField.setVisible(true); } else { labelDotSize.setVisible(false); dotSizeField.setVisible(false); dotChoice.setVisible(false); filledCheckBox.setVisible(selected.canBeFilled() && !selected.hasGradient()); } //else buttonInteriorColor.setVisible(selected.canBeFilled() && (selected.isFilled() || selected.hasShadow()) && !selected.hasGradient() && selected.shadowFillsShape()); lineArrowLChoice.setVisible(selected.canHaveArrow()); lineArrowRChoice.setVisible(selected.canHaveArrow()); shadowCheckBox.setVisible(selected.canHaveShadow()); buttonShadowColor.setVisible(selected.hasShadow()); dbleBoundCheckBox.setVisible(selected.isDoubleBoundaryable()); buttonDbleBoundColor.setVisible(dbleBoundCheckBox.isSelected()); bordersPositionChoice.setVisible(selected.isBordersMovable()); labelThickness.setVisible(selected.isThicknessable()); thicknessField.setVisible(selected.isThicknessable()); lineChoice.setVisible(selected.isDashableOrDotable()); hatchChoice.setVisible(selected.canBeHatched()); buttonGradientEndC.setVisible(selected.canBeHatched() && selected.hasGradient()); buttonGradientStartC.setVisible(buttonGradientEndC.isVisible()); buttonHatchColor.setVisible(selected.canBeHatched() && selected.isHatched()); } genColorL.setVisible(false); }// if(onSelection) else { if(listSelected!=null && (listSelected.size()!=1 || (!listSelected.getFigureAt(0).isCustomizable() && !(listSelected.getFigureAt(0) instanceof Draw)))) { toolbar.getButtonImageProperties().setEnabled(false); menuBar.getPropertiesFigureMenu().setEnabled(false); } toolbar.getButtonImageProperties().setEnabled(false); dbleBoundCheckBox.setVisible(true); buttonDbleBoundColor.setVisible(false); bordersPositionChoice.setVisible(true); buttonBordersColor.setVisible(false); labelThickness.setVisible(true); buttonHatchColor.setVisible(false); buttonInteriorColor.setVisible(false); hatchChoice.setVisible(true); buttonHatchColor.setVisible(false); dotChoice.setVisible(true); lineChoice.setVisible(true); lineArrowLChoice.setVisible(true); lineArrowRChoice.setVisible(true); thicknessField.setVisible(true); buttonShadowColor.setVisible(false); shadowCheckBox.setVisible(true); buttonGradientEndC.setVisible(false); buttonGradientStartC.setVisible(false); filledCheckBox.setVisible(true); genColorL.setVisible(true); dotSizeField.setVisible(true); labelDotSize.setVisible(true); joinButton.setVisible(listSelected!=null && listSelected.size()>1); separateButton.setVisible(listSelected!=null && listSelected.size()==1 && listSelected.getFigureAt(0) instanceof Draw); } updateFrameFields(); } /** * Initialises the toolbar of the application. */ private void createToolbar() { toolbar = new LToolbar(this); requestFocus(); } /** * Allows to get the path for open/save actions * @return The path for open/save actions */ public static String getPathExport() { return pathExport; } /** * Allows to get the path for exportation actions * @return The path for exportation actions */ public static String getPathOpen() { return pathOpen; } /** * Allows to get the current choice of the user * @return The current choice of the user */ public String getCurrentChoice() { return currentChoice; } /** * Allows to get the codePanel * @return The codePanel */ public CodePanel getCodePanel() { return codePanel; } /** * Allows to get the drawPanel * @return The drawPanel */ public DrawPanel getDrawPanel() { return drawPanel; } /** * Allows to set if the grid must be displayed. * @param display True : the grid must be displayed. * @param classicGrid Define if it is the classic grid which must be drawn (only if display=true). */ public void displayGrid(boolean display, boolean classicGrid) { if(display) { menuBar.getDisplayGrid().setSelected(classicGrid); toolbar.getPersoGridGapField().setEnabled(!classicGrid); menuBar.getDisplayPersoGrid().setSelected(!classicGrid); drawPanel.draw.setClassicGridDrawn(classicGrid); } else { menuBar.getDisplayGrid().setSelected(false); toolbar.getPersoGridGapField().setEnabled(false); menuBar.getDisplayPersoGrid().setSelected(false); } drawPanel.setIsGridDisplay(display); drawPanel.setIsModified(true); } /** * Allows to set if the XScale must be displayed * @param display True : the XScale must be displayed */ public void displayXScale(boolean display) { menuBar.getDisplayXScale().setSelected(display); xScale.setVisible(display); try {drawPanel.setIsModified(true);} catch (Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } menuBar.getDisplayXScale().setSelected(display); } /** * Allows to set if the YScale must be displayed * @param display True : the YScale must be displayed */ public void displayYScale(boolean display) { yScale.setVisible(display); try {drawPanel.setIsModified(true);} catch (Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } menuBar.getDisplayYScale().setSelected(display); } /** * Allows to set if the borders of the drawing must be displayed * @param display True : the borders of the drawing must be displayed */ public void displayBorders(boolean display) { try { drawPanel.displayBorders(display); menuBar.getDisplayBorders().setSelected(display); toolbar.getButtonImageBorders().setSelected(display); drawPanel.setIsModified(true); } catch (Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } /** * Allows to set if the code panel must be displayed * @param display True: the code panel must be displayed */ public void displayCodePanel(boolean display) { if(display!=isCodePanelDisplayed()) drawPanel.setIsModified(true); menuBar.getDisplayCodePanel().setSelected(display); toolbar.getCopyCodeButton().setVisible(!display); if(display) { codePanel.setVisible(true); codePanel.setIsInAutoUpdate(formerIsInAutoUpdate); splitPane.setDividerLocation(formerDividerLocation); } else { formerIsInAutoUpdate = codePanel.isInAutoUpdate(); codePanel.setIsInAutoUpdate(false); formerDividerLocation = splitPane.getDividerLocation(); codePanel.setVisible(false); } splitPane.revalidate(); } /** * Allows to set the path for open/save actions * @param path The new path */ public void setPathOpen(String path) { pathOpen = path; if(fileChooserSave!=null) fileChooserSave.setCurrentDirectory(new File(path)); } /** * Allows to set the path for exportations actions * @param path The new path */ public void setPathExport(String path) { pathExport = path; if(fileChooserExport!=null) fileChooserExport.setCurrentDirectory(new File(path)); } /** * Allows to set if the menu "paste" must be enable or not * @param mustBeEnable True : the menu "paste" must be activated */ public void setMenuPaste(boolean mustBeEnable) { getLMenuBar().getPasteMenu().setEnabled(mustBeEnable); } /** * Allows to set if the menu "copy" must be enable or not * @param mustBeEnable True : the menu "copy" must be activated */ public void setMenuCopy(boolean mustBeEnable) { getLMenuBar().getCopyMenu().setEnabled(mustBeEnable); } /** * Allows to set the selected field of the choice lineChoice * @param choice The new selected choice */ public void setLineChoice(String choice) { if(!Figure.isValidStyle(choice)) throw new IllegalArgumentException(); lineChoice.removeItemListener(this); lineChoice.setSelectedItem(choice); lineChoice.addItemListener(this); } /** * Allows to set the selected field of the choice bordersPositionChoice. * @param choice The new choice. * @since 1.9.1 */ public void setBorderChoice(String choice) { bordersPositionChoice.removeItemListener(this); bordersPositionChoice.setSelectedItem(choice); bordersPositionChoice.addItemListener(this); } /** * Allows to set the selected field of the choice hatchChoice. * @param choice The new choice. * @since 1.9.1 */ public void setHatchChoice(String choice) { hatchChoice.removeItemListener(this); hatchChoice.setSelectedItem(choice); hatchChoice.addItemListener(this); } /** * Allows to set the selected field of the choice lineArrowRChoice * @param choice The new selected choice */ public void setLineArrowRChoice(String choice) { if(!PSTricksConstants.isValidArrowStyle(choice)) throw new IllegalArgumentException(); lineArrowRChoice.removeItemListener(this); lineArrowRChoice.setSelectedItem(choice); lineArrowRChoice.addItemListener(this); } /** * Allows to set the selected field of the choice lineArrowLChoice * @param choice The new selected choice */ public void setLineArrowLChoice(String choice) { if(!PSTricksConstants.isValidArrowStyle(choice)) throw new IllegalArgumentException(); lineArrowLChoice.removeItemListener(this); lineArrowLChoice.setSelectedItem(choice); lineArrowLChoice.addItemListener(this); } /** * Allows to update the selected field in the Choice component * dotChoice * @param newChoice The choice which must be selected */ public void setDotChoice(String newChoice) { if(!PSTricksConstants.isValidDotStyle(newChoice)) throw new IllegalArgumentException(); dotChoice.removeItemListener(this); dotChoice.setSelectedItem(newChoice); dotChoice.addItemListener(this); } /** * Allows to set the menu exportAs able or not * @param state It's new state */ public void setExportAsMenu(boolean state) { getLMenuBar().getExportAsMenu().setEnabled(state); getToolbar().getButtonPdfExport().setEnabled(state); } /** * Allows to set the value of the field thickness * @param thickness The new value of the field thickness */ public void setThicknessFieldValue(float thickness) { thicknessField.removeChangeListener(this); thicknessField.setValue(Float.valueOf(thickness).doubleValue()); thicknessField.addChangeListener(this); } public void setDotFieldValue(float width) { dotSizeField.removeChangeListener(this); dotSizeField.setValue(Float.valueOf(width).doubleValue()); dotSizeField.addChangeListener(this); } /** * Allows to set the attribute "isModified" in the drawPanel * @param modified The new value of the attribute "isModified" */ public void setIsModified(boolean modified) { drawPanel.setIsModified(modified); } /** * Allows to reinitialise some buttons */ public void reinitializeButtons() { updateUndoRedo(); codePanel.newProject(); Delimitor.setOpacity(Delimitor.DEFAULT_OPACITY); toolbar.getSliderDelimitor().setValue(Delimitor.DEFAULT_OPACITY); toolbar.getPersoGridGapField().setValue(MagneticGrid.DEFAULT_PERSONAL_GRID_GAP); menuBar.getDisplayGrid().setSelected(false); menuBar.getDisplayPersoGrid().setSelected(false); toolbar.getPersoGridGapField().setEnabled(false); toolbar.getMagneticCB().setSelected(false); rotationButtons.setSelected(false); mirrorButtons.setSelected(false); drawPanel.setOnRotation(false); preferencesFrame.readXMLPreferences(); if(drawPropertiesFrame!=null) drawPropertiesFrame.setProperties(); toolbar.getButtonImageSelect().setSelected(true); menuBar.getMenuSelect().setSelected(true); menuBar.getAutoAdjustBorders().setSelected(true); drawPanel.setMenuSelectedPopupGeneral(menuBar.getMenuSelect().getActionCommand(),true); rotateButton.setSelected(false); drawPanel.setOnRotation(false); setCurrentChoice(LaTeXDrawResources.LABEL_SELECT_FIGURE); } /** * Allows to update buttons undo/redo * (change their titles, ...) */ public void updateUndoRedo() { if(undoManager.isEmptyRedo()) { toolbar.getButtonImageRedo().setToolTipText(UndoRedoManager.EMPTY_REDO); menuBar.getRedoMenu().setText(UndoRedoManager.EMPTY_REDO); } else { toolbar.getButtonImageRedo().setToolTipText(LaTeXDrawResources.LABEL_REDO +" " +undoManager.getTextNextRedo());//$NON-NLS-1$ menuBar.getRedoMenu().setText(LaTeXDrawResources.LABEL_REDO +" " +undoManager.getTextNextRedo());//$NON-NLS-1$ } if(undoManager.isEmptyUndo()) { menuBar.getUndoMenu().setText(UndoRedoManager.EMPTY_UNDO); toolbar.getButtonImageUndo().setToolTipText(UndoRedoManager.EMPTY_UNDO); } else { menuBar.getUndoMenu().setText(LaTeXDrawResources.LABEL_UNDO +" " +undoManager.getTextNextUndo());//$NON-NLS-1$ toolbar.getButtonImageUndo().setToolTipText(LaTeXDrawResources.LABEL_UNDO +" " +undoManager.getTextNextUndo());//$NON-NLS-1$ } menuBar.getUndoMenu().setEnabled(!undoManager.isEmptyUndo()); menuBar.getRedoMenu().setEnabled(!undoManager.isEmptyRedo()); toolbar.getButtonImageRedo().setEnabled(!undoManager.isEmptyRedo()); toolbar.getButtonImageUndo().setEnabled(!undoManager.isEmptyUndo()); } /** * Allows to update fields of the frame : if a figure is selected, its parameters are updated, else general parameters are used * to set the fields. */ public void updateFrameFields() { try { Draw listSelected = drawPanel.getDraw().getSelected(); if(listSelected!=null && listSelected.size()==1) { Figure f = listSelected.getFigureAt(0); if(f!=null) { if(f instanceof Dot) { setDotFieldValue(((Dot)f).getWidth()); setDotChoice(((Dot)f).getCurrentStyle()); buttonInteriorColor.setVisible(f.canBeFilled()); } else { if(f.canHaveArrow()) { setLineArrowLChoice(((Arrowable)f).getArrow1Style()); setLineArrowRChoice(((Arrowable)f).hasTwoLeftArrows() ? ArrowHead.invertArrowStyle(((Arrowable)f).getArrow2Style()) : ((Arrowable)f).getArrow2Style()); } setThicknessFieldValue(f.getThickness()); setLineChoice(f.getLineStyle()); filledCheckBox.setSelected(f.canBeFilled() && f.isFilled()); } buttonBordersColor.setColor(f.getLinesColor()); setHatchChoice(f.getHatchingStyle()); dbleBoundCheckBox.setSelected(f.isDoubleBoundaryable() && f.hasDoubleBoundary()); shadowCheckBox.setSelected(f.hasShadow()); updateFillCB(); if(f.canHaveShadow()) buttonShadowColor.setColor(f.getShadowColor()); if(f.canBeFilled()) { buttonBordersColor.setColor(f.getLinesColor()); buttonInteriorColor.setColor(f.getInteriorColor()); buttonGradientEndC.setColor(f.getGradientEndColor()); buttonGradientStartC.setColor(f.getGradientStartColor()); } if(f.canBeHatched()) buttonHatchColor.setColor(f.getHatchingColor()); if(f.isDoubleBoundaryable()) buttonDbleBoundColor.setColor(f.getDoubleColor()); if(f.isBordersMovable()) setBorderChoice(f.getBordersPosition()); }//if } else if(listSelected!=null && listSelected.size()>1) {// We try to identify the figures' attributes that are equals. boolean ok; int i, size = listSelected.size(); Color linesC = listSelected.getFigureAt(0).getLinesColor(); for(i=0, ok=true; i0) addToUndoTransformation(listSelected); if(listSelected!=null && listSelected.size()==1) { Figure selected = listSelected.getFigureAt(0); selected.setIsFilled(ok && selected.canBeFilled()); buttonInteriorColor.setVisible(((ok && selected.canBeFilled()) || selected.hasShadow())); buttonInteriorColor.setColor(selected.getInteriorColor()); } else { genIsFilled = ok; if(listSelected!=null) for(Figure f : listSelected.getFigures()) if(f.isCustomizable() && f.canBeFilled()) f.setIsFilled(ok); } drawPanel.updateDraw(true); drawPanel.setIsModified(true); requestFocus(); return; } if(label.equals(LaTeXDrawResources.LABEL_DBLE_BOUND_CHECKBOX)) { if(listSelected!=null && listSelected.size()>0) addToUndoTransformation(listSelected); if(listSelected!=null && listSelected.size()==1) { Figure selected = listSelected.getFigureAt(0); selected.setHasDoubleBoundary(ok && selected.isDoubleBoundaryable()); buttonDbleBoundColor.setVisible(ok && selected.isDoubleBoundaryable()); } else { genHasDbleBord = ok; if(listSelected!=null) for(Figure f : listSelected.getFigures()) if(f.isCustomizable() && f.isDoubleBoundaryable()) f.setHasDoubleBoundary(ok); } if(listSelected!=null) listSelected.updateBorders(); drawPanel.updateDraw(true); drawPanel.setIsModified(true); requestFocus(); return; } if(label.equals(LaTeXDrawResources.LABEL_SHADOW_CHECKBOX)) { if(listSelected!=null && listSelected.size()>0) addToUndoTransformation(listSelected); if(listSelected!=null && listSelected.size()==1) { Figure selected = listSelected.getFigureAt(0); selected.setHasShadow(ok && selected.canHaveShadow()); buttonShadowColor.setVisible(ok && selected.canHaveShadow()); buttonInteriorColor.setVisible((ok && selected.canHaveShadow() && selected.canBeFilled() && selected.shadowFillsShape() && !selected.hasGradient()) || (!ok && selected.isFilled())); updateFillCB(); } else { genHasShadow = ok; if(listSelected!=null) for(Figure f : listSelected.getFigures()) if(f.isCustomizable() && f.canHaveShadow()) f.setHasShadow(ok); } if(listSelected!=null) listSelected.updateBorders(); drawPanel.updateDraw(true); drawPanel.setIsModified(true); requestFocus(); return; } if(label.equals(LaTeXDrawResources.LABEL_ROTATE)) { drawPanel.setOnRotation(!drawPanel.isOnRotation()); rotateButton.setSelected(drawPanel.isOnRotation()); drawPanel. requestFocus(); return ; } if(label.equals(LaTeXDrawResources.LABEL_MAGNETIC_CB)) { drawPanel.setGridIsMagnetic(toolbar.getMagneticCB().isSelected()); requestFocus(); return ; } if(label.compareTo(LaTeXDrawResources.LABEL_COLOR_HATCH)==0) { if(listSelected==null) return ; Color c = JColorChooser.showDialog((Component) e.getSource(), LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.34"), buttonHatchColor.getColor()); //$NON-NLS-1$ if(c!=null) { if(listSelected.size()>0) addToUndoTransformation(listSelected); if(listSelected.size()==1) { buttonHatchColor.setColor(c); listSelected.getFigureAt(0).setHatchingColor(c); } else { genHatchCB.setColor(c); genHatchC = c; for(Figure f : listSelected.getFigures()) if(f.isCustomizable() && f.canBeHatched()) f.setHatchingColor(c); } drawPanel.updateDraw(true); drawPanel.setIsModified(true); } requestFocus(); return ; } if(label.compareTo(LaTeXDrawResources.LABEL_COLOR_GRADIENT_FIRST)==0) { if(listSelected==null) return ; Color c = JColorChooser.showDialog((Component) e.getSource(), LaTeXDrawLang.getString1_7("LaTeXDrawFrame.7"), buttonGradientStartC.getColor()); //$NON-NLS-1$ if(c!=null) { if(listSelected.size()>0) addToUndoTransformation(listSelected); if(listSelected.size()==1) { buttonGradientStartC.setColor(c); listSelected.getFigureAt(0).setGradientStartColor(c); } else { genGradientStartCB.setColor(c); genGradientStartC = c; for(Figure f : listSelected.getFigures()) if(f.isCustomizable() && f.canBeHatched()) f.setGradientStartColor(c); } drawPanel.updateDraw(true); drawPanel.setIsModified(true); } requestFocus(); return ; } if(label.compareTo(LaTeXDrawResources.LABEL_COLOR_GRADIENT_SECOND)==0) { if(listSelected==null) return ; Color c = JColorChooser.showDialog((Component) e.getSource(), LaTeXDrawLang.getString1_7("LaTeXDrawFrame.8"), buttonGradientEndC.getColor()); //$NON-NLS-1$ if(c!=null) { if(listSelected.size()>0) addToUndoTransformation(listSelected); if(listSelected.size()==1) { buttonGradientEndC.setColor(c); listSelected.getFigureAt(0).setGradientEndColor(c); } else { genGradientEndCB.setColor(c); genGradientEndC = c; for(Figure f : listSelected.getFigures()) if(f.isCustomizable() && f.canBeHatched()) f.setGradientEndColor(c); } drawPanel.updateDraw(true); drawPanel.setIsModified(true); } requestFocus(); return ; } if(label.compareTo(LaTeXDrawResources.LABEL_COLOR_DBLE_BOUND)==0) { if(listSelected==null) return ; Color c = JColorChooser.showDialog((Component) e.getSource(), LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.151"), buttonDbleBoundColor.getColor()); //$NON-NLS-1$ if(c!=null) { if(listSelected.size()>0) addToUndoTransformation(listSelected); if(listSelected.size()==1) { buttonDbleBoundColor.setColor(c); Figure selected = listSelected.getFigureAt(0); selected.setDoubleColor(c); } else { genDbleBordCB.setColor(c); genDbleC = c; for(Figure f : listSelected.getFigures()) if(f.isCustomizable() && f.isDoubleBoundaryable()) f.setDoubleColor(c); } drawPanel.updateDraw(true); drawPanel.setIsModified(true); } requestFocus(); return ; } if(label.compareTo(LaTeXDrawResources.NAME_COLOR_SHADOW)==0) { if(listSelected==null) return ; Color c = JColorChooser.showDialog((Component) e.getSource(), LaTeXDrawLang.getString1_7("LaTeXDrawFrame.9"), buttonShadowColor.getColor()); //$NON-NLS-1$ if(c!=null) { if(listSelected.size()>0) addToUndoTransformation(listSelected); if(listSelected.size()==1) { buttonShadowColor.setColor(c); listSelected.getFigureAt(0).setShadowColor(c); } else { genShadowCB.setColor(c); genShadowC = c; for(Figure f : listSelected.getFigures()) if(f.isCustomizable() && f.canHaveShadow()) f.setShadowColor(c); } drawPanel.updateDraw(true); drawPanel.setIsModified(true); } requestFocus(); return ; } if(label.compareTo(LaTeXDrawResources.LABEL_COLOR_BUTTON)==0) { if(listSelected==null) return ; Color c = JColorChooser.showDialog((Component) e.getSource(), LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.36"), ((ColorButton)src).getColor()); //$NON-NLS-1$ if(listSelected.size()>0) addToUndoTransformation(listSelected); if(c!=null) { if(listSelected.size()==1) listSelected.getFigureAt(0).setLinesColor(c); else { genLineC = c; for(Figure f : listSelected.getFigures()) if(f.isCustomizable()) f.setLinesColor(c); } drawPanel.updateDraw(true); drawPanel.setIsModified(true); ((ColorButton)src).setColor(c); } requestFocus(); return ; } if(label.compareTo(LaTeXDrawResources.LABEL_COLOR_INTERIOR_BUTTON)==0) { if(listSelected==null) return ; Color c = JColorChooser.showDialog((Component) e.getSource(), LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.37"), ((ColorButton)src).getColor()); //$NON-NLS-1$ if(c!=null) { if(listSelected.size()>0) addToUndoTransformation(listSelected); if(listSelected.size()==1) listSelected.getFigureAt(0).setInteriorColor(c); else { genInteriorC = c; for(Figure f : listSelected.getFigures()) if(f.isCustomizable() && f.canBeFilled()) f.setInteriorColor(c); } drawPanel.updateDraw(true); drawPanel.setIsModified(true); ((ColorButton)src).setColor(c); } requestFocus(); return ; } if(label.equals(LaTeXDrawResources.LABEL_JOIN)) { drawPanel.joinSelection(undoManager); updateUndoRedo(); setSelection(true); setIsModified(true); setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.154")); //$NON-NLS-1$ requestFocus(); return; } if(label.equals(LaTeXDrawResources.LABEL_SEPARATE)) { drawPanel.separateSelection(undoManager); updateUndoRedo(); setSelection(true); setIsModified(true); setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.155")); //$NON-NLS-1$ requestFocus(); return ; } if(label.equals(LaTeXDrawResources.LABEL_BEHIND_SEL)) { setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); drawPanel.setOnWaitingClicDispositionBehind(true); requestFocus(); return; } if(label.equals(LaTeXDrawResources.LABEL_FRONT_SEL)) { setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); drawPanel.setOnWaitingClicDispositionFront(true); requestFocus(); return; } if(label.equals(LaTeXDrawResources.LABEL_BACKGROUND)) { drawPanel.selectedInBackground(); setIsModified(true); requestFocus(); return; } if(label.equals(LaTeXDrawResources.LABEL_FOREGROUND)) { drawPanel.selectedInForeground(); setIsModified(true); requestFocus(); return; } if(label.equals(LaTeXDrawResources.LABEL_ROTATE_90)) { drawPanel.draw.rotateSelection(Math.PI/2.); requestFocus(); return ; } if(label.equals(LaTeXDrawResources.LABEL_ROTATE_180)) { drawPanel.draw.rotateSelection(Math.PI); requestFocus(); return ; } if(label.equals(LaTeXDrawResources.LABEL_ROTATE_270)) { drawPanel.draw.rotateSelection(3*Math.PI/2.); requestFocus(); return ; } if(label.equals(LaTeXDrawResources.LABEL_MIRROR_H)) { drawPanel.draw.mirrorHorizontal(); requestFocus(); return ; } if(label.equals(LaTeXDrawResources.LABEL_MIRROR_V)) { drawPanel.draw.mirrorVertical(); requestFocus(); return ; } if(label.equals(LaTeXDrawResources.LABEL_TEX_EDITOR)) { String title = LaTeXDrawLang.getString1_8("LaTeXDrawFrame.19"); //$NON-NLS-1$ if(pathTexEditor==null || pathTexEditor.length()==0) JOptionPane.showMessageDialog(this, LaTeXDrawLang.getString1_8("LaTeXDrawFrame.20"), //$NON-NLS-1$ title, JOptionPane.WARNING_MESSAGE); else try{Runtime.getRuntime().exec(pathTexEditor);} catch(Exception ex) { JOptionPane.showMessageDialog(this, ""+LaTeXDrawLang.getString1_8("LaTeXDrawFrame.21")+"
    "+//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ LaTeXDrawLang.getString1_8("LaTeXDrawFrame.22")+"", //$NON-NLS-1$//$NON-NLS-2$ title, JOptionPane.WARNING_MESSAGE); } requestFocus(); return ; } if(label.equals(LaTeXDrawResources.LABEL_TEMPLATE_UPDATE)) { menuBar.getMenuTemplate().updateTemplates(); setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.160")); //$NON-NLS-1$ requestFocus(); return ; } if(label.equals(LaTeXDrawResources.LABEL_COMMENTS)) { addCommentsFrame.setVisible(true); return; } if(label.equals(LaTeXDrawResources.LABEL_PREFERENCES)) { if(!preferencesFrame.isVisible()) preferencesFrame.setVisible(true); return ; } if(label.equals(LaTeXDrawResources.LABEL_INSERT_CODE)) { if(insertCodeFrame==null) insertCodeFrame = new InsertPSTricksCodeFrame(this); insertCodeFrame.setVisible(true); requestFocus(); return ; } if(label.equals(LaTeXDrawResources.LABEL_DRAW_PROPERTIES)) { if(drawPropertiesFrame==null) drawPropertiesFrame = new DrawPropertiesFrame(this); drawPropertiesFrame.setVisible(true); return ; } if(label.equals(LaTeXDrawResources.LABEL_HELP)) { if(helpFrame==null) createHelpFrame(); if(helpFrame!=null) helpFrame.setVisible(true); return; } if(label.equals(LaTeXDrawResources.LABEL_DISPLAY_GRID)) { if(menuBar.getDisplayGrid().isSelected()) { menuBar.getDisplayPersoGrid().setSelected(false); toolbar.getPersoGridGapField().setEnabled(false); } displayGrid(menuBar.getDisplayGrid().isSelected(), menuBar.getDisplayGrid().isSelected()); return; } if(label.equals(LaTeXDrawResources.LABEL_DISPLAY_PERSO_GRID)) { if(menuBar.getDisplayPersoGrid().isSelected()) { menuBar.getDisplayGrid().setSelected(false); toolbar.getPersoGridGapField().setEnabled(true); } displayGrid(menuBar.getDisplayPersoGrid().isSelected(), !menuBar.getDisplayPersoGrid().isSelected()); return; } if(label.equals(LaTeXDrawResources.LABEL_ABOUT)) { if(aboutTeXDraw==null) createAboutLaTeXDrawFrame(); aboutTeXDraw.setVisible(true); return; } if(label.equals(LaTeXDrawResources.LABEL_DISPLAY_CODE_PANEL)) { if(!(e.getSource() instanceof JCheckBoxMenuItem)) menuBar.getDisplayCodePanel().setSelected(!menuBar.getDisplayCodePanel().isSelected()); displayCodePanel(menuBar.getDisplayCodePanel().isSelected()); requestFocus(); return; } if(label.compareTo(LaTeXDrawResources.TEMPLATE_START_ACTION_CMD)>0) { String str = label.substring(LaTeXDrawResources.TEMPLATE_START_ACTION_CMD.length()); boolean fromShared = str.charAt(0)=='0' ? false : true; String path; String name = str.substring(1) + SVGFilter.SVG_EXTENSION; if(fromShared) path = LaTeXDrawPath.PATH_TEMPLATES_SHARED==null ? null : LaTeXDrawPath.PATH_TEMPLATES_SHARED+File.separator+name; else path = LaTeXDrawPath.PATH_TEMPLATES_DIR_USER+File.separator+name; Draw template = SVGDocumentGenerator.toLatexdraw(new File(path), null, null); if(template!=null) { template.setDrawFigures(true); template.setSelected(false); if(template.size()==0) return ; drawPanel.getDraw().addFigure(template.size()>1 ? template : template.getFigureAt(0), undoManager); updateUndoRedo(); drawPanel.updateDraw(true); } else { JOptionPane.showMessageDialog(this, ""+LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.19")+"
    "+LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.20")+"",//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.21"), JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$ } requestFocus(); return ; } } catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } // if(src instanceof JMenuItem || src instanceof JButton) } /** * To launch when the selected figures are transformed : add an undo. * @param listSelected THe list of the selected figures. * @since 1.9.1 */ private void addToUndoTransformation(Draw listSelected) { try { Object clone = listSelected.clone(); Vector
    figures = drawPanel.draw.getFigures(); int i, size = listSelected.size(); int[] id = new int[size]; for(i=0; i=0) //$NON-NLS-1$ { draw = new DrawContainer(); draw.open(in); } else draw = (DrawContainer)in.readObject(); drawPanel.setDraw(draw); draw = drawPanel.getDraw(); draw.isSelection(false); toolbar.getSliderDelimitor().setValue(Delimitor.getOpacity()); menuBar.getDisplayBorders().setSelected(displayB); draw.setParentPanel(drawPanel); draw.setAutoAdjustement(menuBar.getAutoAdjustBorders().isSelected()); draw.displayBorders(displayB); undoManager.setFigures(draw.getFigures()); setPreferredSize((Dimension)in.readObject()); Point location = (Point)in.readObject(); setLocation(new Point(Math.max(0, location.x), Math.max(0, location.y))); splitPane.setDividerLocation(in.readInt()); displayCodePanel(in.readBoolean()); codePanel.setIsInAutoUpdate(autoUpd); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); formerDividerLocation=(int)(dim.width*0.7); formerIsInAutoUpdate = !isCodePanelDisplayed(); toolbar.getButtonImageBorders().setSelected(menuBar.getDisplayBorders().isSelected()); drawPanel.setIsGridDisplay(in.readBoolean()); menuBar.getDisplayXScale().setSelected(in.readBoolean()); menuBar.getDisplayYScale().setSelected(in.readBoolean()); codePanel.setComments((String) in.readObject()); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.6")>=0) //$NON-NLS-1$ { codePanel.setLabel((String)in.readObject()); codePanel.setCaption((String)in.readObject()); codePanel.setPositionHoriToken((String)in.readObject()); codePanel.setPositionVertToken((String)in.readObject()); } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.8")>=0) //$NON-NLS-1$ { drawPanel.setGridIsMagnetic(in.readBoolean()); toolbar.getMagneticCB().setSelected(drawPanel.isGridMagnetic()); boolean isClassicGrid = in.readBoolean(); menuBar.getDisplayGrid().setSelected(isClassicGrid && drawPanel.isGridDisplayed()); menuBar.getDisplayPersoGrid().setSelected(!isClassicGrid && drawPanel.isGridDisplayed()); toolbar.getPersoGridGapField().setEnabled(menuBar.getDisplayPersoGrid().isSelected()); drawPanel.draw.setClassicGridDrawn(isClassicGrid); drawPanel.draw.setPersonalGridGap(in.readInt()); toolbar.getPersoGridGapField().setValue(drawPanel.draw.getPersonalGridGap()); } else { menuBar.getDisplayGrid().setSelected(drawPanel.isGridDisplayed()); menuBar.getDisplayPersoGrid().setSelected(false); toolbar.getPersoGridGapField().setEnabled(false); } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.9")>=0) //$NON-NLS-1$ { Delimitor.setOpacity(in.readInt()); toolbar.getSliderDelimitor().setValue(Delimitor.getOpacity()); } currentFile = new File(currentFile.getPath().substring(0, currentFile.getPath().length()-LaTeXDrawResources.PROJECT_EXTENSION.length())+SVGFilter.SVG_EXTENSION); drawPanel.updateDraw(true); in.close(); setTitle(); undoManager = new UndoRedoManager(drawPanel.getDraw().getFigures(), drawPanel.getDraw(), this); updateUndoRedo(); setSelection(false); setIsModified(false); preferencesFrame.addRecentFile(file.getAbsolutePath()); menuBar.updateRecentFilesMenu(); setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.202")); //$NON-NLS-1$ } } catch(InvalidClassException ex) { currentFile = null; setIsModified(false); if(withDialog) JOptionPane.showMessageDialog(this, LaTeXDrawLang.getString1_9("LaTeXDrawFrame.12"), //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.86"), JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$ return false; } catch(Exception ex) { setIsModified(false); currentFile = null; setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.203")); //$NON-NLS-1$ ex.printStackTrace(); if(withDialog) JOptionPane.showMessageDialog(this, LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.204") + ex.toString(), //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.86"), JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$ return false; } } else { setIsModified(false); currentFile = null; setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.203")); //$NON-NLS-1$ if(withDialog) JOptionPane.showMessageDialog(this, LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.18"), //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.86"), JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$ return false; } return true; } /** * Allows to create and display a dialog box which ask to * the user if he wants to save his project or not * @return JOptionPane.YES_OPTION or JOptionPane.NO_OPTION */ private int dialogConfirmSave() { return (JOptionPane.showConfirmDialog(this, LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.156"), //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.110"), JOptionPane.YES_NO_CANCEL_OPTION)); //$NON-NLS-1$ } /** * Allows to create the frame which contains to LaTeXDraw help */ private void createHelpFrame() { try { JPanel pHelp = new JPanel(new BorderLayout()); final JEditorPane htmlPageEditor = new JEditorPane(); htmlPageEditor.setEditable(false); URL helpURL = getClass().getResource("/help/index.html");//$NON-NLS-1$ htmlPageEditor.setPage(helpURL); helpFrame = new JFrame(); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); htmlPageEditor.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) try { htmlPageEditor.setPage(event.getURL()); } catch(IOException ioe) { ioe.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ioe); } } }); JScrollPane scrollPane = new JScrollPane (htmlPageEditor); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); pHelp.add(scrollPane); helpFrame.getContentPane().add(pHelp, BorderLayout.CENTER); helpFrame.setSize(dim.width,dim.height); helpFrame.setLocation(0, 0); helpFrame.setResizable(true); helpFrame.setTitle(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.215")); //$NON-NLS-1$ helpFrame.setVisible(false); helpFrame.setIconImage(Toolkit.getDefaultToolkit().getImage( getClass().getClassLoader().getResource("res/help-browser.png")));//$NON-NLS-1$ }catch(Exception ex) { JOptionPane.showMessageDialog(this, LaTeXDrawLang.getString1_9("LaTeXDrawFrame.13"), //$NON-NLS-1$ LaTeXDrawLang.getString1_9("LaTeXDrawFrame.14"), //$NON-NLS-1$ JOptionPane.WARNING_MESSAGE); } } /** * Allows to create the "About LaTeXDraw" box */ private void createAboutLaTeXDrawFrame() { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); aboutTeXDraw = new JFrame(); JTabbedPane tabbedPane = new JTabbedPane(); JPanel p2 = new JPanel(), panel = new JPanel(); JButton okB = new JButton(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.23")); //$NON-NLS-1$ aboutTeXDraw.setTitle(LaTeXDrawResources.LABEL_ABOUT); aboutTeXDraw.setLocation(dim.width*1/4, dim.height*1/16); Image i = Toolkit.getDefaultToolkit().getImage( getClass().getClassLoader().getResource("res/LaTeXDrawSmall.png"));//$NON-NLS-1$ MediaTracker tracker=new MediaTracker(this); tracker.addImage(i,0); try { tracker.waitForID(0); } catch(InterruptedException e) { e.printStackTrace(); } p2.add(new DisplayCanvas(i)); try { JEditorPane editorPane = new JEditorPane(); editorPane.setEditable(false); editorPane.setDragEnabled(true); editorPane.setContentType("text/html");//$NON-NLS-1$ editorPane.setBackground(tabbedPane.getBackground()); editorPane.setText("

    "+ //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.218")+"
    "+//$NON-NLS-1$//$NON-NLS-2$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.219")+ " " + //$NON-NLS-1$ VERSION + (VERSION_STABILITY.length()==0 ? "" : " " + VERSION_STABILITY) + LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.220") + " " + ID_BUILD+"

    "+//$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ LaTeXDrawResources.LABEL_APP+ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.221")+"
    "+//$NON-NLS-1$//$NON-NLS-2$ "Copyright(c) 2005-2010 - Arnaud BLOUIN - arno.b.dev@gmail.com

    "+//$NON-NLS-1$ "http://latexdraw.sourceforge.net/
    ");//$NON-NLS-1$ tabbedPane.add(LaTeXDrawLang.getDialogFrameString("PreferencesFrame.general"), new JScrollPane(editorPane)); //$NON-NLS-1$ } catch(Exception e) { System.out.println("About tabular cannot be created."); } //$NON-NLS-1$ try { JEditorPane editorPane = new JEditorPane(); editorPane.setEditable(false); editorPane.setDragEnabled(true); editorPane.setContentType("text/html");//$NON-NLS-1$ editorPane.setBackground(tabbedPane.getBackground()); editorPane.setText("


    "+ //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.25")+"

    "+ //$NON-NLS-1$//$NON-NLS-2$ LaTeXDrawLang.getString1_6("LaTeXDrawFrame.18")+"
    "+//$NON-NLS-1$//$NON-NLS-2$ LaTeXDrawLang.getString1_6("LaTeXDrawFrame.19")+"
    "+//$NON-NLS-1$//$NON-NLS-2$ "
    ");//$NON-NLS-1$ tabbedPane.add(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.25"), new JScrollPane(editorPane)); //$NON-NLS-1$ } catch(Exception e) { System.out.println("Library tabular cannot be created."); } //$NON-NLS-1$ try { JEditorPane editorPane = new JEditorPane(getClass().getResource("/res/translators.txt"));//$NON-NLS-1$ editorPane.setEditable(false); editorPane.setDragEnabled(true); tabbedPane.add(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.26"), new JScrollPane(editorPane)); //$NON-NLS-1$ } catch(Exception e) { System.out.println("Translators tabular cannot be created."); } //$NON-NLS-1$ try { JEditorPane editorPane = new JEditorPane(getClass().getResource("/release_note.txt"));//$NON-NLS-1$ editorPane.setEditable(false); editorPane.setDragEnabled(true); tabbedPane.add(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.27"), new JScrollPane(editorPane)); //$NON-NLS-1$ } catch(Exception e) { System.out.println("Release note tabular cannot be created."); } //$NON-NLS-1$ try { JEditorPane editorPane = new JEditorPane(getClass().getResource("/license.txt"));//$NON-NLS-1$ editorPane.setEditable(false); editorPane.setDragEnabled(true); tabbedPane.add(LaTeXDrawLang.getString1_8("LaTeXDrawFrame.28"), new JScrollPane(editorPane)); //$NON-NLS-1$ } catch(Exception e) { System.out.println("License tabular cannot be created."); } //$NON-NLS-1$ tabbedPane.setPreferredSize(new Dimension(490, 290)); p2.add(tabbedPane); aboutTeXDraw.setIconImage(LaTeXDrawResources.aboutIcon.getImage()); okB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { aboutTeXDraw.setVisible(false); } }); panel.add(okB); aboutTeXDraw.getContentPane().setLayout(new BorderLayout()); aboutTeXDraw.getContentPane().add(p2, BorderLayout.CENTER); aboutTeXDraw.getContentPane().add(panel, BorderLayout.SOUTH); aboutTeXDraw.setSize(500, 620); aboutTeXDraw.setResizable(false); } private void readObject(@SuppressWarnings("unused") ObjectInputStream ois) { /* Nothing to do. */ } /** * Actions to do when an item change. */ public void itemStateChanged(ItemEvent e) { if(e.getSource() instanceof LaTeXDrawComboBox) { LaTeXDrawComboBox c = (LaTeXDrawComboBox)e.getSource(); String label = c.getName(); try { DrawContainer draw = drawPanel.getDraw(); Draw listSelected = draw.getSelected(); if(label.compareTo(Figure.LABEL_HATCH_CHOICE)==0) { String style = ((JLabel) hatchChoice.getSelectedItem()).getText(); Object item = e.getItem(); if(listSelected==null || (item instanceof JLabel && ((JLabel)item).getName().compareTo(style)!=0 && listSelected.size()<2)) return ; if(listSelected.size()>0) addToUndoTransformation(listSelected); if(listSelected.size()==1) { Figure selected = listSelected.getFigureAt(0); selected.setHatchingStyle(style); if(style.compareTo(PSTricksConstants.TOKEN_FILL_GRADIENT)==0) { buttonGradientEndC.setVisible(true); buttonGradientStartC.setVisible(true); buttonInteriorColor.setVisible(false); filledCheckBox.setVisible(false); buttonHatchColor.setVisible(false); } else { buttonHatchColor.setVisible(style.compareTo(PSTricksConstants.TOKEN_FILL_SOLID)!=0 && style.compareTo(PSTricksConstants.TOKEN_FILL_NONE)!=0); filledCheckBox.setVisible(true); buttonGradientEndC.setVisible(false); buttonGradientStartC.setVisible(false); buttonInteriorColor.setVisible(filledCheckBox.isSelected()); } } else { genHatchS = style; for(Figure f : listSelected.getFigures()) if(f.isCustomizable() && f.canBeHatched()) f.setHatchingStyle(style); } updateFillCB(); drawPanel.updateDraw(true); setIsModified(true); return ; } if(label.compareTo(Figure.LABEL_BORDERS_POSITION_CHOICE)==0) { String style = ((JLabel) bordersPositionChoice.getSelectedItem()).getText(); Object item = e.getItem(); if(listSelected==null || (item instanceof JLabel && ((JLabel)item).getName().compareTo(style)!=0 && listSelected.size()<2)) return ; if(listSelected.size()>0) addToUndoTransformation(listSelected); if(listSelected.size()==1) listSelected.getFigureAt(0).setBordersPosition(style); else { genBordPosS = style; for(Figure f : listSelected.getFigures()) if(f.isCustomizable() && f.isBordersMovable()) f.setBordersPosition(style); } listSelected.updateBorders(); drawPanel.updateDraw(true); setIsModified(true); return ; } if(label.compareTo(LaTeXDrawResources.CHOICE_ARROW_LEFT_NAME)==0) { String arrowS = ((JLabel)lineArrowLChoice.getSelectedItem()).getText(); Object item = e.getItem(); if(listSelected==null || (item instanceof JLabel && ((JLabel)item).getName().compareTo(arrowS)!=0 && listSelected.size()<2)) return ; if(listSelected.size()>0) addToUndoTransformation(listSelected); if(listSelected.size()==1) { Figure selected = listSelected.getFigureAt(0); if(selected instanceof Arrowable) ((Arrowable)selected).setArrow1Style(arrowS); } else { genLeftArrS = arrowS; for(Figure f : listSelected.getFigures()) if(f.isCustomizable() && f instanceof Arrowable) ((Arrowable)f).setArrow1Style(arrowS); } drawPanel.updateDraw(true); setIsModified(true); return; } if(label.compareTo(LaTeXDrawResources.CHOICE_ARROW_RIGHT_NAME)==0) { String arrowS = ((JLabel)lineArrowRChoice.getSelectedItem()).getText(); Object item = e.getItem(); if(listSelected==null || (item instanceof JLabel && ((JLabel)item).getName().compareTo(arrowS)!=0 && listSelected.size()<2)) return ; if(listSelected.size()>0) addToUndoTransformation(listSelected); if(listSelected.size()==1) { Figure selected = listSelected.getFigureAt(0); if(selected instanceof Arrowable) { if(((Arrowable)selected).hasTwoLeftArrows()) arrowS = ArrowHead.invertArrowStyle(arrowS); ((Arrowable)selected).setArrow2Style(arrowS); } } else { genRightArrS = arrowS; for(Figure f : listSelected.getFigures()) if(f.isCustomizable() && f instanceof Arrowable) ((Arrowable)f).setArrow2Style(((Arrowable)f).hasTwoLeftArrows() ? ArrowHead.invertArrowStyle(arrowS) : arrowS); } drawPanel.updateDraw(true); setIsModified(true); return; } if(label.compareTo(LaTeXDrawResources.CHOICE_LINE_NAME)==0) { String str = ((JLabel) lineChoice.getSelectedItem()).getText(); Object item = e.getItem(); if(listSelected==null || (item instanceof JLabel && ((JLabel)item).getName().compareTo(str)!=0 && listSelected.size()<2)) return ; if(listSelected.size()>0) addToUndoTransformation(listSelected); if(listSelected.size()==1) listSelected.getFigureAt(0).setLineStyle(str); else { genLineStyleS = str; for(Figure f : listSelected.getFigures()) if(f.isCustomizable() && f.isDashableOrDotable()) f.setLineStyle(str); } drawPanel.updateDraw(true); setIsModified(true); return ; } if(label.compareTo(LaTeXDrawResources.CHOICE_DOT_NAME)==0) { String str = ((JLabel) dotChoice.getSelectedItem()).getText(); Object item = e.getItem(); if(listSelected==null || (item instanceof JLabel && ((JLabel)item).getName().compareTo(str)!=0 && listSelected.size()<2)) return ; if(listSelected.size()>0) addToUndoTransformation(listSelected); if(listSelected.size()==1) { Figure selected = listSelected.getFigureAt(0); if(selected instanceof Dot) { ((Dot)selected).setCurrentStyle(str); filledCheckBox.setVisible(false); buttonInteriorColor.setVisible(((Dot)selected).canBeFilled() && selected.isFilled()); } } else { genDotS = str; for(Figure f : listSelected.getFigures()) if(f instanceof Dot) ((Dot)f).setCurrentStyle(str); } listSelected.updateBorders(); setIsModified(true); drawPanel.updateDraw(true); return; } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } } /** * @return Returns the xScale. */ public XScale getXScale() { return xScale; } /** * @return Returns the yScale. */ public YScale getYScale() { return yScale; } /** * @return the checkNewVersion */ public boolean isCheckNewVersion() { return checkNewVersion; } /** * @param checkNewVersion the checkNewVersion to set */ public void setCheckNewVersion(boolean checkNewVersion) { this.checkNewVersion = checkNewVersion; } /** * @return the text of statusBar */ public String getStatusBarText() { return statusBar.getText(); } /** * @param text The text to put in the statusbar */ public void setStatusBarText(String text) { statusBar.setText(text); } /** * @param unitForPixelsPerCm The unitForPixelsPerCm to set. */ public void setUnitForPixelsPerCm(String unitForPixelsPerCm) { drawPanel.getDraw().setUnitForPixelsPerCm(unitForPixelsPerCm); xScale.setUnitForPixelsPerCm(unitForPixelsPerCm); } /** * Allows to choose and to insert a picture in the draw */ public void insertPicture() { try { if(fileChooserPicture==null) fileChooserPicture = new PictureChooser(this, LaTeXDrawLang.getString1_6("LaTeXDrawFrame.23"), //$NON-NLS-1$ true, LaTeXDrawLang.getString1_6("LaTeXDrawFrame.1")); //$NON-NLS-1$ File file = fileChooserPicture.displayFrame(); if(file!=null && file.canRead() && file.isFile()) { setStatusBarText(LaTeXDrawLang.getString1_6("LaTeXDrawFrame.25")); //$NON-NLS-1$ boolean state = drawPanel.insertPicture(undoManager, file.getAbsolutePath()); if(state) setStatusBarText(LaTeXDrawLang.getString1_6("LaTeXDrawFrame.28")); //$NON-NLS-1$ else setStatusBarText(LaTeXDrawLang.getString1_6("LaTeXDrawFrame.27")); //$NON-NLS-1$ } } catch(Exception ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(this, LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.204") + ex.toString(), //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.86"), JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$ } } /** * Allows to convert several figures in an other format. */ public void batchConvertion() { convertFrame.setVisible(true); } /** * @param state Define if the grid must be magnetic. */ public void setMagneticGrid(boolean state) { toolbar.getMagneticCB().setSelected(state); drawPanel.setGridIsMagnetic(state); } /** * @param value Define the interval between two lines of the personal grid. */ public void setPersoGridGap(int value) { toolbar.getPersoGridGapField().setValue(value); drawPanel.draw.setPersonalGridGap(value); } /** * @return the pathTexEditor. */ public String getPathTexEditor() { return pathTexEditor; } /** * @param pathTexEditor the pathTexEditor to set. */ public void setPathTexEditor(String pathTexEditor) { this.pathTexEditor = pathTexEditor; } /** * Selects all the figures of the current drawing and put the current action to "selection". * @since 1.9 */ public void selectAllFigures() { menuBar.getMenuSelect().setSelected(true); toolbar.getButtonImageSelect().setSelected(true); actionPerformed(new ActionEvent(menuBar.getMenuSelect(), 0, LaTeXDrawResources.LABEL_SELECT_FIGURE)); drawPanel.getDraw().selectAll(); setSelection(true); setCurrentChoice(LaTeXDrawResources.LABEL_SELECT_FIGURE); } public void showShortcutsFrame() { if(shortcutsFrame==null) shortcutsFrame = new ShortcutsFrame(); shortcutsFrame.setVisible(true); } public static void setCurrentChoice(String currentChoice) { LaTeXDrawFrame.currentChoice = currentChoice; } public void setFormerIsInAutoUpdate(boolean formerIsInAutoUpdate) { this.formerIsInAutoUpdate = formerIsInAutoUpdate; } /** * @return the lookAndFeel. * @since 1.9 */ public static String getLookAndFeel() { return lookAndFeel; } /** * @param lookAndFeel the lookAndFeel to set. * @since 1.9 */ public static void setLookAndFeel(String lookAndFeel) { if(lookAndFeel==null) throw new IllegalArgumentException(); LaTeXDrawFrame.lookAndFeel = lookAndFeel; } /** * @return True if the selection of figures is activated. * @since 1.9 */ public boolean isOnSelection() { return getLMenuBar().getMenuSelect().isSelected(); } /** * Defines if the CheckBox FillCB must be enable or not considering if the current selected figure. * has a shadow or not (in pstricks, all shape having a shadow is filled but joined-lines, akin-points and Bézier curves). * @since 1.9 */ protected void updateFillCB() { Draw selection = drawPanel.draw.getSelected(); if(selection!=null && selection.size()==1) { Figure f = selection.getFigureAt(0); if(!f.canBeFilled()) return ; if(f instanceof JoinedLines || f instanceof BezierCurve || f instanceof AkinPoints) { String txt = f.getHatchingStyle(); filledCheckBox.setEnabled(!(shadowCheckBox.isSelected() && f.canHaveShadow() && (txt.equals(PSTricksConstants.TOKEN_FILL_CROSSHATCH) || txt.equals(PSTricksConstants.TOKEN_FILL_CROSSHATCH_F) || txt.equals(PSTricksConstants.TOKEN_FILL_HLINES) || txt.equals(PSTricksConstants.TOKEN_FILL_HLINES_F) || txt.equals(PSTricksConstants.TOKEN_FILL_VLINES) || txt.equals(PSTricksConstants.TOKEN_FILL_VLINES_F)))); } else filledCheckBox.setEnabled(!shadowCheckBox.isSelected() || !f.canHaveShadow()); } } /** * Initialise the values of the general parameters (do not change the fields). * @since 1.9.1 */ protected void initializeGeneralFields() { genBordPosS = Figure.DEFAULT_BORDERS_POSITION; genDbleBordCB.setColor(Figure.DEFAULT_DOUBLE_COLOR); genDotS = Dot.DEFAULT_DOT_STYLE; genGradientEndCB.setColor(PSTricksConstants.DEFAULT_GRADIENT_END_COLOR); genGradientStartCB.setColor(PSTricksConstants.DEFAULT_GRADIENT_START_COLOR); genHasDbleBord = Figure.DEFAULT_HAS_DOUBLE_BOUNDARY; genHatchCB.setColor(Figure.DEFAULT_HATCH_COL); genHatchS = Figure.DEFAULT_HATCH_STYLE; genInteriorCB.setColor(Figure.DEFAULT_INTERIOR_COL); genIsFilled = Figure.DEFAULT_IS_FILLED; genLeftArrS = genRightArrS = ArrowHead.DEFAULT_STYLE; genLineCB.setColor(Figure.DEFAULT_BORDERS_COL); genLineStyleS = Figure.DEFAULT_LINE_STYLE; genThickness = Figure.DEFAULT_THICKNESS; genDotSize = Dot.DEFAULT_WIDTH; genGradientEndC = PSTricksConstants.DEFAULT_GRADIENT_END_COLOR; genGradientStartC = PSTricksConstants.DEFAULT_GRADIENT_START_COLOR; genDbleC = Figure.DEFAULT_DOUBLE_COLOR; genHatchC = Figure.DEFAULT_HATCH_COL; genInteriorC = Figure.DEFAULT_INTERIOR_COL; genLineC = Figure.DEFAULT_BORDERS_COL; genShadowC = Figure.DEFAULT_SHADOW_COLOR; } /** * @return The frame of preferences. * @since 2.0.0 */ public PreferencesFrame getPreferencesFrame() { return preferencesFrame; } public void windowStateChanged(WindowEvent e) { updateSplitSeparatorPosition(); } /** * Update the position of the divider. * @since 2.0.0 */ public void updateSplitSeparatorPosition() { if(isCodePanelDisplayed()) { int widthFrame, dividerLocation; formerDividerLocation = splitPane.getDividerLocation(); widthFrame = getExtendedState()==Frame.MAXIMIZED_BOTH ? Toolkit.getDefaultToolkit().getScreenSize().width : getSize().width; dividerLocation = (int)(widthFrame*getDividerPosition()); splitPane.setDividerLocation(dividerLocation); codePanel.editor.setPreferredSize(new Dimension(widthFrame-dividerLocation, codePanel.editor.getPreferredSize().height)); codePanel.editor.revalidate(); } } /** * @return the splitPane. * @since 2.0.0 */ public JSplitPane getSplitPane() { return splitPane; } public double getDividerCurrentLocation() { return isCodePanelDisplayed() ? splitPane.getDividerLocation() : formerDividerLocation; } /** * @return the dividerPosition read in the preferences file. * @since 2.0.0 */ public double getDividerPosition() { return dividerPosition; } /** * @param dividerPosition the dividerPosition to set in ]0;1[. * @since 2.0.0 */ public void setDividerPosition(double dividerPosition) { if(dividerPosition>0 && dividerPosition<=1) { this.dividerPosition = dividerPosition; updateSplitSeparatorPosition(); } } /** * Sets the XML element "meta" with the parameters of the code panel. * @param document The XML document. * @param meta The Element to fill. * @throws IllegalArgumentException If document or meta is null. * @since 2.0.0 */ public void getXMLMetadata(Document document, Element meta) { if(document==null || meta==null) throw new IllegalArgumentException(); Element elt = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_VERSION), elt2; elt.appendChild(document.createTextNode(VERSION)); meta.appendChild(elt); elt = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_SIZE); meta.appendChild(elt); elt2 = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_WIDTH); elt2.setTextContent(String.valueOf(getWidth())); elt.appendChild(elt2); elt2 = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_HEIGHT); elt2.setTextContent(String.valueOf(getHeight())); elt.appendChild(elt2); elt = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_POSITION); meta.appendChild(elt); elt2 = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_POSITION_X); elt2.setTextContent(String.valueOf(getLocation().x)); elt.appendChild(elt2); elt2 = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_POSITION_Y); elt2.setTextContent(String.valueOf(getLocation().y)); elt.appendChild(elt2); elt = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_DIVIDER_POSITION); double divLoc = isCodePanelDisplayed() ? getDividerCurrentLocation() : 1; elt.setTextContent(String.valueOf(divLoc1 ? divLoc/getWidth() : 0.8)); meta.appendChild(elt); elt = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_DISPLAY_CODE_PANEL); elt.setTextContent(String.valueOf(menuBar.getDisplayCodePanel().isSelected())); meta.appendChild(elt); elt = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_DISPLAY_X); elt.setTextContent(String.valueOf(menuBar.getDisplayXScale().isSelected())); meta.appendChild(elt); elt = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_DISPLAY_Y); elt.setTextContent(String.valueOf(menuBar.getDisplayYScale().isSelected())); meta.appendChild(elt); elt = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_DELIMITOR_OPACITY); elt.setTextContent(String.valueOf(Delimitor.getOpacity())); meta.appendChild(elt); } /** * Sets the latexdraw parameters from the metadata SVG tag. * @param nl The list of the parameters. * @since 2.0.0 */ public void setXMLMetadata(NodeList nl) { if(nl==null) return ; Node n, n2; String name; double dividerPos = -1; for(int i=0, size = nl.getLength(); i0) { formerDividerLocation = (int)(getWidth()*dividerPos); setDividerPosition(dividerPos); } } public void setZoom(double zoom) { drawPanel.getDraw().setZoom(zoom); toolbar.getZoomField().setValue(drawPanel.getDraw().getZoom()*100.); } /** * @return The menu listener. * @since 2.0.0 */ public MenusListener getMenuListener() { return menusListener; } /** * @return the toolbar. * @since 2.0.0 */ public LToolbar getToolbar() { return toolbar; } /** * @return The recent files Listener. * @since 2.0.0 */ public RecentFilesListener getRecentFilesListener() { return recentFilesListener; } public LMenuBar getLMenuBar() { return menuBar; } /** * @return the progressBar. * @since 2.0.0 */ public JProgressBar getProgressBar() { return progressBar; } /** * @return the stopButton. * @since 2.0.0 */ public JButton getStopButton() { return stopButton; } /** * @return the currentFile. * @since 2.0.0 */ public File getCurrentFile() { return currentFile; } /** * @param currentFile the currentFile to set. * @since 2.0.0 */ public void setCurrentFile(File currentFile) { this.currentFile = currentFile; } /** * @return the formerDividerLocation. * @since 2.0.0 */ public int getFormerDividerLocation() { return formerDividerLocation; } public void setPathDistribLatex(String path) { pathDistribLatex = path; } public String getPathDistribLatex() { return pathDistribLatex; } public void setLatexIncludes(String includes) { latexIncludes = includes; } public String getLatexIncludes() { return latexIncludes; } public void setIsInAutoUpdate(boolean auto) { menuBar.getMenuAutoUpdate().setSelected(auto); codePanel.setIsInAutoUpdate(auto); } } latexdraw-2.0.8+1.orig/latexDraw/ui/DrawPanel.java0000644000000000000000000015617611347255510016610 0ustar package latexDraw.ui; import java.awt.Color; import java.awt.Component; import java.awt.Cursor; import java.awt.Point; import java.awt.event.*; import java.awt.geom.Arc2D; import java.io.File; import java.io.ObjectInputStream; import javax.swing.*; import latexDraw.figures.*; import latexDraw.figures.properties.Arrowable; import latexDraw.lang.LaTeXDrawLang; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.dialog.ExceptionFrameDialog; import latexDraw.util.LaTeXDrawCursor; import latexDraw.util.LaTeXDrawNamespace; import latexDraw.util.LaTeXDrawPoint2D; import latexDraw.util.LaTeXDrawResources; import latexDraw.util.UndoRedoManager; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; /** * * This class defines the panel which contains the drawing which is used to generate the psTricks code.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public final class DrawPanel extends JScrollPane implements MouseListener, MouseMotionListener, ActionListener, MouseWheelListener { private static final long serialVersionUID = 1L; /** Contains all figures of the current project */ protected DrawContainer draw; /** Correspond to the codepanel of the program */ protected CodePanel codePanel; /** Correspond to the current figure in drawing */ protected Figure currentFigure; /** The former position of the cursor. Useful for * figure shifting */ protected Point formerPoint; /** The frame parent of the drawPanel @see LaTeXDrawFrame */ protected LaTeXDrawFrame frameParent; /** The pop-up menu which allows to do some actions about general * Functions (draw a figure, select a figure,...) */ protected JPopupMenu popupGeneral; /** This pop-up menu allows the user to do some actions about * the selected figure (delete, properties, ...) */ protected JPopupMenu popupFigure; /** If not null, it represents a figure before being moved */ protected Draw cloneForDragged; protected LaTeXDrawRectangle bordersSelection; private JRadioButtonMenuItem menuLine; private JRadioButtonMenuItem menuDot; private JRadioButtonMenuItem menuRect; private JRadioButtonMenuItem menuCircle; private JRadioButtonMenuItem menuEllipse; private JRadioButtonMenuItem menuSquare; private JRadioButtonMenuItem menuRhombus; private JRadioButtonMenuItem menuPoly; private JRadioButtonMenuItem menuArc; private JRadioButtonMenuItem menuWedge; private JRadioButtonMenuItem menuTriangle; private JRadioButtonMenuItem menuSelect; private JRadioButtonMenuItem menuText; private JRadioButtonMenuItem menuPointsAkin; private JRadioButtonMenuItem menuGrid; private JRadioButtonMenuItem menuAxes; private JRadioButtonMenuItem menuChord; private JRadioButtonMenuItem menuBezier; private JRadioButtonMenuItem menuClosedBezier; private JRadioButtonMenuItem menuJoinedLines; private JMenuItem menuDel; private JMenuItem menuProperties; private JMenuItem menuJoin; private JMenuItem menuSeparate; public JMenuItem menuUpdateToGrid; private JCheckBoxMenuItem menuRotate; /** Allows to know if the user must select a figure to put * the selected figure behind the clicked figure */ private boolean onWaitingClicDispositionBehind; /** Allows to know if the user must select a figure to put * the selected figure in front of the clicked figure */ private boolean onWaitingClicDispositionFront; /** This field allows to know if the last selection was empty or not (useful to the method onDragged). */ private transient boolean formerSelectionEmpty = true; public static final String LABEL_UPDATE_TO_GRID = LaTeXDrawLang.getString1_9("DrawPanel.0"); //$NON-NLS-1$ public static final String ACTION_CMD_UPDATETOGRID = "updToGrid";//$NON-NLS-1$ /** * The second constructor * @param d The drawing of the project (compulsory in order to * call the super-constructor of the @see JScrollPane class to use * elevator */ public DrawPanel(DrawContainer d, CodePanel codePanel, LaTeXDrawFrame parent) { super(d); d.getGrid().setMagnetic(false); bordersSelection = null; cloneForDragged = null; frameParent = parent; this.codePanel = codePanel; currentFigure = null; draw = d; draw.setParentPanel(this); draw.addMouseListener(this); draw.addMouseMotionListener(this); addMouseWheelListener(this); draw.updatePreferredSize(); draw.revalidate(); onWaitingClicDispositionBehind = false; onWaitingClicDispositionFront = false; createPopupGeneral(); createPopupFigure(); setDoubleBuffered(true); } public boolean isOnRotation() { return draw.isOnRotation(); } public void setOnRotation(boolean on) { draw.setOnRotation(on); menuRotate.setSelected(on); } /** * Allows to put the selected figure in the background */ public void selectedInBackground() { draw.selectedInBackground(); if(codePanel.isInAutoUpdate()) updateCode(); } /** * Allows to put the selected figure in the foreground */ public void selectedInForeground() { draw.selectedInForeground(); if(codePanel.isInAutoUpdate()) updateCode(); } /** * Allows to zoom in the drawing (up to 450%) */ public void zoomIn() { draw.zoomIn(); } /** * Allows to zoom out the drawing (up to 25%) */ public void zoomOut() { draw.zoomOut(); } /** * Allows to set the zoom to default */ public void zoomDefault() { draw.zoomDefault(); } /** * Allows to get the current zoom * @return The zoom */ public double getZoom() { return draw.getZoom(); } /** * Allows to create the pop-up menu which concern a selected figure */ private void createPopupFigure() { popupFigure = new JPopupMenu(); menuDel = new JMenuItem(LaTeXDrawResources.LABEL_DELETE, LaTeXDrawResources.delIcon); menuDel.setActionCommand(LaTeXDrawResources.LABEL_DELETE); menuDel.addActionListener(frameParent.menusListener); popupFigure.add(menuDel); popupFigure.addSeparator(); menuProperties = new JMenuItem(LaTeXDrawResources.LABEL_FIGURE_PROPERTIES, LaTeXDrawResources.propertiesIcon); menuProperties.setActionCommand(LaTeXDrawResources.LABEL_FIGURE_PROPERTIES); menuProperties.addActionListener(frameParent.menusListener); popupFigure.add(menuProperties); popupFigure.addSeparator(); JMenuItem menu2 = new JMenuItem(LaTeXDrawResources.LABEL_FOREGROUND, LaTeXDrawResources.foregroundIcon); menu2.setActionCommand(LaTeXDrawResources.LABEL_FOREGROUND); menu2.addActionListener(frameParent); popupFigure.add(menu2); menu2 = new JMenuItem(LaTeXDrawResources.LABEL_BACKGROUND, LaTeXDrawResources.backgroundIcon); menu2.setActionCommand(LaTeXDrawResources.LABEL_BACKGROUND); menu2.addActionListener(frameParent); popupFigure.add(menu2); menu2 = new JMenuItem(LaTeXDrawResources.LABEL_FRONT_SEL, LaTeXDrawResources.inFrontOfSelIcon); menu2.setActionCommand(LaTeXDrawResources.LABEL_FRONT_SEL); menu2.addActionListener(frameParent); popupFigure.add(menu2); menu2 = new JMenuItem(LaTeXDrawResources.LABEL_BEHIND_SEL, LaTeXDrawResources.behindSelIcon); menu2.setActionCommand(LaTeXDrawResources.LABEL_BEHIND_SEL); menu2.addActionListener(frameParent); popupFigure.add(menu2); popupFigure.addSeparator(); menuJoin = new JMenuItem(LaTeXDrawResources.LABEL_JOIN, LaTeXDrawResources.joinIcon); menuJoin.setActionCommand(LaTeXDrawResources.LABEL_JOIN); menuJoin.addActionListener(frameParent); popupFigure.add(menuJoin); menuSeparate = new JMenuItem(LaTeXDrawResources.LABEL_SEPARATE, LaTeXDrawResources.separateIcon); menuSeparate.setActionCommand(LaTeXDrawResources.LABEL_SEPARATE); menuSeparate.addActionListener(frameParent); popupFigure.add(menuSeparate); popupFigure.addSeparator(); menuRotate = new JCheckBoxMenuItem(LaTeXDrawResources.LABEL_ROTATE, LaTeXDrawResources.rotateIcon); menuRotate.setActionCommand(LaTeXDrawResources.LABEL_ROTATE); menuRotate.addActionListener(frameParent); popupFigure.add(menuRotate); popupFigure.addSeparator(); menuUpdateToGrid = new JMenuItem(LABEL_UPDATE_TO_GRID, LaTeXDrawResources.emptyIcon); menuUpdateToGrid.setActionCommand(ACTION_CMD_UPDATETOGRID); menuUpdateToGrid.addActionListener(this); popupFigure.add(menuUpdateToGrid); popupFigure.addSeparator(); menu2 = new JMenuItem(LaTeXDrawResources.LABEL_TEMPLATE_EXPORT, LaTeXDrawResources.emptyIcon); menu2.setActionCommand(LaTeXDrawResources.LABEL_TEMPLATE_EXPORT); menu2.addActionListener(frameParent.menusListener); popupFigure.add(menu2); } /** * Allows to create a pop-up menu concerning general actions */ private void createPopupGeneral() { ButtonGroup drawGroup = new ButtonGroup(); popupGeneral = new JPopupMenu(); menuSelect = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_SELECT_FIGURE, LaTeXDrawResources.selectIcon); menuSelect.setActionCommand(LaTeXDrawResources.LABEL_SELECT_FIGURE); menuSelect.addActionListener(frameParent.menusListener); menuSelect.setSelected(true); popupGeneral.add(menuSelect); drawGroup.add(menuSelect); popupGeneral.addSeparator(); menuLine = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_LINE, LaTeXDrawResources.lineIcon); menuLine.setActionCommand(LaTeXDrawResources.LABEL_LINE); menuLine.addActionListener(frameParent.menusListener); popupGeneral.add(menuLine); drawGroup.add(menuLine); menuJoinedLines = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_JOINED_LINES, LaTeXDrawResources.joinedLinesIcon); menuJoinedLines.setActionCommand(LaTeXDrawResources.LABEL_JOINED_LINES); menuJoinedLines.addActionListener(frameParent.menusListener); popupGeneral.add(menuJoinedLines); drawGroup.add(menuJoinedLines); menuPoly = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_POLY, LaTeXDrawResources.polygonIcon); menuPoly.setActionCommand(LaTeXDrawResources.LABEL_POLY); menuPoly.addActionListener(frameParent.menusListener); popupGeneral.add(menuPoly); drawGroup.add(menuPoly); menuDot = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_DOT, LaTeXDrawResources.dotIcon); menuDot.setActionCommand(LaTeXDrawResources.LABEL_DOT); menuDot.addActionListener(frameParent.menusListener); popupGeneral.add(menuDot); drawGroup.add(menuDot); menuRect = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_RECT, LaTeXDrawResources.rectIcon); menuRect.setActionCommand(LaTeXDrawResources.LABEL_RECT); menuRect.addActionListener(frameParent.menusListener); popupGeneral.add(menuRect); drawGroup.add(menuRect); menuSquare = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_SQUARE, LaTeXDrawResources.squareIcon); menuSquare.setActionCommand(LaTeXDrawResources.LABEL_SQUARE); menuSquare.addActionListener(frameParent.menusListener); popupGeneral.add(menuSquare); drawGroup.add(menuSquare); menuRhombus = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_RHOMBUS, LaTeXDrawResources.rhombusIcon); menuRhombus.setActionCommand(LaTeXDrawResources.LABEL_RHOMBUS); menuRhombus.addActionListener(frameParent.menusListener); popupGeneral.add(menuRhombus); drawGroup.add(menuRhombus); menuTriangle = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_TRIANGLE, LaTeXDrawResources.triangleIcon); menuTriangle.setActionCommand(LaTeXDrawResources.LABEL_TRIANGLE); menuTriangle.addActionListener(frameParent.menusListener); popupGeneral.add(menuTriangle); drawGroup.add(menuTriangle); menuEllipse = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_ELLIPSE, LaTeXDrawResources.ellipseIcon); menuEllipse.setActionCommand(LaTeXDrawResources.LABEL_ELLIPSE); menuEllipse.addActionListener(frameParent.menusListener); popupGeneral.add(menuEllipse); drawGroup.add(menuEllipse); menuCircle = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_CIRCLE, LaTeXDrawResources.circleIcon); menuCircle.setActionCommand(LaTeXDrawResources.LABEL_CIRCLE); menuCircle.addActionListener(frameParent.menusListener); popupGeneral.add(menuCircle); drawGroup.add(menuCircle); menuArc = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_ARC, LaTeXDrawResources.arcIcon); menuArc.setActionCommand(LaTeXDrawResources.LABEL_ARC); menuArc.addActionListener(frameParent.menusListener); popupGeneral.add(menuArc); drawGroup.add(menuArc); menuChord = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_CHORD, LaTeXDrawResources.chordIcon); menuChord.setActionCommand(LaTeXDrawResources.LABEL_CHORD); menuChord.addActionListener(frameParent.menusListener); popupGeneral.add(menuChord); drawGroup.add(menuChord); menuWedge = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_WEDGE, LaTeXDrawResources.wedgeIcon); menuWedge.setActionCommand(LaTeXDrawResources.LABEL_WEDGE); menuWedge.addActionListener(frameParent.menusListener); popupGeneral.add(menuWedge); drawGroup.add(menuWedge); menuGrid = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_GRID, LaTeXDrawResources.gridIcon); menuGrid.setActionCommand(LaTeXDrawResources.LABEL_GRID); menuGrid.addActionListener(frameParent.menusListener); popupGeneral.add(menuGrid); drawGroup.add(menuGrid); menuAxes = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_AXES, LaTeXDrawResources.axesIcon); menuAxes.setActionCommand(LaTeXDrawResources.LABEL_AXES); menuAxes.addActionListener(frameParent.menusListener); popupGeneral.add(menuAxes); drawGroup.add(menuAxes); menuBezier = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_BEZIER_CURVE, LaTeXDrawResources.bezierCurveIcon); menuBezier.setActionCommand(LaTeXDrawResources.LABEL_BEZIER_CURVE); menuBezier.addActionListener(frameParent.menusListener); popupGeneral.add(menuBezier); drawGroup.add(menuBezier); menuClosedBezier = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_CLOSED_BEZIER_CURVE, LaTeXDrawResources.closedBezierIcon); menuClosedBezier.setActionCommand(LaTeXDrawResources.LABEL_CLOSED_BEZIER_CURVE); menuClosedBezier.addActionListener(frameParent.menusListener); popupGeneral.add(menuClosedBezier); drawGroup.add(menuClosedBezier); menuPointsAkin = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_POINTS_AKIN, LaTeXDrawResources.pointsAkinIcon); menuPointsAkin.setActionCommand(LaTeXDrawResources.LABEL_POINTS_AKIN); menuPointsAkin.addActionListener(frameParent.menusListener); popupGeneral.add(menuPointsAkin); drawGroup.add(menuPointsAkin); menuText = new JRadioButtonMenuItem(LaTeXDrawResources.LABEL_TEXT, LaTeXDrawResources.textIcon); menuText.setActionCommand(LaTeXDrawResources.LABEL_TEXT); menuText.addActionListener(frameParent.menusListener); popupGeneral.add(menuText); drawGroup.add(menuText); } /** * Allows to select a menu in the general pop-up * @param select The label of the new selected menu */ public void setMenuSelectedPopupGeneral(String select, boolean state) { int i=0, size = popupGeneral.getComponentCount(); boolean found = false; Component c=null; while(!found && i3 || ((currentChoice.equals(LaTeXDrawResources.LABEL_CLOSED_BEZIER_CURVE) || currentChoice.equals(LaTeXDrawResources.LABEL_BEZIER_CURVE)) && ((LaTeXDrawPolygon)currentFigure).getNbPoints()>2)) { ((LaTeXDrawPolygon)currentFigure).removePointAt(-1); draw.addFigure(currentFigure,frameParent.getUndoManager()); updateDraw(true); currentFigure = null; frameParent.updateUndoRedo(); frameParent.setExportAsMenu(true); } else { currentFigure = null; draw.repaint(); } } else if(draw.getSelected()!=null && draw.getSelected().size()==1) frameParent.showParamFrame(draw.getSelected().whereIsIt(point), false); return ; } if(currentChoice.equals(LaTeXDrawResources.LABEL_POLY) || currentChoice.equals(LaTeXDrawResources.LABEL_JOINED_LINES)) { // If the user wants to draw a polygon (menu polygon selected) point = draw.getGrid().getTransformedPointToGrid(point, true); if(currentFigure==null)// We create of new polygon { if(currentChoice.equals(LaTeXDrawResources.LABEL_POLY)) currentFigure = new LaTeXDrawPolygon(new LaTeXDrawPoint2D(point.x, point.y), new LaTeXDrawPoint2D(point.x, point.y), true); else currentFigure = new JoinedLines(new LaTeXDrawPoint2D(point.x, point.y), new LaTeXDrawPoint2D(point.x, point.y), true); } else // We add a point to the polygon if(currentFigure.getClass().getSimpleName().equals("LaTeXDrawPolygon") ||//$NON-NLS-1$ currentFigure instanceof JoinedLines) { ((LaTeXDrawPolygon)currentFigure).setLastPoint(point); ((LaTeXDrawPolygon)currentFigure).addPoint(new LaTeXDrawPoint2D(point.x+1, point.y+1)); } draw.repaint(); }else if(currentChoice.equals(LaTeXDrawResources.LABEL_TEXT)) { point = draw.getGrid().getTransformedPointToGrid(point, true); Figure f = new Text("", new LaTeXDrawPoint2D(point.x,point.y), true); //$NON-NLS-1$ draw.addFigure(f, null); int size = draw.getNbFigures(); frameParent.showParamFrame(f, true); if(size==draw.getNbFigures()) { draw.deleteFigure(f, null); draw.addFigure(f, frameParent.getUndoManager()); frameParent.updateUndoRedo(); updateDraw(true); } }else if(currentChoice.equals(LaTeXDrawResources.LABEL_GRID)) { point = draw.getGrid().getTransformedPointToGrid(point, true); Figure f = new Grid(new LaTeXDrawPoint2D(point.x,point.y), true); draw.addFigure(f, null); int size = draw.getNbFigures(); frameParent.showParamFrame(f, true); if(size==draw.getNbFigures()) { draw.deleteFigure(f, null); draw.addFigure(f, frameParent.getUndoManager()); frameParent.updateUndoRedo(); updateDraw(true); } } else if(currentChoice.equals(LaTeXDrawResources.LABEL_AXES)) { point = draw.getGrid().getTransformedPointToGrid(point, true); Figure f = new Axe(new LaTeXDrawPoint2D(point.x,point.y), true); draw.addFigure(f, null); int size = draw.getNbFigures(); frameParent.showParamFrame(f, true); if(size==draw.getNbFigures()) { draw.deleteFigure(f, null); draw.addFigure(f, frameParent.getUndoManager()); frameParent.updateUndoRedo(); updateDraw(true); } } else if(currentChoice.equals(LaTeXDrawResources.LABEL_BEZIER_CURVE) || currentChoice.equals(LaTeXDrawResources.LABEL_CLOSED_BEZIER_CURVE)) { point = draw.getGrid().getTransformedPointToGrid(point, true); if(currentFigure==null) currentFigure = new BezierCurve(new LaTeXDrawPoint2D(point.x, point.y), new LaTeXDrawPoint2D(point.x, point.y), currentChoice.equals(LaTeXDrawResources.LABEL_BEZIER_CURVE), true); else { ((BezierCurve)currentFigure).setLastPoint(point); ((BezierCurve)currentFigure).addPoint(new LaTeXDrawPoint2D(point.x, point.y)); } } if(currentFigure!=null) setCurrentFigureGeneralValues(); } /** * Defines the actions that it must be realised by a right click * of the mouse. * @param e Corresponds to the click of the mouse */ public void mouseClickedRightButton(MouseEvent e) { try { Point point = e.getPoint(); if(currentFigure!=null) {// If the user draw a polygon and if he do a right click, we String currentChoice = frameParent.getCurrentChoice(); // must stop the creation of the polygon if(currentChoice.equals(LaTeXDrawResources.LABEL_POLY) || currentChoice.equals(LaTeXDrawResources.LABEL_CLOSED_BEZIER_CURVE) || currentChoice.equals(LaTeXDrawResources.LABEL_BEZIER_CURVE) || currentChoice.equals(LaTeXDrawResources.LABEL_JOINED_LINES)) if(((LaTeXDrawPolygon)currentFigure).getNbPoints()>2 || ((currentChoice.equals(LaTeXDrawResources.LABEL_CLOSED_BEZIER_CURVE) || currentChoice.equals(LaTeXDrawResources.LABEL_BEZIER_CURVE)) && ((LaTeXDrawPolygon)currentFigure).getNbPoints()>1)) { draw.addFigure(currentFigure,frameParent.getUndoManager()); updateDraw(true); currentFigure = null; frameParent.updateUndoRedo(); frameParent.setExportAsMenu(true); } else { currentFigure = null; draw.repaint(); } } else {// We must show a popup menu int nbFiguresSelected = draw.getSelected().size(); if(frameParent.getCurrentChoice().equals(LaTeXDrawResources.LABEL_SELECT_FIGURE) && nbFiguresSelected>0) { menuProperties.setEnabled(nbFiguresSelected==1); menuJoin.setEnabled(nbFiguresSelected>1); menuSeparate.setEnabled(nbFiguresSelected==1 && draw.getSelected().getFigureAt(0) instanceof Draw); popupFigure.show(e.getComponent(), point.x, point.y); } else popupGeneral.show(e.getComponent(), point.x, point.y); } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } /** * Actions to do on a mouse button pressed * @param e The event */ public void mousePressed(MouseEvent e) { try { frameParent.requestFocus(); switch(e.getButton()) { case MouseEvent.BUTTON1 : mousePressedLeftButton(e); break; case MouseEvent.BUTTON2 : break; case MouseEvent.BUTTON3 : Draw selection = draw.getSelected(); if(selection!=null && !selection.isEmpty()) frameParent.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); break; } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } e.consume(); } /** * Actions to do when the mouse is released * @param e The event */ public void mouseReleased(MouseEvent e) { try { Draw selection = draw.getSelected(); frameParent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); if(bordersSelection != null) { int mod = e.getModifiers(); Point pt = e.getPoint(); // We must put the point in the user's view : rescale the point pt.x/=draw.getZoom(); pt.y/=draw.getZoom(); bordersSelection.setLastPoint(new LaTeXDrawPoint2D(pt.x, pt.y)); draw.defineSelected(bordersSelection, mod==InputEvent.SHIFT_MASK+InputEvent.BUTTON1_MASK, mod==InputEvent.CTRL_MASK+InputEvent.BUTTON1_MASK); if(!draw.getSelected().isEmpty() || formerSelectionEmpty != draw.getSelected().isEmpty()) frameParent.setSelection(!draw.getSelected().isEmpty()); formerSelectionEmpty = draw.getSelected().isEmpty(); draw.repaint(); bordersSelection=null; formerPoint = null; draw.repaint(); return ; } if(selection!=null && selection.isOnRotation() && selection.isSelected()) selection.endRotation(); DrawBorders db = draw.getCompleteBorders(); if(db!=null && db.isSelected() && db.isADelimitorSelected()) { setIsModified(true); db.onDelimitorRelease(); return ; } if(currentFigure!=null && !currentFigure.getClass().getSimpleName().equals("LaTeXDrawPolygon") &&//$NON-NLS-1$ !(currentFigure instanceof JoinedLines) && !(currentFigure instanceof BezierCurve)) { if(!currentFigure.getTheNWPoint().equals(currentFigure.getTheSEPoint(), 0.001)) { draw.addFigure(currentFigure, frameParent.getUndoManager()); frameParent.updateUndoRedo(); frameParent.setExportAsMenu(true); } updateDraw(true); currentFigure = null; formerPoint = null; return; } Draw listSelected = draw.getSelected(); if(!listSelected.isEmpty()) { if(cloneForDragged!=null) { int[] id = new int[listSelected.size()]; for(int i=0, size=listSelected.size(); icurrentFigure.getThickness()/2 && pt.y>currentFigure.getThickness()/2) { if(currentFigure instanceof AkinPoints) ((AkinPoints)currentFigure).addPoint(new LaTeXDrawPoint2D(pt.x, pt.y)); else //We move the south-east point currentFigure.setLastPoint(new LaTeXDrawPoint2D(pt.x, pt.y)); draw.repaint(); setIsModified(true); return; } } Draw selected = draw.getSelected(); if(!selected.isEmpty()) {// We must not draw out the desktop pt = draw.getGrid().getTransformedPointToGrid(pt, true); if(pt.x>selected.getThickness()/2 && pt.y>selected.getThickness()/2) { if(formerPoint!=null) { if(cloneForDragged==null) cloneForDragged = (Draw) selected.clone(); selected.onDragged(formerPoint, pt); if(selected.size()==1 && (selected.getFigureAt(0) instanceof Dot)) frameParent.setDotFieldValue(((Dot)selected.getFigureAt(0)).getWidth()); getDraw().repaint(); } formerPoint = pt; setIsModified(true); } } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } /** * Actions to do when the mouse is moved * @param e The event */ public void mouseMoved(MouseEvent e) { Point pt = e.getPoint(); // We must put the point in the user's view : rescale the point pt.x/=draw.getZoom(); pt.y/=draw.getZoom(); if(currentFigure!=null) { pt = draw.getGrid().getTransformedPointToGrid(pt, true); // We must not draw out the desktop if(pt.x>currentFigure.getThickness()/2 && pt.y>currentFigure.getThickness()/2) if(currentFigure.getClass().getSimpleName().equals("LaTeXDrawPolygon") || //$NON-NLS-1$ currentFigure instanceof JoinedLines || currentFigure instanceof BezierCurve) { currentFigure.setLastPoint(new LaTeXDrawPoint2D(pt.x, pt.y)); if(currentFigure instanceof BezierCurve) ((BezierCurve)currentFigure).equilibrate(); draw.repaint(); return ; } } } /** * Allows to update the drawing. * @param withCode If true, the code is updated (if in auto update). */ public void updateDraw(boolean withCode) { frameParent.requestFocus(); draw.updateDraw(); if(codePanel.isInAutoUpdate() && withCode) updateCode(); } /** * Allows to update the code of the codepanel */ public void updateCode() { try { if(draw.getNbFigures()==0) codePanel.setEmpty(); else { codePanel.setStart(draw.getTheCompleteSWPoint(), draw.getTheCompleteNEPoint(), draw.getPixelsPerCm(), draw.getRealBorders().getOriginPoint()); codePanel.setBody(draw.getCode()); } }catch(Exception ex) { ex.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(ex); } } /** * A drawPanel is not serializable */ @SuppressWarnings("unused") private void readObject(ObjectInputStream ois) { /* * We don't read anything */ } /** * Allows to copy the selected figure */ public void copy() { draw.copy(); } /** * Allows to paste a copied or a cut figure */ public void paste() { draw.paste(); updateDraw(true); } /** * Allows to cut the selected figure */ public void cut() { draw.cut(); } /** * Allows to join the selected figures * @param undoManager The undo/redo manager */ public void joinSelection(UndoRedoManager undoManager) { draw.joinSelection(undoManager); updateDraw(false); } /** * Allows to join the figures of the selected drawing * @param undoManager The undo/redo manager */ public void separateSelection(UndoRedoManager undoManager) { draw.separateSelection(undoManager); updateDraw(true); } /** * Allows to insert a picture into the drawing * @param undoManager The undo/redo manager * @param path The path of the picture * @return True is the picture is inserted */ public boolean insertPicture(UndoRedoManager undoManager, String path) { boolean state = draw.insertPicture(undoManager, path); updateDraw(true); return state; } /** * Allows to set if the grid must be displayed or not * @param isDisplay True : the grid must be displayed */ public void setIsGridDisplay(boolean isDisplay) { draw.getGrid().setGridDisplayed(isDisplay); menuUpdateToGrid.setEnabled(isDisplay); frameParent.menuBar.getUpdateToGridMenu().setEnabled(isDisplay); updateDraw(false); } /** * @return the gridIsMagnetic. */ public boolean isGridMagnetic() { return draw.getGrid().isMagnetic(); } /** * @param gridIsMagnetic the gridIsMagnetic to set. */ public void setGridIsMagnetic(boolean gridIsMagnetic) { if(gridIsMagnetic!=isGridMagnetic()) setIsModified(true); draw.getGrid().setMagnetic(gridIsMagnetic); menuUpdateToGrid.setEnabled(true); } /** * Move the horizontal scrollbar. * @since 1.9 * @param add This value is added to the current position of the scollbar. */ public void moveHorizontalScrollbar(int add) { getHorizontalScrollBar().setValue(getHorizontalScrollBar().getValue()+add); } /** * Move the vertical scrollbar. * @since 1.9 * @param add This value is added to the current position of the scollbar. */ public void moveVerticalScrollbar(int add) { getVerticalScrollBar().setValue(getVerticalScrollBar().getValue()+add); } /** * Move horizontally the selected figures.
    * The increment is 1 pixel or, if the magnetic is activated, the gap of the * grid. * @since 1.9 * @param direction The direction of the movement:
    *
      *
    • 1: the X-coordinates of the figures are increased;
    • *
    • -1: the X-coordinates of the figures are decreased.
    • *
    */ public void moveSelectedFiguresHorizontally(int direction) { try { if(direction!=-1 && direction!=1) return; Draw selection = draw.getSelected(); if(selection!=null && !selection.isEmpty()) { double gap = draw.getGrid().isMagnetic() ? draw.getGrid().getMagneticGridGap() : 1.; if(direction==-1) gap*=-1; selection.shift(gap, 0); updateDraw(true); } } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } /** * Move vertically the selected figures.
    * The increment is 1 pixel or, if the magnetic is activated, the gap of the * grid. * @since 1.9 * @param direction The direction of the movement:
    *
      *
    • 1: the Y-coordinates of the figures are increased;
    • *
    • -1: the Y-coordinates of the figures are decreased.
    • *
    */ public void moveSelectedFiguresVertically(int direction) { try { if(direction!=-1 && direction!=1) return; Draw selection = draw.getSelected(); if(selection!=null && !selection.isEmpty()) { double gap = draw.getGrid().isMagnetic() ? draw.getGrid().getMagneticGridGap() : 1.; if(direction==-1) gap*=-1; selection.shift(0, gap); updateDraw(true); } } catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); } } /** * Update the selected figures of the drawing to the displayed grid. * @since 1.9 */ public void updateSelectionToGrid() { Draw selection = draw.getSelected(); if(selection!=null && !selection.isEmpty() && isGridMagnetic()) { try { Figure clone = (Draw) selection.clone(); int[] id = new int[selection.size()]; for(int i=0, size=selection.size(); i0) { zoomOut(); zoomed = true; } else if(wheelRot<0) { zoomIn(); zoomed = true; } if(zoomed) { frameParent.getXScale().repaint(); frameParent.getYScale().repaint(); frameParent.getToolbar().getZoomField().setValue(getZoom()*100); } return ; } } /** * Sets the XML element "meta" with the parameters of the code panel. * @param document The XML document. * @param meta The Element to fill. * @throws IllegalArgumentException If document or meta is null. * @since 2.0.0 */ public void getXMLMetadata(Document document, Element meta) { if(document==null || meta==null) throw new IllegalArgumentException(); Element magnet = document.createElement(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE+':'+LaTeXDrawNamespace.XML_MAGNETIC_GRID); magnet.appendChild(document.createTextNode(String.valueOf(isGridMagnetic()))); meta.appendChild(magnet); } /** * Sets the latexdraw parameters from the metadata SVG tag. * @param nl The list of the parameters. * @since 2.0.0 */ public void setXMLMetadata(NodeList nl) { // Nothing to do. } /** * @return the codePanel. * @since 2.0.0 */ public CodePanel getCodePanel() { return codePanel; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/0000755000000000000000000000000011347255510015112 5ustar latexdraw-2.0.8+1.orig/latexDraw/parsers/CodeParser.java0000644000000000000000000001317011347255510020006 0ustar package latexDraw.parsers; import java.text.ParseException; /** * Defines an abstract parser that parses code.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 11/21/08
    * @author Arnaud BLOUIN
    * @version 2.0.2
    */ public abstract class CodeParser extends Parser { /** The token for the end of the code. */ public static final int EOC = -1; /** * Defines a core level of the code parser that can be share with others * code parser. * @author Arnaud Blouin */ private class Code { /** The code to parser. */ protected String code; /** The current position of the character to read. */ protected int position; /** The current line number. */ protected int linePosition; /** * Creates and initialises a core code. * @param c The code to parse. * @throws IllegalArgumentException If the given code is null. */ public Code(String c) { if(c==null) throw new IllegalArgumentException(); code = c; position = 0; linePosition = 1; } } /** The core level of the parser that contains the code to parse,...
    * It can be shared with others code parsers. */ protected Code codeCore; /** * Creates and initialises the code parser. * @param code The code to parse. * @throws IllegalArgumentException If the given code is null. */ public CodeParser(String code) { if(code==null) throw new IllegalArgumentException(); codeCore = new Code(code); } /** * Reinitialises the parser. * @since 2.0.2 */ public void initialise() { codeCore.position = 0; codeCore.linePosition = 1; } /** * Parses the code. * @throws ParseException If an error occurs. * @since 2.0.2 */ public abstract void parse() throws ParseException; /** * @return the code. * @since 2.0.2 */ public String getCode() { return codeCore.code; } /** * @param code the code to set. It re-initialises the parser. * @since 2.0.2 */ public void setCode(String code) { if(code!=null) { this.codeCore.code = code; initialise(); } } /** * Reads the next char and returns it. * @return the next read character or EOC if the end of the path is reached. * @since 2.0.2 */ public int nextChar() { codeCore.position++; return getChar(); } /** * The character at the given position. * @param pos The position of the wanted character. * @return The character or EOC. * @since 2.0.3 */ public int getCharAt(int pos) { if(pos>=codeCore.code.length() || pos<0) return EOC; return codeCore.code.charAt(pos); } /** * @return the current character or EOC if the end of the path is reached. * @since 2.0.2 */ public int getChar() { if(codeCore.position>=codeCore.code.length()) return EOC; return codeCore.code.charAt(codeCore.position); } /** * @return True if the end of the code is reached. * @since 2.0.2 */ public boolean isEOC() { return getChar()==EOC; } /** * @return the position. * @since 2.0.2 */ public int getPosition() { return codeCore.position; } /** * @return the line position. * @since 2.0.2 */ public int getLinePosition() { return codeCore.linePosition; } /** * Skips the comment. * @return The read comment. * @since 2.0.2 */ public abstract String skipComment(); /** * Skips the useless characters. * @since 2.0.2 */ public abstract void skipWSP(); /** * Skips both comments and ignorable characters. * @since 2.0.2 */ public void skipWSPComments() { int pos; do { pos = codeCore.position; skipWSP(); skipComment(); } while(pos!=codeCore.position && !isEOC()); } /** * @return True if the current position points to a comment token. * @since 2.0.3 */ public abstract boolean isComment(); /** * @return True if the current character is a whitespace/ignorable character. * @since 2.0.2 */ public abstract boolean isWSP(); /** * @return True if the current character is EOL. * For the EOL CR+LF, the next character (LF) is read. * @since 2.0.2 */ public boolean isEOL() { int c = getChar(); boolean eol = false; if(c=='\r') { eol = true; if(nextChar()!='\n') codeCore.position--; } else eol = c=='\n'; return eol; } /** * @param position the position to set. * @since 2.0.2 */ public void setPosition(int position) { if(position>=0) codeCore.position = position; } public void incLinePosition() { codeCore.linePosition++; } /** * @param linePosition the line position to set. Must be greater than 0. * @since 2.0.2 */ public void setLinePosition(int linePosition) { if(linePosition>=1) codeCore.linePosition = linePosition; } /** * @return the code core. * @since 2.0.2 */ public Code getCodeCore() { return codeCore; } /** * @param codeCore the code core to set. * @since 2.0.2 */ public void setCodeCore(Code codeCore) { this.codeCore = codeCore; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/NotFullyManagedException.java0000644000000000000000000000231311347255510022664 0ustar package latexDraw.parsers; /** * This class allows the management of exceptions : a command * not fully managed can generate an NotFullyManagedException. * * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/21/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class NotFullyManagedException extends NotYetManagedException { private static final long serialVersionUID = 1L; public NotFullyManagedException(String cmd, int nl) { super(cmd, nl); } @Override public String toString() { return "Line "+ nLine + " : the command "+command+" is not yet fully managed!";//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ } } latexdraw-2.0.8+1.orig/latexDraw/parsers/FatalErrorParsingException.java0000644000000000000000000000315511347255510023225 0ustar package latexDraw.parsers; import java.text.ParseException; import latexDraw.lang.LaTeXDrawLang; /** * A fatal error parsing exception occurs during the parsing * of a file and when the end of the file is reached whereas it is unexpected. *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/30/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class FatalErrorParsingException extends ParseException { private static final long serialVersionUID = 1L; /** The message of the exception */ protected String msg; /** * The constructor by default */ public FatalErrorParsingException() { this(""); //$NON-NLS-1$ } /** * The constructor using a message * @param message The message of the exception to display */ public FatalErrorParsingException(String message) { super(message, -1); msg = message==null ? "" : message;//$NON-NLS-1$ } @Override public String toString() { return ""+msg+LaTeXDrawLang.getString1_6("FatalErrorParsingException.0");//$NON-NLS-1$ //$NON-NLS-2$ } } latexdraw-2.0.8+1.orig/latexDraw/parsers/ParserCmdMessage.java0000644000000000000000000000447411347255510021153 0ustar package latexDraw.parsers; import latexDraw.lang.LaTeXDrawLang; /** * This class define a kind of message which will be displayed in the * ParserMessagesFrame.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 02/02/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class ParserCmdMessage { /** The line in the PSTricks code at the origin of the message. */ private int nLine; /** The exception that occurred. */ private Exception exception; /** The name of command which has launched the exception. */ private String command; /** The number of column of the message. */ public static final short NB_COL = 3; /** * The constructor. * @param nl The line. * @param ex The exception. * @param cmd The command. */ public ParserCmdMessage(int nl, Exception ex, String cmd) { nLine = nl; exception = ex; command = cmd; } /** * @return the command */ public String getCommand() { return command; } /** * @return the exception */ public Exception getException() { return exception; } /** * @return the nLine */ public int getNLine() { return nLine; } @Override public String toString() { StringBuffer msg = new StringBuffer(); msg.append(LaTeXDrawLang.getString1_6("ParserCmdMessage.0")); //$NON-NLS-1$ msg.append(String.valueOf(nLine)); msg.append("; "); //$NON-NLS-1$ if(command!=null && command.length()!=0) msg.append(LaTeXDrawLang.getString1_6("ParserCmdMessage.1")).append(command).append("; "); //$NON-NLS-1$//$NON-NLS-2$ if(exception!=null) msg.append(LaTeXDrawLang.getString1_6("ParserCmdMessage.2")).append(exception.toString()); //$NON-NLS-1$ return msg.toString(); } } latexdraw-2.0.8+1.orig/latexDraw/parsers/IgnoreCommandException.java0000644000000000000000000000374511347255510022367 0ustar package latexDraw.parsers; /** * This kind of exception occurs when you want to ignore a command. * * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 02/01/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class IgnoreCommandException extends Exception { private static final long serialVersionUID = 1L; /** The ignored command. */ String command; /** The number of the line where the command is. */ int nLine; /** * The constructor using the number of the line of the ignored command. * @param nl The number of line of the ignored command. */ public IgnoreCommandException(int nl) { command = "";//$NON-NLS-1$ nLine = nl; } /** * The constructor using the name of the ignored command. * @param cmd The name of the ignored command. * @param nl The number of line of the ignored command. */ public IgnoreCommandException(String cmd, int nl) { command = cmd; nLine = nl; } @Override public String toString() { if(command==null || command.length()==0) return "Line "+ nLine + " : a command has been ignored!"; //$NON-NLS-1$ //$NON-NLS-2$ return "Line "+ nLine + " : the command "+command+" has been ignored!";//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } /** * @return the command */ public String getCommand() { return command; } /** * @return the nLine */ public int getNLine() { return nLine; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/UnknownCommandException.java0000644000000000000000000000413311347255510022573 0ustar package latexDraw.parsers; /** * The kind of exception occurred when you reach a unknown command. * * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 02/01/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class UnknownCommandException extends Exception { private static final long serialVersionUID = 1L; /** The unknown command. */ String command; /** The number of the line where the command is. */ int nLine; /** * The constructor using the number of the line of the unknown command. * @param nl The number of line of the unknown command. */ public UnknownCommandException(int nl) { command = "";//$NON-NLS-1$ nLine = nl; } /** * The constructor using the name of the unknown command. * @param cmd The name of the ignored command. * @param nl The number of line of the unknown command. */ public UnknownCommandException(String cmd, int nl) { command = cmd; nLine = nl; } @Override public String toString() { if(command==null || command.length()==0) return "Line "+ nLine + " : a command is unknown!";//$NON-NLS-1$//$NON-NLS-2$ return "Line "+ nLine + " : the command "+command+" is unknown!";//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ } /** * @return the command */ public String getCommand() { return command; } /** * @return the nLine */ public int getNLine() { return nLine; } /** * @param command the command to set */ public void setCommand(String command) { this.command = command; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/0000755000000000000000000000000011347255510015711 5ustar latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/SVGTransformList.java0000644000000000000000000000656111347255510021753 0ustar package latexDraw.parsers.svg; import java.awt.geom.Point2D; import java.util.Vector; import java.util.regex.PatternSyntaxException; /** * Defines a list containing SVG transformations.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/16/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1
    */ public class SVGTransformList extends Vector { private static final long serialVersionUID = 1L; /** * The constructor by default. * @since 0.1 */ public SVGTransformList() { super(); } /** * The constructor using a string containing the transformations. * @param transformations The set of SVG transformations. * @since 0.1 */ public SVGTransformList(String transformations) { this(); addTransformations(transformations); } /** * Add some transformations using a string containing the transformations. * @param transformations The set of SVG transformations. * @since 0.1 */ public void addTransformations(String transformations) { if(transformations==null) return ; try { String code = transformations.replaceAll("[ \t\n\r\f]+", " ");//$NON-NLS-1$//$NON-NLS-2$ code = code.replaceAll("^[ ]", "");//$NON-NLS-1$//$NON-NLS-2$ code = code.replaceAll("[ ]$", "");//$NON-NLS-1$//$NON-NLS-2$ code = code.replaceAll("[ ]?[(][ ]?", "(");//$NON-NLS-1$//$NON-NLS-2$ code = code.replaceAll("[ ]?[)]", ")");//$NON-NLS-1$//$NON-NLS-2$ code = code.replaceAll("[ ]?,[ ]?", ",");//$NON-NLS-1$//$NON-NLS-2$ code = code.replaceAll("[)][, ]?", ")_");//$NON-NLS-1$//$NON-NLS-2$ String[] trans = code.split("_");//$NON-NLS-1$ if(trans==null) return; for(int i=0; i *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/16/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public class SVGAttr implements Attr, Cloneable { /** The name of the attribute. @since 0.1 */ protected String name; /** The owner of the attribute. @since 0.1 */ protected Element owner; /** The value of the attribute. @since 0.1 */ protected String value; public SVGAttr(String n, String v, Element parent) { if(n==null || parent==null || v==null) throw new IllegalArgumentException(); name = n; owner = parent; value = v; } public String getName() { return name; } public Element getOwnerElement() { return owner; } public String getValue() { return value; } public boolean isId() { return name.equals(SVGAttributes.SVG_ID); } public void setValue(String value) throws DOMException { if(value==null) throw new DOMException(DOMException.SYNTAX_ERR, "A value cannot be null");//$NON-NLS-1$ this.value = value; } /** No deep allow. */ public Node cloneNode(boolean deep) { try { return (SVGAttr)super.clone(); } catch(CloneNotSupportedException e) { return null; } } public String getNodeName() { return name; } public short getNodeType() { return Node.ATTRIBUTE_NODE; } public String getNodeValue() throws DOMException { return value; } public Node getParentNode() { return owner; } public boolean hasAttributes() { return false; } public boolean hasChildNodes() { return false; } public boolean isEqualNode(Node arg) { return arg!=null && arg.getNodeName().equals(name) && arg.getNodeValue().equals(value) && arg.getNodeType()==getNodeType(); } public boolean isSameNode(Node other) { return other!=null && other==this; } public void setNodeValue(String nodeValue) throws DOMException { setValue(nodeValue); } @Override public String toString() { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("["); //$NON-NLS-1$ stringBuffer.append(name); stringBuffer.append(", "); //$NON-NLS-1$ stringBuffer.append(value); stringBuffer.append("]"); //$NON-NLS-1$ return stringBuffer.toString(); } public String getPrefix() { if(getNodeName()==null) return null; int index = getName().indexOf(':'); if(index!=-1) return getName().substring(0, index); return null; } public boolean getSpecified() { return true; } public String getNamespaceURI() { return lookupNamespaceURI(getPrefix()); } public String lookupNamespaceURI(String prefix) { return owner.lookupNamespaceURI(prefix); } public String getLocalName() { return name; } public TypeInfo getSchemaTypeInfo() { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public short compareDocumentPosition(Node other) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public String getBaseURI() { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public Object getFeature(String feature, String version) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public Node getNextSibling() { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public Document getOwnerDocument() { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public Node getPreviousSibling() { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public String getTextContent() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public Object getUserData(String key) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public boolean isDefaultNamespace(String namespaceURI) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public boolean isSupported(String feature, String version) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public String lookupPrefix(String namespaceURI) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public void normalize() { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public Node replaceChild(Node newChild, Node oldChild) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public void setPrefix(String prefix) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public void setTextContent(String textContent) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public Object setUserData(String key, Object data, UserDataHandler handler) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public Node removeChild(Node oldChild) throws DOMException { return null; } public Node insertBefore(Node newChild, Node refChild) throws DOMException { return null; } public NamedNodeMap getAttributes() { return null; } public NodeList getChildNodes() { return null; } public Node getFirstChild() { return null; } public Node getLastChild() { return null; } public Node appendChild(Node newChild) throws DOMException { return null; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/SVGText.java0000644000000000000000000000631711347255510020067 0ustar package latexDraw.parsers.svg; import latexDraw.parsers.svg.elements.SVGElement; import org.w3c.dom.DOMException; import org.w3c.dom.Node; import org.w3c.dom.Text; /** * Defines a text node.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/31/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public class SVGText extends SVGElement implements Text { /** The content of the text node. @since 0.1 */ protected String data; public static final String TEXT_NODE_NAME = "#text";//$NON-NLS-1$ /** * Creates a text node. * @param text The content of the node. * @param owner The owner document. */ public SVGText(String text, SVGDocument owner) { super(); if(text==null) throw new IllegalArgumentException(); ownerDocument = owner; data = text; setNodeName(TEXT_NODE_NAME); } @Override public String getNodeValue() throws DOMException { return data; } public void appendData(String arg) throws DOMException { if(arg!=null) setData(getData()+arg); } public String getData() throws DOMException { return data; } public int getLength() { return data.length(); } @Override public short getNodeType() { return Node.TEXT_NODE; } @Override public boolean checkAttributes() { return true; } @Override public boolean enableRendering() { return false; } public void setData(String data) throws DOMException { if(data!=null) this.data = data; } public String getWholeText() { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public boolean isElementContentWhitespace() { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public Text replaceWholeText(String content) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public Text splitText(int offset) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public void deleteData(int offset, int count) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public void insertData(int offset, String arg) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public void replaceData(int offset, int count, String arg) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public String substringData(int offset, int count) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/SVGDocument.java0000644000000000000000000003171311347255510020717 0ustar /* * SVGDOcument.java */ package latexDraw.parsers.svg; import java.io.ByteArrayInputStream; import java.io.IOException; import java.net.URI; import javax.swing.JProgressBar; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import latexDraw.figures.Figure; import latexDraw.parsers.svg.elements.OtherNSElement; import latexDraw.parsers.svg.elements.SVGSVGElement; import org.w3c.dom.Attr; import org.w3c.dom.CDATASection; import org.w3c.dom.Comment; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMException; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; import org.w3c.dom.DocumentType; import org.w3c.dom.Element; import org.w3c.dom.EntityReference; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.Text; import org.w3c.dom.UserDataHandler; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; /** * Defines an SVG document.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/11/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public class SVGDocument implements Document { /** The root of the SVG drawing. @since 0.1 */ protected SVGSVGElement root; /** Defines if the document is standalone. @since 0.1 */ protected boolean xmlStandalone; /** The document URI. @since 0.1 */ protected String documentURI; /** The version of XML. @since 0.1 */ protected String xmlVersion; /** The encoding of the document. @since 0.1 */ protected String xmlEncoding; public final static String ACTION_NOT_IMPLEMENTED = "Action not implemented.";//$NON-NLS-1$ public static final String SVG_NAMESPACE = "http://www.w3.org/2000/svg";//$NON-NLS-1$ /** * The constructor. An URI defines the location of the SVG document to parse. If the document is valid, * the document is read an place in the root attribute. * @param uri The file to parse. * @throws MalformedSVGDocument If an error occurs. * @throws IllegalArgumentException If a n argument is not valid. */ public SVGDocument(URI uri) throws MalformedSVGDocument { if(uri==null) throw new IllegalArgumentException(); try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); builder.setEntityResolver(new EntityResolver() { public InputSource resolveEntity(String publicId, String systemId) { return new InputSource(new ByteArrayInputStream("".getBytes())); } }); Document doc = builder.parse(uri.getPath()); NodeList nl; setDocumentURI(getDocumentURI()); setXmlStandalone(doc.getXmlStandalone()); setXmlVersion(doc.getXmlVersion()); xmlEncoding = doc.getXmlEncoding(); root = null; nl = doc.getChildNodes(); Node n; for(int i=0, size = nl.getLength(); i *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 04/06/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public abstract class CSSColors { /** Can be used to define the suffix of a user's colour. */ protected static long number = 0; /** The colours defined by the user. */ protected final static Vector usercolors = new Vector(); /** The name of the colours defined by the user. */ protected final static Vector userNamecolors = new Vector(); protected final static Hashtable colourHT = new Hashtable(100); protected final static Hashtable nameColourHT = new Hashtable(100); public static final String CSS_ALICEBLUE_NAME = "aliceblue";//$NON-NLS-1$ public static final String CSS_ANTIQUEWHITE_NAME = "antiquewhite";//$NON-NLS-1$ public static final String CSS_AQUAMARINE_NAME = "aquamarine";//$NON-NLS-1$ public static final String CSS_AQUA_NAME = "aqua";//$NON-NLS-1$ public static final String CSS_AZURE_NAME = "azure";//$NON-NLS-1$ public static final String CSS_BEIGE_NAME = "beige";//$NON-NLS-1$ public static final String CSS_BISQUE_NAME = "bisque";//$NON-NLS-1$ public static final String CSS_BLACK_NAME = "black";//$NON-NLS-1$ public static final String CSS_BLANCHEDALMOND_NAME = "blanchedalmond";//$NON-NLS-1$ public static final String CSS_BLUEVIOLET_NAME = "blueviolet";//$NON-NLS-1$ public static final String CSS_BLUE_NAME = "blue";//$NON-NLS-1$ public static final String CSS_BROWN_NAME = "brown";//$NON-NLS-1$ public static final String CSS_BURLYWOOD_NAME = "burlywood";//$NON-NLS-1$ public static final String CSS_CADETBLUE_NAME = "cadetblue";//$NON-NLS-1$ public static final String CSS_CHARTREUSE_NAME = "chartreuse";//$NON-NLS-1$ public static final String CSS_CHOCOLATE_NAME = "chocolate";//$NON-NLS-1$ public static final String CSS_CORAL_NAME = "coral";//$NON-NLS-1$ public static final String CSS_CORNFLOWERBLUE_NAME = "cornflowerblue";//$NON-NLS-1$ public static final String CSS_CORNSILK_NAME = "cornsilk";//$NON-NLS-1$ public static final String CSS_CRIMSON_NAME = "crimson";//$NON-NLS-1$ public static final String CSS_CYAN_NAME = "cyan";//$NON-NLS-1$ public static final String CSS_DARKBLUE_NAME = "darkblue";//$NON-NLS-1$ public static final String CSS_DARKCYAN_NAME = "darkcyan";//$NON-NLS-1$ public static final String CSS_DARKGOLDENROD_NAME = "darkgoldenrod";//$NON-NLS-1$ public static final String CSS_DARKGRAY_NAME = "darkgray";//$NON-NLS-1$ public static final String CSS_DARKGREEN_NAME = "darkgreen";//$NON-NLS-1$ public static final String CSS_DARKGREY_NAME = "darkgrey";//$NON-NLS-1$ public static final String CSS_DARKKHAKI_NAME = "darkkhaki";//$NON-NLS-1$ public static final String CSS_DARKMAGENTA_NAME = "darkmagenta";//$NON-NLS-1$ public static final String CSS_DARKOLIVEGREEN_NAME = "darkolivegreen";//$NON-NLS-1$ public static final String CSS_DARKORANGE_NAME = "darkorange";//$NON-NLS-1$ public static final String CSS_DARKORCHID_NAME = "darkorchid";//$NON-NLS-1$ public static final String CSS_DARKRED_NAME = "darkred";//$NON-NLS-1$ public static final String CSS_DARKSALMON_NAME = "darksalmon";//$NON-NLS-1$ public static final String CSS_DARKSEAGREEN_NAME = "darkseagreen";//$NON-NLS-1$ public static final String CSS_DARKSLATEBLUE_NAME = "darkslateblue";//$NON-NLS-1$ public static final String CSS_DARKSLATEGRAY_NAME = "darkslategray";//$NON-NLS-1$ public static final String CSS_DARKSLATEGREY_NAME = "darkslategrey";//$NON-NLS-1$ public static final String CSS_DARKTURQUOISE_NAME = "darkturquoise";//$NON-NLS-1$ public static final String CSS_DARKVIOLET_NAME = "darkviolet";//$NON-NLS-1$ public static final String CSS_DEEPPINK_NAME = "deeppink";//$NON-NLS-1$ public static final String CSS_DEEPSKYBLUE_NAME = "deepskyblue";//$NON-NLS-1$ public static final String CSS_DIMGRAY_NAME = "dimgray";//$NON-NLS-1$ public static final String CSS_DIMGREY_NAME = "dimgrey";//$NON-NLS-1$ public static final String CSS_DODGERBLUE_NAME = "dodgerblue";//$NON-NLS-1$ public static final String CSS_FIREBRICK_NAME = "firebrick";//$NON-NLS-1$ public static final String CSS_FLORALWHITE_NAME = "floralwhite";//$NON-NLS-1$ public static final String CSS_FORESTGREEN_NAME = "forestgreen";//$NON-NLS-1$ public static final String CSS_FUCHSIA_NAME = "fuchsia";//$NON-NLS-1$ public static final String CSS_GAINSBORO_NAME = "gainsboro";//$NON-NLS-1$ public static final String CSS_GHOSTWHITE_NAME = "ghostwhite";//$NON-NLS-1$ public static final String CSS_GOLDENROD_NAME = "goldenrod";//$NON-NLS-1$ public static final String CSS_GOLD_NAME = "gold";//$NON-NLS-1$ public static final String CSS_GRAY_NAME = "gray";//$NON-NLS-1$ public static final String CSS_GREENYELLOW_NAME = "greenyellow";//$NON-NLS-1$ public static final String CSS_GREEN_NAME = "green";//$NON-NLS-1$ public static final String CSS_GREY_NAME = "grey";//$NON-NLS-1$ public static final String CSS_HONEYDEW_NAME = "honeydew";//$NON-NLS-1$ public static final String CSS_HOTPINK_NAME = "hotpink";//$NON-NLS-1$ public static final String CSS_INDIGO_NAME = "indigo";//$NON-NLS-1$ public static final String CSS_IVORY_NAME = "ivory";//$NON-NLS-1$ public static final String CSS_INDIANRED_NAME = "indianred";//$NON-NLS-1$ public static final String CSS_KHAKI_NAME = "khaki";//$NON-NLS-1$ public static final String CSS_LAVENDERBLUSH_NAME = "lavenderblush";//$NON-NLS-1$ public static final String CSS_LAVENDER_NAME = "lavender";//$NON-NLS-1$ public static final String CSS_LAWNGREEN_NAME = "lawngreen";//$NON-NLS-1$ public static final String CSS_LEMONCHIFFON_NAME = "lemonchiffon";//$NON-NLS-1$ public static final String CSS_LIGHTBLUE_NAME = "lightblue";//$NON-NLS-1$ public static final String CSS_LIGHTCORAL_NAME = "lightcoral";//$NON-NLS-1$ public static final String CSS_LIGHTCYAN_NAME = "lightcyan";//$NON-NLS-1$ public static final String CSS_LIGHTGOLDENRODYELLOW_NAME = "lightgoldenrodyellow";//$NON-NLS-1$ public static final String CSS_LIGHTGRAY_NAME = "lightgray";//$NON-NLS-1$ public static final String CSS_LIGHTGREEN_NAME = "lightgreen";//$NON-NLS-1$ public static final String CSS_LIGHTGREY_NAME = "lightgrey";//$NON-NLS-1$ public static final String CSS_LIGHTPINK_NAME = "lightpink";//$NON-NLS-1$ public static final String CSS_LIGHTSALMON_NAME = "lightsalmon";//$NON-NLS-1$ public static final String CSS_LIGHTSEAGREEN_NAME = "lightseagreen";//$NON-NLS-1$ public static final String CSS_LIGHTSKYBLUE_NAME = "lightskyblue";//$NON-NLS-1$ public static final String CSS_LIGHTSLATEGRAY_NAME = "lightslategray";//$NON-NLS-1$ public static final String CSS_LIGHTSLATEGREY_NAME = "lightslategrey";//$NON-NLS-1$ public static final String CSS_LIGHTSTEELBLUE_NAME = "lightsteelblue";//$NON-NLS-1$ public static final String CSS_LIGHTYELLOW_NAME = "lightyellow";//$NON-NLS-1$ public static final String CSS_LIMEGREEN_NAME = "limegreen";//$NON-NLS-1$ public static final String CSS_LIME_NAME = "lime";//$NON-NLS-1$ public static final String CSS_MAGENTA_NAME = "magenta";//$NON-NLS-1$ public static final String CSS_MAROON_NAME = "maroon";//$NON-NLS-1$ public static final String CSS_MEDIUMAQUAMARINE_NAME = "mediumaquamarine";//$NON-NLS-1$ public static final String CSS_MEDIUMBLUE_NAME = "mediumblue";//$NON-NLS-1$ public static final String CSS_MEDIUMORCHID_NAME = "mediumorchid";//$NON-NLS-1$ public static final String CSS_MEDIUMPURPLE_NAME = "mediumpurple";//$NON-NLS-1$ public static final String CSS_MEDIUMSEAGREEN_NAME = "mediumseagreen";//$NON-NLS-1$ public static final String CSS_MEDIUMSLATEBLUE_NAME = "mediumslateblue";//$NON-NLS-1$ public static final String CSS_MEDIUMSPRINGGREEN_NAME = "mediumspringgreen";//$NON-NLS-1$ public static final String CSS_MEDIUMTURQUOISE_NAME = "mediumturquoise";//$NON-NLS-1$ public static final String CSS_MEDIUMVIOLETRED_NAME = "mediumvioletred";//$NON-NLS-1$ public static final String CSS_MIDNIGHTBLUE_NAME = "midnightblue";//$NON-NLS-1$ public static final String CSS_MINTCREAM_NAME = "mintcream";//$NON-NLS-1$ public static final String CSS_MISTYROSE_NAME = "mistyrose";//$NON-NLS-1$ public static final String CSS_MOCCASIN_NAME = "moccasin";//$NON-NLS-1$ public static final String CSS_NAVAJOWHITE_NAME = "navajowhite";//$NON-NLS-1$ public static final String CSS_NAVY_NAME = "navy";//$NON-NLS-1$ public static final String CSS_OLDLACE_NAME = "oldlace";//$NON-NLS-1$ public static final String CSS_OLIVEDRAB_NAME = "olivedrab";//$NON-NLS-1$ public static final String CSS_OLIVE_NAME = "olive";//$NON-NLS-1$ public static final String CSS_ORANGERED_NAME = "orangered";//$NON-NLS-1$ public static final String CSS_ORANGE_NAME = "orange";//$NON-NLS-1$ public static final String CSS_ORCHID_NAME = "orchid";//$NON-NLS-1$ public static final String CSS_PALEGOLDENROD_NAME = "palegoldenrod";//$NON-NLS-1$ public static final String CSS_PALEGREEN_NAME = "palegreen";//$NON-NLS-1$ public static final String CSS_PALETURQUOISE_NAME = "paleturquoise";//$NON-NLS-1$ public static final String CSS_PALEVIOLETRED_NAME = "palevioletred";//$NON-NLS-1$ public static final String CSS_PAPAYAWHIP_NAME = "papayawhip";//$NON-NLS-1$ public static final String CSS_PEACHPUFF_NAME = "peachpuff";//$NON-NLS-1$ public static final String CSS_PERU_NAME = "peru";//$NON-NLS-1$ public static final String CSS_PINK_NAME = "pink";//$NON-NLS-1$ public static final String CSS_PLUM_NAME = "plum";//$NON-NLS-1$ public static final String CSS_POWDERBLUE_NAME = "powderblue";//$NON-NLS-1$ public static final String CSS_PURPLE_NAME = "purple";//$NON-NLS-1$ public static final String CSS_RED_NAME = "red";//$NON-NLS-1$ public static final String CSS_ROSYBROWN_NAME = "rosybrown";//$NON-NLS-1$ public static final String CSS_ROYALBLUE_NAME = "royalblue";//$NON-NLS-1$ public static final String CSS_SADDLEBROWN_NAME = "saddlebrown";//$NON-NLS-1$ public static final String CSS_SALMON_NAME = "salmon";//$NON-NLS-1$ public static final String CSS_SANDYBROWN_NAME = "sandybrown";//$NON-NLS-1$ public static final String CSS_SEAGREEN_NAME = "seagreen";//$NON-NLS-1$ public static final String CSS_SEASHELL_NAME = "seashell";//$NON-NLS-1$ public static final String CSS_SIENNA_NAME = "sienna";//$NON-NLS-1$ public static final String CSS_SILVER_NAME = "silver";//$NON-NLS-1$ public static final String CSS_SKYBLUE_NAME = "skyblue";//$NON-NLS-1$ public static final String CSS_SLATEBLUE_NAME = "slateblue";//$NON-NLS-1$ public static final String CSS_SLATEGRAY_NAME = "slategray";//$NON-NLS-1$ public static final String CSS_SLATEGREY_NAME = "slategrey";//$NON-NLS-1$ public static final String CSS_SNOW_NAME = "snow";//$NON-NLS-1$ public static final String CSS_SPRINGGREEN_NAME = "springgreen";//$NON-NLS-1$ public static final String CSS_STEELBLUE_NAME = "steelblue";//$NON-NLS-1$ public static final String CSS_TAN_NAME = "tan";//$NON-NLS-1$ public static final String CSS_TEAL_NAME = "teal";//$NON-NLS-1$ public static final String CSS_THISTLE_NAME = "thistle";//$NON-NLS-1$ public static final String CSS_TOMATO_NAME = "tomato";//$NON-NLS-1$ public static final String CSS_TURQUOISE_NAME = "turquoise";//$NON-NLS-1$ public static final String CSS_VIOLET_NAME = "violet";//$NON-NLS-1$ public static final String CSS_WHEAT_NAME = "wheat";//$NON-NLS-1$ public static final String CSS_WHITESMOKE_NAME = "whitesmoke";//$NON-NLS-1$ public static final String CSS_WHITE_NAME = "white";//$NON-NLS-1$ public static final String CSS_YELLOWGREEN_NAME = "yellowgreen";//$NON-NLS-1$ public static final String CSS_YELLOW_NAME = "yellow";//$NON-NLS-1$ public final static Color CSS_YELLOW_RGB_VALUE = new Color(255, 255, 0); public final static Color CSS_RED_RGB_VALUE = new Color(255, 0, 0); public final static Color CSS_TEAL_RGB_VALUE = new Color(0, 128, 128); public final static Color CSS_PURPLE_RGB_VALUE = new Color(128, 0, 128); public final static Color CSS_SILVER_RGB_VALUE = new Color(192, 192, 192); public final static Color CSS_NAVY_RGB_VALUE = new Color(0, 0, 128); public final static Color CSS_OLIVE_RGB_VALUE = new Color(128, 128, 0); public final static Color CSS_LIME_RGB_VALUE = new Color(0, 255, 0); public final static Color CSS_MAROON_RGB_VALUE = new Color(128, 0, 0); public final static Color CSS_GRAY_RGB_VALUE = new Color(128, 128, 128); public final static Color CSS_GREEN_RGB_VALUE = new Color(0, 128, 0); public final static Color CSS_BLACK_RGB_VALUE = new Color(0, 0, 0); public final static Color CSS_WHITE_RGB_VALUE = new Color(255,255,255); public final static Color CSS_BLUE_RGB_VALUE = new Color(0, 0, 255); public final static Color CSS_FUCHSIA_RGB_VALUE = new Color(255, 0, 255); public static final Color CSS_ALICEBLUE_RGB_VALUE = new Color(240, 248, 255); public static final Color CSS_ANTIQUEWHITE_RGB_VALUE = new Color(250, 235, 215); public static final Color CSS_AQUA_RGB_VALUE = new Color(0, 255, 255); public static final Color CSS_AQUAMARINE_RGB_VALUE = new Color(127, 255, 212); public static final Color CSS_AZURE_RGB_VALUE = new Color(240, 255, 255); public static final Color CSS_BEIGE_RGB_VALUE = new Color(245, 245, 220); public static final Color CSS_BISQUE_RGB_VALUE = new Color(255, 228, 196); public static final Color CSS_BLANCHEDALMOND_RGB_VALUE = new Color(255, 235, 205); public static final Color CSS_BLUEVIOLET_RGB_VALUE = new Color(138, 43, 226); public static final Color CSS_BROWN_RGB_VALUE = new Color(165, 42, 42); public static final Color CSS_BURLYWOOD_RGB_VALUE = new Color(222, 184, 135); public static final Color CSS_CADETBLUE_RGB_VALUE = new Color(95, 158, 160); public static final Color CSS_CHARTREUSE_RGB_VALUE = new Color(127, 255, 0); public static final Color CSS_CHOCOLATE_RGB_VALUE = new Color(210, 105, 30); public static final Color CSS_CORAL_RGB_VALUE = new Color(255, 127, 80); public static final Color CSS_CORNFLOWERBLUE_RGB_VALUE = new Color(100, 149, 237); public static final Color CSS_CORNSILK_RGB_VALUE = new Color(255, 248, 220); public static final Color CSS_CRIMSON_RGB_VALUE = new Color(220, 20, 60); public static final Color CSS_CYAN_RGB_VALUE = new Color(0, 255, 255); public static final Color CSS_DARKBLUE_RGB_VALUE = new Color(0, 0, 139); public static final Color CSS_DARKCYAN_RGB_VALUE = new Color(0, 139, 139); public static final Color CSS_DARKGOLDENROD_RGB_VALUE = new Color(184, 134, 11); public static final Color CSS_DARKGRAY_RGB_VALUE = new Color(169, 169, 169); public static final Color CSS_DARKGREEN_RGB_VALUE = new Color(0, 100, 0); public static final Color CSS_DARKGREY_RGB_VALUE = new Color(169, 169, 169); public static final Color CSS_DARKKHAKI_RGB_VALUE = new Color(189, 183, 107); public static final Color CSS_DARKMAGENTA_RGB_VALUE = new Color(139, 0, 139); public static final Color CSS_DARKOLIVEGREEN_RGB_VALUE = new Color(85, 107, 47); public static final Color CSS_DARKORANGE_RGB_VALUE = new Color(255, 140, 0); public static final Color CSS_DARKORCHID_RGB_VALUE = new Color(153, 50, 204); public static final Color CSS_DARKRED_RGB_VALUE = new Color(139, 0, 0); public static final Color CSS_DARKSALMON_RGB_VALUE = new Color(233, 150, 122); public static final Color CSS_DARKSEAGREEN_RGB_VALUE = new Color(143, 188, 143); public static final Color CSS_DARKSLATEBLUE_RGB_VALUE = new Color(72, 61, 139); public static final Color CSS_DARKSLATEGRAY_RGB_VALUE = new Color(47, 79, 79); public static final Color CSS_DARKSLATEGREY_RGB_VALUE = new Color(47, 79, 79); public static final Color CSS_DARKTURQUOISE_RGB_VALUE = new Color(0, 206, 209); public static final Color CSS_DARKVIOLET_RGB_VALUE = new Color(148, 0, 211); public static final Color CSS_DEEPPINK_RGB_VALUE = new Color(255, 20, 147); public static final Color CSS_DEEPSKYBLUE_RGB_VALUE = new Color(0, 191, 255); public static final Color CSS_DIMGRAY_RGB_VALUE = new Color(105, 105, 105); public static final Color CSS_DIMGREY_RGB_VALUE = new Color(105, 105, 105); public static final Color CSS_DODGERBLUE_RGB_VALUE = new Color(30, 144, 255); public static final Color CSS_FIREBRICK_RGB_VALUE = new Color(178, 34, 34); public static final Color CSS_FLORALWHITE_RGB_VALUE = new Color(255, 250, 240); public static final Color CSS_FORESTGREEN_RGB_VALUE = new Color(34, 139, 34); public static final Color CSS_GAINSBORO_RGB_VALUE = new Color(220, 200, 200); public static final Color CSS_GHOSTWHITE_RGB_VALUE = new Color(248, 248, 255); public static final Color CSS_GOLD_RGB_VALUE = new Color(255, 215, 0); public static final Color CSS_GOLDENROD_RGB_VALUE = new Color(218, 165, 32); public static final Color CSS_GREY_RGB_VALUE = new Color(128, 128, 128); public static final Color CSS_GREENYELLOW_RGB_VALUE = new Color(173, 255, 47); public static final Color CSS_HONEYDEW_RGB_VALUE = new Color(240, 255, 240); public static final Color CSS_HOTPINK_RGB_VALUE = new Color(255, 105, 180); public static final Color CSS_INDIANRED_RGB_VALUE = new Color(205, 92, 92); public static final Color CSS_INDIGO_RGB_VALUE = new Color(75, 0, 130); public static final Color CSS_IVORY_RGB_VALUE = new Color(255, 255, 240); public static final Color CSS_KHAKI_RGB_VALUE = new Color(240, 230, 140); public static final Color CSS_LAVENDER_RGB_VALUE = new Color(230, 230, 250); public static final Color CSS_LAVENDERBLUSH_RGB_VALUE = new Color(255, 240, 255); public static final Color CSS_LAWNGREEN_RGB_VALUE = new Color(124, 252, 0); public static final Color CSS_LEMONCHIFFON_RGB_VALUE = new Color(255, 250, 205); public static final Color CSS_LIGHTBLUE_RGB_VALUE = new Color(173, 216, 230); public static final Color CSS_LIGHTCORAL_RGB_VALUE = new Color(240, 128, 128); public static final Color CSS_LIGHTCYAN_RGB_VALUE = new Color(224, 255, 255); public static final Color CSS_LIGHTGOLDENRODYELLOW_RGB_VALUE= new Color(250, 250, 210); public static final Color CSS_LIGHTGRAY_RGB_VALUE = new Color(211, 211, 211); public static final Color CSS_LIGHTGREEN_RGB_VALUE = new Color(144, 238, 144); public static final Color CSS_LIGHTGREY_RGB_VALUE = new Color(211, 211, 211); public static final Color CSS_LIGHTPINK_RGB_VALUE = new Color(255, 182, 193); public static final Color CSS_LIGHTSALMON_RGB_VALUE = new Color(255, 160, 122); public static final Color CSS_LIGHTSEAGREEN_RGB_VALUE = new Color(32, 178, 170); public static final Color CSS_LIGHTSKYBLUE_RGB_VALUE = new Color(135, 206, 250); public static final Color CSS_LIGHTSLATEGRAY_RGB_VALUE = new Color(119, 136, 153); public static final Color CSS_LIGHTSLATEGREY_RGB_VALUE = new Color(119, 136, 153); public static final Color CSS_LIGHTSTEELBLUE_RGB_VALUE = new Color(176, 196, 222); public static final Color CSS_LIGHTYELLOW_RGB_VALUE = new Color(255, 255, 224); public static final Color CSS_LIMEGREEN_RGB_VALUE = new Color(50, 205, 50); public static final Color CSS_LINEN_RGB_VALUE = new Color(250, 240, 230); public static final Color CSS_MAGENTA_RGB_VALUE = new Color(255, 0, 255); public static final Color CSS_MEDIUMAQUAMARINE_RGB_VALUE = new Color(102, 205, 170); public static final Color CSS_MEDIUMBLUE_RGB_VALUE = new Color(0, 0, 205); public static final Color CSS_MEDIUMORCHID_RGB_VALUE = new Color(186, 85, 211); public static final Color CSS_MEDIUMPURPLE_RGB_VALUE = new Color(147, 112, 219); public static final Color CSS_MEDIUMSEAGREEN_RGB_VALUE = new Color(60, 179, 113); public static final Color CSS_MEDIUMSLATEBLUE_RGB_VALUE = new Color(123, 104, 238); public static final Color CSS_MEDIUMSPRINGGREEN_RGB_VALUE = new Color(0, 250, 154); public static final Color CSS_MEDIUMTURQUOISE_RGB_VALUE = new Color(72, 209, 204); public static final Color CSS_MEDIUMVIOLETRED_RGB_VALUE = new Color(199, 21, 133); public static final Color CSS_MIDNIGHTBLUE_RGB_VALUE = new Color(25, 25, 112); public static final Color CSS_MINTCREAM_RGB_VALUE = new Color(245, 255, 250); public static final Color CSS_MISTYROSE_RGB_VALUE = new Color(255, 228, 225); public static final Color CSS_MOCCASIN_RGB_VALUE = new Color(255, 228, 181); public static final Color CSS_NAVAJOWHITE_RGB_VALUE = new Color(255, 222, 173); public static final Color CSS_OLDLACE_RGB_VALUE = new Color(253, 245, 230); public static final Color CSS_OLIVEDRAB_RGB_VALUE = new Color(107, 142, 35); public static final Color CSS_ORANGE_RGB_VALUE = new Color(255, 165, 0); public static final Color CSS_ORANGERED_RGB_VALUE = new Color(255, 69, 0); public static final Color CSS_ORCHID_RGB_VALUE = new Color(218, 112, 214); public static final Color CSS_PALEGOLDENROD_RGB_VALUE = new Color(238, 232, 170); public static final Color CSS_PALEGREEN_RGB_VALUE = new Color(152, 251, 152); public static final Color CSS_PALETURQUOISE_RGB_VALUE = new Color(175, 238, 238); public static final Color CSS_PALEVIOLETRED_RGB_VALUE = new Color(219, 112, 147); public static final Color CSS_PAPAYAWHIP_RGB_VALUE = new Color(255, 239, 213); public static final Color CSS_PEACHPUFF_RGB_VALUE = new Color(255, 218, 185); public static final Color CSS_PERU_RGB_VALUE = new Color(205, 133, 63); public static final Color CSS_PINK_RGB_VALUE = new Color(255, 192, 203); public static final Color CSS_PLUM_RGB_VALUE = new Color(221, 160, 221); public static final Color CSS_POWDERBLUE_RGB_VALUE = new Color(176, 224, 230); public static final Color CSS_ROSYBROWN_RGB_VALUE = new Color(188, 143, 143); public static final Color CSS_ROYALBLUE_RGB_VALUE = new Color(65, 105, 225); public static final Color CSS_SADDLEBROWN_RGB_VALUE = new Color(139, 69, 19); public static final Color CSS_SALMON_RGB_VALUE = new Color(250, 69, 114); public static final Color CSS_SANDYBROWN_RGB_VALUE = new Color(244, 164, 96); public static final Color CSS_SEAGREEN_RGB_VALUE = new Color(46, 139, 87); public static final Color CSS_SEASHELL_RGB_VALUE = new Color(255, 245, 238); public static final Color CSS_SIENNA_RGB_VALUE = new Color(160, 82, 45); public static final Color CSS_SKYBLUE_RGB_VALUE = new Color(135, 206, 235); public static final Color CSS_SLATEBLUE_RGB_VALUE = new Color(106, 90, 205); public static final Color CSS_SLATEGRAY_RGB_VALUE = new Color(112, 128, 144); public static final Color CSS_SLATEGREY_RGB_VALUE = new Color(112, 128, 144); public static final Color CSS_SNOW_RGB_VALUE = new Color(255, 250, 250); public static final Color CSS_SPRINGGREEN_RGB_VALUE = new Color(0, 255, 127); public static final Color CSS_STEELBLUE_RGB_VALUE = new Color(70, 130, 180); public static final Color CSS_TAN_RGB_VALUE = new Color(210, 180, 140); public static final Color CSS_THISTLE_RGB_VALUE = new Color(216, 91, 216); public static final Color CSS_TOMATO_RGB_VALUE = new Color(255, 99, 71); public static final Color CSS_TURQUOISE_RGB_VALUE = new Color(64, 224, 208); public static final Color CSS_VIOLET_RGB_VALUE = new Color(238, 130, 238); public static final Color CSS_WHEAT_RGB_VALUE = new Color(245, 222, 179); public static final Color CSS_WHITESMOKE_RGB_VALUE = new Color(245, 245, 245); public static final Color CSS_YELLOWGREEN_RGB_VALUE = new Color(154, 205, 50); protected static void createColourHashTable() { colourHT.clear(); colourHT.put(CSS_ALICEBLUE_NAME, CSS_ALICEBLUE_RGB_VALUE); colourHT.put(CSS_ANTIQUEWHITE_NAME, CSS_ANTIQUEWHITE_RGB_VALUE); colourHT.put(CSS_AQUAMARINE_NAME, CSS_AQUAMARINE_RGB_VALUE); colourHT.put(CSS_AQUA_NAME, CSS_AQUA_RGB_VALUE); colourHT.put(CSS_AZURE_NAME, CSS_AZURE_RGB_VALUE); colourHT.put(CSS_BEIGE_NAME, CSS_BEIGE_RGB_VALUE); colourHT.put(CSS_BISQUE_NAME, CSS_BISQUE_RGB_VALUE); colourHT.put(CSS_BLACK_NAME, CSS_BLACK_RGB_VALUE); colourHT.put(CSS_BLANCHEDALMOND_NAME, CSS_BLANCHEDALMOND_RGB_VALUE); colourHT.put(CSS_BLUEVIOLET_NAME, CSS_BLUEVIOLET_RGB_VALUE); colourHT.put(CSS_BLUE_NAME, CSS_BLUE_RGB_VALUE); colourHT.put(CSS_BROWN_NAME, CSS_BROWN_RGB_VALUE); colourHT.put(CSS_BURLYWOOD_NAME, CSS_BURLYWOOD_RGB_VALUE); colourHT.put(CSS_CADETBLUE_NAME, CSS_CADETBLUE_RGB_VALUE); colourHT.put(CSS_CHARTREUSE_NAME, CSS_CHARTREUSE_RGB_VALUE); colourHT.put(CSS_CHOCOLATE_NAME, CSS_CHOCOLATE_RGB_VALUE); colourHT.put(CSS_CORAL_NAME, CSS_CORAL_RGB_VALUE); colourHT.put(CSS_CORNFLOWERBLUE_NAME, CSS_CORNFLOWERBLUE_RGB_VALUE); colourHT.put(CSS_CORNSILK_NAME, CSS_CORNSILK_RGB_VALUE); colourHT.put(CSS_CRIMSON_NAME, CSS_CRIMSON_RGB_VALUE); colourHT.put(CSS_CYAN_NAME, CSS_CYAN_RGB_VALUE); colourHT.put(CSS_DARKBLUE_NAME, CSS_DARKBLUE_RGB_VALUE); colourHT.put(CSS_DARKCYAN_NAME, CSS_DARKCYAN_RGB_VALUE); colourHT.put(CSS_DARKGOLDENROD_NAME, CSS_DARKGOLDENROD_RGB_VALUE); colourHT.put(CSS_DARKGRAY_NAME, CSS_DARKGRAY_RGB_VALUE); colourHT.put(CSS_DARKGREEN_NAME, CSS_DARKGREEN_RGB_VALUE); colourHT.put(CSS_DARKGREY_NAME, CSS_DARKGREY_RGB_VALUE); colourHT.put(CSS_DARKKHAKI_NAME, CSS_DARKKHAKI_RGB_VALUE); colourHT.put(CSS_DARKMAGENTA_NAME, CSS_DARKMAGENTA_RGB_VALUE); colourHT.put(CSS_DARKOLIVEGREEN_NAME, CSS_DARKOLIVEGREEN_RGB_VALUE); colourHT.put(CSS_DARKORANGE_NAME, CSS_DARKORANGE_RGB_VALUE); colourHT.put(CSS_DARKORCHID_NAME, CSS_DARKORCHID_RGB_VALUE); colourHT.put(CSS_DARKRED_NAME, CSS_DARKRED_RGB_VALUE); colourHT.put(CSS_DARKSALMON_NAME, CSS_DARKSALMON_RGB_VALUE); colourHT.put(CSS_DARKSEAGREEN_NAME, CSS_DARKSEAGREEN_RGB_VALUE); colourHT.put(CSS_DARKSLATEBLUE_NAME, CSS_DARKSLATEBLUE_RGB_VALUE); colourHT.put(CSS_DARKSLATEGRAY_NAME, CSS_DARKSLATEGRAY_RGB_VALUE); colourHT.put(CSS_DARKSLATEGREY_NAME, CSS_DARKSLATEGRAY_RGB_VALUE); colourHT.put(CSS_DARKTURQUOISE_NAME, CSS_DARKTURQUOISE_RGB_VALUE); colourHT.put(CSS_DARKVIOLET_NAME, CSS_DARKVIOLET_RGB_VALUE); colourHT.put(CSS_DEEPPINK_NAME, CSS_DEEPPINK_RGB_VALUE); colourHT.put(CSS_DEEPSKYBLUE_NAME, CSS_DEEPSKYBLUE_RGB_VALUE); colourHT.put(CSS_DIMGRAY_NAME, CSS_DIMGRAY_RGB_VALUE); colourHT.put(CSS_DIMGREY_NAME, CSS_DIMGREY_RGB_VALUE); colourHT.put(CSS_DODGERBLUE_NAME, CSS_DODGERBLUE_RGB_VALUE); colourHT.put(CSS_FIREBRICK_NAME, CSS_FIREBRICK_RGB_VALUE); colourHT.put(CSS_FLORALWHITE_NAME, CSS_FLORALWHITE_RGB_VALUE); colourHT.put(CSS_FORESTGREEN_NAME, CSS_FORESTGREEN_RGB_VALUE); colourHT.put(CSS_FUCHSIA_NAME, CSS_FUCHSIA_RGB_VALUE); colourHT.put(CSS_GAINSBORO_NAME, CSS_GAINSBORO_RGB_VALUE); colourHT.put(CSS_GHOSTWHITE_NAME, CSS_GHOSTWHITE_RGB_VALUE); colourHT.put(CSS_GOLDENROD_NAME, CSS_GOLDENROD_RGB_VALUE); colourHT.put(CSS_GOLD_NAME, CSS_GOLD_RGB_VALUE); colourHT.put(CSS_GRAY_NAME, CSS_GRAY_RGB_VALUE); colourHT.put(CSS_GREENYELLOW_NAME, CSS_GREENYELLOW_RGB_VALUE); colourHT.put(CSS_GREEN_NAME, CSS_GREEN_RGB_VALUE); colourHT.put(CSS_GREY_NAME, CSS_GRAY_RGB_VALUE); colourHT.put(CSS_HONEYDEW_NAME, CSS_HONEYDEW_RGB_VALUE); colourHT.put(CSS_HOTPINK_NAME, CSS_HOTPINK_RGB_VALUE); colourHT.put(CSS_INDIGO_NAME, CSS_INDIGO_RGB_VALUE); colourHT.put(CSS_IVORY_NAME, CSS_IVORY_RGB_VALUE); colourHT.put(CSS_INDIANRED_NAME, CSS_INDIANRED_RGB_VALUE); colourHT.put(CSS_KHAKI_NAME, CSS_KHAKI_RGB_VALUE); colourHT.put(CSS_LAVENDERBLUSH_NAME, CSS_LAVENDERBLUSH_RGB_VALUE); colourHT.put(CSS_LAVENDER_NAME, CSS_LAVENDER_RGB_VALUE); colourHT.put(CSS_LAWNGREEN_NAME, CSS_LAWNGREEN_RGB_VALUE); colourHT.put(CSS_LEMONCHIFFON_NAME, CSS_LEMONCHIFFON_RGB_VALUE); colourHT.put(CSS_LIGHTBLUE_NAME, CSS_LIGHTBLUE_RGB_VALUE); colourHT.put(CSS_LIGHTCORAL_NAME, CSS_LIGHTCORAL_RGB_VALUE); colourHT.put(CSS_LIGHTCYAN_NAME, CSS_LIGHTCYAN_RGB_VALUE); colourHT.put(CSS_LIGHTGOLDENRODYELLOW_NAME, CSS_LIGHTGOLDENRODYELLOW_RGB_VALUE); colourHT.put(CSS_LIGHTGRAY_NAME, CSS_LIGHTGRAY_RGB_VALUE); colourHT.put(CSS_LIGHTGREEN_NAME, CSS_LIGHTGREEN_RGB_VALUE); colourHT.put(CSS_LIGHTGREY_NAME, CSS_LIGHTGREY_RGB_VALUE); colourHT.put(CSS_LIGHTPINK_NAME, CSS_LIGHTPINK_RGB_VALUE); colourHT.put(CSS_LIGHTSALMON_NAME, CSS_LIGHTSALMON_RGB_VALUE); colourHT.put(CSS_LIGHTSEAGREEN_NAME, CSS_LIGHTSEAGREEN_RGB_VALUE); colourHT.put(CSS_LIGHTSKYBLUE_NAME, CSS_LIGHTSKYBLUE_RGB_VALUE); colourHT.put(CSS_LIGHTSLATEGRAY_NAME, CSS_LIGHTSLATEGRAY_RGB_VALUE); colourHT.put(CSS_LIGHTSLATEGREY_NAME, CSS_LIGHTSLATEGREY_RGB_VALUE); colourHT.put(CSS_LIGHTSTEELBLUE_NAME, CSS_LIGHTSTEELBLUE_RGB_VALUE); colourHT.put(CSS_LIGHTYELLOW_NAME, CSS_LIGHTYELLOW_RGB_VALUE); colourHT.put(CSS_LIMEGREEN_NAME, CSS_LIMEGREEN_RGB_VALUE); colourHT.put(CSS_LIME_NAME, CSS_LIME_RGB_VALUE); colourHT.put(CSS_MAGENTA_NAME, CSS_MAGENTA_RGB_VALUE); colourHT.put(CSS_MAROON_NAME, CSS_MAROON_RGB_VALUE); colourHT.put(CSS_MEDIUMAQUAMARINE_NAME, CSS_MEDIUMAQUAMARINE_RGB_VALUE); colourHT.put(CSS_MEDIUMBLUE_NAME, CSS_MEDIUMBLUE_RGB_VALUE); colourHT.put(CSS_MEDIUMORCHID_NAME, CSS_MEDIUMORCHID_RGB_VALUE); colourHT.put(CSS_MEDIUMPURPLE_NAME, CSS_MEDIUMPURPLE_RGB_VALUE); colourHT.put(CSS_MEDIUMSEAGREEN_NAME, CSS_MEDIUMSEAGREEN_RGB_VALUE); colourHT.put(CSS_MEDIUMSLATEBLUE_NAME, CSS_MEDIUMSLATEBLUE_RGB_VALUE); colourHT.put(CSS_MEDIUMSPRINGGREEN_NAME, CSS_MEDIUMSPRINGGREEN_RGB_VALUE); colourHT.put(CSS_MEDIUMTURQUOISE_NAME, CSS_MEDIUMTURQUOISE_RGB_VALUE); colourHT.put(CSS_MEDIUMVIOLETRED_NAME, CSS_MEDIUMVIOLETRED_RGB_VALUE); colourHT.put(CSS_MIDNIGHTBLUE_NAME, CSS_MIDNIGHTBLUE_RGB_VALUE); colourHT.put(CSS_MINTCREAM_NAME, CSS_MINTCREAM_RGB_VALUE); colourHT.put(CSS_MISTYROSE_NAME, CSS_MISTYROSE_RGB_VALUE); colourHT.put(CSS_MOCCASIN_NAME, CSS_MOCCASIN_RGB_VALUE); colourHT.put(CSS_NAVAJOWHITE_NAME, CSS_NAVAJOWHITE_RGB_VALUE); colourHT.put(CSS_NAVY_NAME, CSS_NAVY_RGB_VALUE); colourHT.put(CSS_OLDLACE_NAME, CSS_OLDLACE_RGB_VALUE); colourHT.put(CSS_OLIVEDRAB_NAME, CSS_OLIVEDRAB_RGB_VALUE); colourHT.put(CSS_OLIVE_NAME, CSS_OLIVE_RGB_VALUE); colourHT.put(CSS_ORANGERED_NAME, CSS_ORANGERED_RGB_VALUE); colourHT.put(CSS_ORANGE_NAME, CSS_ORANGE_RGB_VALUE); colourHT.put(CSS_ORCHID_NAME, CSS_ORCHID_RGB_VALUE); colourHT.put(CSS_PALEGOLDENROD_NAME, CSS_PALEGOLDENROD_RGB_VALUE); colourHT.put(CSS_PALEGREEN_NAME, CSS_PALEGREEN_RGB_VALUE); colourHT.put(CSS_PALETURQUOISE_NAME, CSS_PALETURQUOISE_RGB_VALUE); colourHT.put(CSS_PALEVIOLETRED_NAME, CSS_PALEVIOLETRED_RGB_VALUE); colourHT.put(CSS_PAPAYAWHIP_NAME, CSS_PAPAYAWHIP_RGB_VALUE); colourHT.put(CSS_PEACHPUFF_NAME, CSS_PEACHPUFF_RGB_VALUE); colourHT.put(CSS_PERU_NAME, CSS_PERU_RGB_VALUE); colourHT.put(CSS_PINK_NAME, CSS_PINK_RGB_VALUE); colourHT.put(CSS_PLUM_NAME, CSS_PLUM_RGB_VALUE); colourHT.put(CSS_POWDERBLUE_NAME, CSS_POWDERBLUE_RGB_VALUE); colourHT.put(CSS_PURPLE_NAME, CSS_PURPLE_RGB_VALUE); colourHT.put(CSS_RED_NAME, CSS_RED_RGB_VALUE); colourHT.put(CSS_ROSYBROWN_NAME, CSS_ROSYBROWN_RGB_VALUE); colourHT.put(CSS_ROYALBLUE_NAME, CSS_ROYALBLUE_RGB_VALUE); colourHT.put(CSS_SADDLEBROWN_NAME, CSS_SADDLEBROWN_RGB_VALUE); colourHT.put(CSS_SALMON_NAME, CSS_SALMON_RGB_VALUE); colourHT.put(CSS_SANDYBROWN_NAME, CSS_SANDYBROWN_RGB_VALUE); colourHT.put(CSS_SEAGREEN_NAME, CSS_SEAGREEN_RGB_VALUE); colourHT.put(CSS_SEASHELL_NAME, CSS_SEASHELL_RGB_VALUE); colourHT.put(CSS_SIENNA_NAME, CSS_SIENNA_RGB_VALUE); colourHT.put(CSS_SILVER_NAME, CSS_SILVER_RGB_VALUE); colourHT.put(CSS_SKYBLUE_NAME, CSS_SKYBLUE_RGB_VALUE); colourHT.put(CSS_SLATEBLUE_NAME, CSS_SLATEBLUE_RGB_VALUE); colourHT.put(CSS_SLATEGRAY_NAME, CSS_SLATEGRAY_RGB_VALUE); colourHT.put(CSS_SLATEGREY_NAME, CSS_SLATEGREY_RGB_VALUE); colourHT.put(CSS_SNOW_NAME, CSS_SNOW_RGB_VALUE); colourHT.put(CSS_SPRINGGREEN_NAME, CSS_SPRINGGREEN_RGB_VALUE); colourHT.put(CSS_STEELBLUE_NAME, CSS_STEELBLUE_RGB_VALUE); colourHT.put(CSS_TAN_NAME, CSS_TAN_RGB_VALUE); colourHT.put(CSS_TEAL_NAME, CSS_TEAL_RGB_VALUE); colourHT.put(CSS_THISTLE_NAME, CSS_THISTLE_RGB_VALUE); colourHT.put(CSS_TOMATO_NAME, CSS_TOMATO_RGB_VALUE); colourHT.put(CSS_TURQUOISE_NAME, CSS_TURQUOISE_RGB_VALUE); colourHT.put(CSS_VIOLET_NAME, CSS_VIOLET_RGB_VALUE); colourHT.put(CSS_WHEAT_NAME, CSS_WHEAT_RGB_VALUE); colourHT.put(CSS_WHITESMOKE_NAME, CSS_WHITESMOKE_RGB_VALUE); colourHT.put(CSS_WHITE_NAME, CSS_WHITE_RGB_VALUE); colourHT.put(CSS_YELLOWGREEN_NAME, CSS_YELLOWGREEN_RGB_VALUE); colourHT.put(CSS_YELLOW_NAME, CSS_YELLOW_RGB_VALUE); } protected static void createNameColourHashTable() { nameColourHT.clear(); nameColourHT.put(CSS_ALICEBLUE_RGB_VALUE, CSS_ALICEBLUE_NAME); nameColourHT.put(CSS_ANTIQUEWHITE_RGB_VALUE, CSS_ANTIQUEWHITE_NAME); nameColourHT.put(CSS_AQUAMARINE_RGB_VALUE, CSS_AQUAMARINE_NAME); nameColourHT.put(CSS_AZURE_RGB_VALUE, CSS_AZURE_NAME); nameColourHT.put(CSS_BEIGE_RGB_VALUE, CSS_BEIGE_NAME); nameColourHT.put(CSS_BISQUE_RGB_VALUE, CSS_BISQUE_NAME); nameColourHT.put(CSS_BLACK_RGB_VALUE, CSS_BLACK_NAME); nameColourHT.put(CSS_BLANCHEDALMOND_RGB_VALUE, CSS_BLANCHEDALMOND_NAME); nameColourHT.put(CSS_BLUEVIOLET_RGB_VALUE, CSS_BLUEVIOLET_NAME); nameColourHT.put(CSS_BLUE_RGB_VALUE, CSS_BLUE_NAME); nameColourHT.put(CSS_BROWN_RGB_VALUE, CSS_BROWN_NAME); nameColourHT.put(CSS_BURLYWOOD_RGB_VALUE, CSS_BURLYWOOD_NAME); nameColourHT.put(CSS_CADETBLUE_RGB_VALUE, CSS_CADETBLUE_NAME); nameColourHT.put(CSS_CHARTREUSE_RGB_VALUE, CSS_CHARTREUSE_NAME); nameColourHT.put(CSS_CHOCOLATE_RGB_VALUE, CSS_CHOCOLATE_NAME); nameColourHT.put(CSS_CORAL_RGB_VALUE, CSS_CORAL_NAME); nameColourHT.put(CSS_CORNFLOWERBLUE_RGB_VALUE, CSS_CORNFLOWERBLUE_NAME); nameColourHT.put(CSS_CORNSILK_RGB_VALUE, CSS_CORNSILK_NAME); nameColourHT.put(CSS_CRIMSON_RGB_VALUE, CSS_CRIMSON_NAME); nameColourHT.put(CSS_CYAN_RGB_VALUE, CSS_CYAN_NAME); nameColourHT.put(CSS_DARKBLUE_RGB_VALUE, CSS_DARKBLUE_NAME); nameColourHT.put(CSS_DARKCYAN_RGB_VALUE, CSS_DARKCYAN_NAME); nameColourHT.put(CSS_DARKGOLDENROD_RGB_VALUE, CSS_DARKGOLDENROD_NAME); nameColourHT.put(CSS_DARKGRAY_RGB_VALUE, CSS_DARKGRAY_NAME); nameColourHT.put(CSS_DARKGREEN_RGB_VALUE, CSS_DARKGREEN_NAME); nameColourHT.put(CSS_DARKKHAKI_RGB_VALUE, CSS_DARKKHAKI_NAME); nameColourHT.put(CSS_DARKMAGENTA_RGB_VALUE, CSS_DARKMAGENTA_NAME); nameColourHT.put(CSS_DARKOLIVEGREEN_RGB_VALUE, CSS_DARKOLIVEGREEN_NAME); nameColourHT.put(CSS_DARKORANGE_RGB_VALUE, CSS_DARKORANGE_NAME); nameColourHT.put(CSS_DARKORCHID_RGB_VALUE, CSS_DARKORCHID_NAME); nameColourHT.put(CSS_DARKRED_RGB_VALUE, CSS_DARKRED_NAME); nameColourHT.put(CSS_DARKSALMON_RGB_VALUE, CSS_DARKSALMON_NAME); nameColourHT.put(CSS_DARKSEAGREEN_RGB_VALUE, CSS_DARKSEAGREEN_NAME); nameColourHT.put(CSS_DARKSLATEBLUE_RGB_VALUE, CSS_DARKSLATEBLUE_NAME); nameColourHT.put(CSS_DARKSLATEGRAY_RGB_VALUE, CSS_DARKSLATEGRAY_NAME); nameColourHT.put(CSS_DARKTURQUOISE_RGB_VALUE, CSS_DARKTURQUOISE_NAME); nameColourHT.put(CSS_DARKVIOLET_RGB_VALUE, CSS_DARKVIOLET_NAME); nameColourHT.put(CSS_DEEPPINK_RGB_VALUE, CSS_DEEPPINK_NAME); nameColourHT.put(CSS_DEEPSKYBLUE_RGB_VALUE, CSS_DEEPSKYBLUE_NAME); nameColourHT.put(CSS_DIMGRAY_RGB_VALUE, CSS_DIMGRAY_NAME); nameColourHT.put(CSS_DODGERBLUE_RGB_VALUE, CSS_DODGERBLUE_NAME); nameColourHT.put(CSS_FIREBRICK_RGB_VALUE, CSS_FIREBRICK_NAME); nameColourHT.put(CSS_FLORALWHITE_RGB_VALUE, CSS_FLORALWHITE_NAME); nameColourHT.put(CSS_FORESTGREEN_RGB_VALUE, CSS_FORESTGREEN_NAME); nameColourHT.put(CSS_GAINSBORO_RGB_VALUE, CSS_GAINSBORO_NAME); nameColourHT.put(CSS_GHOSTWHITE_RGB_VALUE, CSS_GHOSTWHITE_NAME); nameColourHT.put(CSS_GOLDENROD_RGB_VALUE, CSS_GOLDENROD_NAME); nameColourHT.put(CSS_GOLD_RGB_VALUE, CSS_GOLD_NAME); nameColourHT.put(CSS_GRAY_RGB_VALUE, CSS_GRAY_NAME); nameColourHT.put(CSS_GREENYELLOW_RGB_VALUE, CSS_GREENYELLOW_NAME); nameColourHT.put(CSS_GREEN_RGB_VALUE, CSS_GREEN_NAME); nameColourHT.put(CSS_HONEYDEW_RGB_VALUE, CSS_HONEYDEW_NAME); nameColourHT.put(CSS_HOTPINK_RGB_VALUE, CSS_HOTPINK_NAME); nameColourHT.put(CSS_INDIGO_RGB_VALUE, CSS_INDIGO_NAME); nameColourHT.put(CSS_INDIANRED_RGB_VALUE, CSS_INDIANRED_NAME); nameColourHT.put(CSS_IVORY_RGB_VALUE, CSS_IVORY_NAME); nameColourHT.put(CSS_KHAKI_RGB_VALUE, CSS_KHAKI_NAME); nameColourHT.put(CSS_LAVENDERBLUSH_RGB_VALUE, CSS_LAVENDERBLUSH_NAME); nameColourHT.put(CSS_LAVENDER_RGB_VALUE, CSS_LAVENDER_NAME); nameColourHT.put(CSS_LAWNGREEN_RGB_VALUE, CSS_LAWNGREEN_NAME); nameColourHT.put(CSS_LEMONCHIFFON_RGB_VALUE, CSS_LEMONCHIFFON_NAME); nameColourHT.put(CSS_LIGHTBLUE_RGB_VALUE, CSS_LIGHTBLUE_NAME); nameColourHT.put(CSS_LIGHTCORAL_RGB_VALUE, CSS_LIGHTCORAL_NAME); nameColourHT.put(CSS_LIGHTCYAN_RGB_VALUE, CSS_LIGHTCYAN_NAME); nameColourHT.put(CSS_LIGHTGOLDENRODYELLOW_RGB_VALUE, CSS_LIGHTGOLDENRODYELLOW_NAME); nameColourHT.put(CSS_LIGHTGRAY_RGB_VALUE, CSS_LIGHTGRAY_NAME); nameColourHT.put(CSS_LIGHTGREEN_RGB_VALUE, CSS_LIGHTGREEN_NAME); nameColourHT.put(CSS_LIGHTPINK_RGB_VALUE, CSS_LIGHTPINK_NAME); nameColourHT.put(CSS_LIGHTSALMON_RGB_VALUE, CSS_LIGHTSALMON_NAME); nameColourHT.put(CSS_LIGHTSEAGREEN_RGB_VALUE, CSS_LIGHTSEAGREEN_NAME); nameColourHT.put(CSS_LIGHTSKYBLUE_RGB_VALUE, CSS_LIGHTSKYBLUE_NAME); nameColourHT.put(CSS_LIGHTSLATEGRAY_RGB_VALUE, CSS_LIGHTSLATEGRAY_NAME); nameColourHT.put(CSS_LIGHTSTEELBLUE_RGB_VALUE, CSS_LIGHTSTEELBLUE_NAME); nameColourHT.put(CSS_LIGHTYELLOW_RGB_VALUE, CSS_LIGHTYELLOW_NAME); nameColourHT.put(CSS_LIMEGREEN_RGB_VALUE, CSS_LIMEGREEN_NAME); nameColourHT.put(CSS_LIME_RGB_VALUE, CSS_LIME_NAME); nameColourHT.put(CSS_MAGENTA_RGB_VALUE, CSS_MAGENTA_NAME); nameColourHT.put(CSS_MAROON_RGB_VALUE, CSS_MAROON_NAME); nameColourHT.put(CSS_MEDIUMAQUAMARINE_RGB_VALUE, CSS_MEDIUMAQUAMARINE_NAME); nameColourHT.put(CSS_MEDIUMBLUE_RGB_VALUE, CSS_MEDIUMBLUE_NAME); nameColourHT.put(CSS_MEDIUMORCHID_RGB_VALUE, CSS_MEDIUMORCHID_NAME); nameColourHT.put(CSS_MEDIUMPURPLE_RGB_VALUE, CSS_MEDIUMPURPLE_NAME); nameColourHT.put(CSS_MEDIUMSEAGREEN_RGB_VALUE, CSS_MEDIUMSEAGREEN_NAME); nameColourHT.put(CSS_MEDIUMSLATEBLUE_RGB_VALUE, CSS_MEDIUMSLATEBLUE_NAME); nameColourHT.put(CSS_MEDIUMSPRINGGREEN_RGB_VALUE, CSS_MEDIUMSPRINGGREEN_NAME); nameColourHT.put(CSS_MEDIUMTURQUOISE_RGB_VALUE, CSS_MEDIUMTURQUOISE_NAME); nameColourHT.put(CSS_MEDIUMVIOLETRED_RGB_VALUE, CSS_MEDIUMVIOLETRED_NAME); nameColourHT.put(CSS_MIDNIGHTBLUE_RGB_VALUE, CSS_MIDNIGHTBLUE_NAME); nameColourHT.put(CSS_MINTCREAM_RGB_VALUE, CSS_MINTCREAM_NAME); nameColourHT.put(CSS_MISTYROSE_RGB_VALUE, CSS_MISTYROSE_NAME); nameColourHT.put(CSS_MOCCASIN_RGB_VALUE, CSS_MOCCASIN_NAME); nameColourHT.put(CSS_NAVAJOWHITE_RGB_VALUE, CSS_NAVAJOWHITE_NAME); nameColourHT.put(CSS_NAVY_RGB_VALUE, CSS_NAVY_NAME); nameColourHT.put(CSS_OLDLACE_RGB_VALUE, CSS_OLDLACE_NAME); nameColourHT.put(CSS_OLIVEDRAB_RGB_VALUE, CSS_OLIVEDRAB_NAME); nameColourHT.put(CSS_OLIVE_RGB_VALUE, CSS_OLIVE_NAME); nameColourHT.put(CSS_ORANGERED_RGB_VALUE, CSS_ORANGERED_NAME); nameColourHT.put(CSS_ORANGE_RGB_VALUE, CSS_ORANGE_NAME); nameColourHT.put(CSS_ORCHID_RGB_VALUE, CSS_ORCHID_NAME); nameColourHT.put(CSS_PALEGOLDENROD_RGB_VALUE, CSS_PALEGOLDENROD_NAME); nameColourHT.put(CSS_PALEGREEN_RGB_VALUE, CSS_PALEGREEN_NAME); nameColourHT.put(CSS_PALETURQUOISE_RGB_VALUE, CSS_PALETURQUOISE_NAME); nameColourHT.put(CSS_PALEVIOLETRED_RGB_VALUE, CSS_PALEVIOLETRED_NAME); nameColourHT.put(CSS_PAPAYAWHIP_RGB_VALUE, CSS_PAPAYAWHIP_NAME); nameColourHT.put(CSS_PEACHPUFF_RGB_VALUE, CSS_PEACHPUFF_NAME); nameColourHT.put(CSS_PERU_RGB_VALUE, CSS_PERU_NAME); nameColourHT.put(CSS_PINK_RGB_VALUE, CSS_PINK_NAME); nameColourHT.put(CSS_PLUM_RGB_VALUE, CSS_PLUM_NAME); nameColourHT.put(CSS_POWDERBLUE_RGB_VALUE, CSS_POWDERBLUE_NAME); nameColourHT.put(CSS_PURPLE_RGB_VALUE, CSS_PURPLE_NAME); nameColourHT.put(CSS_RED_RGB_VALUE, CSS_RED_NAME); nameColourHT.put(CSS_ROSYBROWN_RGB_VALUE, CSS_ROSYBROWN_NAME); nameColourHT.put(CSS_ROYALBLUE_RGB_VALUE, CSS_ROYALBLUE_NAME); nameColourHT.put(CSS_SADDLEBROWN_RGB_VALUE, CSS_SADDLEBROWN_NAME); nameColourHT.put(CSS_SALMON_RGB_VALUE, CSS_SALMON_NAME); nameColourHT.put(CSS_SANDYBROWN_RGB_VALUE, CSS_SANDYBROWN_NAME); nameColourHT.put(CSS_SEAGREEN_RGB_VALUE, CSS_SEAGREEN_NAME); nameColourHT.put(CSS_SEASHELL_RGB_VALUE, CSS_SEASHELL_NAME); nameColourHT.put(CSS_SIENNA_RGB_VALUE, CSS_SIENNA_NAME); nameColourHT.put(CSS_SILVER_RGB_VALUE, CSS_SILVER_NAME); nameColourHT.put(CSS_SKYBLUE_RGB_VALUE, CSS_SKYBLUE_NAME); nameColourHT.put(CSS_SLATEBLUE_RGB_VALUE, CSS_SLATEBLUE_NAME); nameColourHT.put(CSS_SLATEGRAY_RGB_VALUE, CSS_SLATEGRAY_NAME); nameColourHT.put(CSS_SNOW_RGB_VALUE, CSS_SNOW_NAME); nameColourHT.put(CSS_SPRINGGREEN_RGB_VALUE, CSS_SPRINGGREEN_NAME); nameColourHT.put(CSS_STEELBLUE_RGB_VALUE, CSS_STEELBLUE_NAME); nameColourHT.put(CSS_TAN_RGB_VALUE, CSS_TAN_NAME); nameColourHT.put(CSS_TEAL_RGB_VALUE, CSS_TEAL_NAME); nameColourHT.put(CSS_THISTLE_RGB_VALUE, CSS_THISTLE_NAME); nameColourHT.put(CSS_TOMATO_RGB_VALUE, CSS_TOMATO_NAME); nameColourHT.put(CSS_TURQUOISE_RGB_VALUE, CSS_TURQUOISE_NAME); nameColourHT.put(CSS_VIOLET_RGB_VALUE, CSS_VIOLET_NAME); nameColourHT.put(CSS_WHEAT_RGB_VALUE, CSS_WHEAT_NAME); nameColourHT.put(CSS_WHITESMOKE_RGB_VALUE, CSS_WHITESMOKE_NAME); nameColourHT.put(CSS_WHITE_RGB_VALUE, CSS_WHITE_NAME); nameColourHT.put(CSS_YELLOWGREEN_RGB_VALUE, CSS_YELLOWGREEN_NAME); nameColourHT.put(CSS_YELLOW_RGB_VALUE, CSS_YELLOW_NAME); } static { createColourHashTable(); createNameColourHashTable(); } /** * @param name The name of the wanted colour or null if the colour is not found. * @return The colour. */ public static Color getColor(String name) { if(name==null || name.length()==0) return null; Color c = colourHT.get(name); if(c!=null) return c; boolean found = false; int i=0, size = usercolors.size(); while(!found && istr is null, null is returned. * @param str The colour to read. * @return The found colour or null. * @since 2.0.0 */ public static Color getRGBColour(String str) { Color c = null; try { if(str!=null) if(str.startsWith("#"))//$NON-NLS-1$ c = CSSColors.hexToRBG(str); else if(str.startsWith("rgb("))//$NON-NLS-1$ c = CSSColors.SVGRGBtoRGB(str); else c = CSSColors.getColor(str); return c; } catch(IllegalArgumentException e) { return null; } } /** * Converts an SVG RGB colour: "rgb(int,int,int)" or "rgb(pc,pc,pc)" in an AWT colour. * @param str The string to parse. * @return The extracted colour or null. * @since 2.0.0 */ public static Color SVGRGBtoRGB(String str) { if(str==null || !str.startsWith("rgb(") || !str.endsWith(")"))//$NON-NLS-1$//$NON-NLS-2$ return null; Color c = null; String s = str.substring(4, str.length()-1); String[] rgbs = s.split(",");//$NON-NLS-1$ try { if(rgbs!=null && rgbs.length==3) { rgbs[0] = rgbs[0].replaceAll("[\t ]", "");//$NON-NLS-1$//$NON-NLS-2$ rgbs[1] = rgbs[1].replaceAll("[\t ]", "");//$NON-NLS-1$//$NON-NLS-2$ rgbs[2] = rgbs[2].replaceAll("[\t ]", "");//$NON-NLS-1$//$NON-NLS-2$ if(rgbs[0].contains("%"))//$NON-NLS-1$ { if(rgbs[0].endsWith("%") && rgbs[1].endsWith("%") && rgbs[2].endsWith("%"))//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ c = new Color(Double.valueOf(rgbs[0].substring(0, rgbs[0].length()-1)).floatValue()/100f, Double.valueOf(rgbs[1].substring(0, rgbs[1].length()-1)).floatValue()/100f, Double.valueOf(rgbs[2].substring(0, rgbs[2].length()-1)).floatValue()/100f); } else c = new Color(Integer.valueOf(rgbs[0]), Integer.valueOf(rgbs[1]), Integer.valueOf(rgbs[2])); } } catch(NumberFormatException e) { return null; } catch(IllegalArgumentException e) { return null; } return c; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/SVGNamedNodeMap.java0000644000000000000000000000763511347255510021437 0ustar package latexDraw.parsers.svg; import java.util.Vector; import org.w3c.dom.DOMException; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; /** * Defines an SVG named node map.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/16/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public class SVGNamedNodeMap implements NamedNodeMap, Cloneable { /** The set of nodes. @since 0.1 */ protected Vector nnm; /** * The constructor by default. * @since 0.1 */ public SVGNamedNodeMap() { nnm = new Vector(); } public int getLength() { return nnm==null ? 0 : nnm.size(); } public Node getNamedItem(String name) { if(nnm==null || name==null) return null; int i = 0, size = getLength(); boolean found = false; while(i=getLength() ? null : nnm.elementAt(index); } public Node removeNamedItem(String name) throws DOMException { if(name==null) throw new DOMException(DOMException.NOT_FOUND_ERR, "name is null"); int i = 0, size = getLength(); boolean found = false; while(i(); for(SVGAttr attr : nnm) clone.nnm.add((SVGAttr)attr.cloneNode(false)); return clone; } catch(CloneNotSupportedException e) { return null; } } @Override public String toString() { StringBuffer str = new StringBuffer().append("{");//$NON-NLS-1$ for(SVGAttr e : nnm) str.append(e.toString()).append(", ");//$NON-NLS-1$ return str.append("}").toString();//$NON-NLS-1$ } public Node getNamedItemNS(String namespaceURI, String localName) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public Node setNamedItemNS(Node arg) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } public Node removeNamedItemNS(String namespaceURI, String localName) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, SVGDocument.ACTION_NOT_IMPLEMENTED); } /** * @return the attributes. * @since 0.1 */ public Vector getAttributes() { return nnm; } @Override public boolean equals(Object obj) { if(obj==null || !(obj instanceof SVGNamedNodeMap)) return false; SVGNamedNodeMap map = (SVGNamedNodeMap)obj; boolean ok = true; int i, size = getLength(); if(size!=map.getLength()) return false; for(i=0; i *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/16/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1
    */ public class SVGTransform { public static final short SVG_TRANSFORM_UNKNOWN = 0; public static final short SVG_TRANSFORM_MATRIX = 1; public static final short SVG_TRANSFORM_TRANSLATE = 2; public static final short SVG_TRANSFORM_SCALE = 3; public static final short SVG_TRANSFORM_ROTATE = 4; public static final short SVG_TRANSFORM_SKEWX = 5; public static final short SVG_TRANSFORM_SKEWY = 6; /** The type of the transformation. */ protected short type; /** The matrix of the transformation. */ protected SVGMatrix matrix; /** The angle of a possible rotation or skew. */ protected double angle; /** * Creates a transformation with no type. */ public SVGTransform() { type = SVG_TRANSFORM_UNKNOWN; matrix = new SVGMatrix(); angle = Double.NaN; } /** * The constructor using a string containing the transformation. The transformation is not added if it is not valid. * @param transformation The SVG transformation. * @throws IllegalArgumentException If the transformation is no valid. * @since 0.1 */ public SVGTransform(String transformation) { this(); setTransformation(transformation); } /** * Parses a string containing the SVG transformation in order to set the transformation. * @param transformation The string to parse. * @throws IllegalArgumentException If the transformation is no valid. * @since 0.1 */ public void setTransformation(String transformation) { if(transformation==null) throw new IllegalArgumentException(); String code = transformation.replaceAll("[ \t\n\r\f]+", " ");//$NON-NLS-1$//$NON-NLS-2$ code = code.replaceAll("^[ ]", "");//$NON-NLS-1$//$NON-NLS-2$ code = code.replaceAll("[ ]$", "");//$NON-NLS-1$//$NON-NLS-2$ code = code.replaceAll("[ ]?[(][ ]?", "(");//$NON-NLS-1$//$NON-NLS-2$ code = code.replaceAll("[ ]?[)]", ")");//$NON-NLS-1$//$NON-NLS-2$ code = code.replaceAll("[ ]?,[ ]?", ",");//$NON-NLS-1$//$NON-NLS-2$ int i, lgth = code.length(), j, k; if(code.startsWith(SVGAttributes.SVG_TRANSFORM_ROTATE)) { i = SVGAttributes.SVG_TRANSFORM_ROTATE.length(); j = code.indexOf(')'); int k1 = code.indexOf(' '), k2 = code.indexOf(','); if(i>=lgth || code.charAt(i)!='(' || j==-1) throw new IllegalArgumentException(); k = k1==-1 ? k2 : k2==-1 ? k1 : Math.min(k1, k2); if(k==-1) setRotate(Double.valueOf(code.substring(i+1, j)), 0., 0.); else { double cx, cy, rotAngle; rotAngle = Double.valueOf(code.substring(i+1, k)); i = k+1; k1 = code.indexOf(' ', k+1); k2 = code.indexOf(',', k+1); k = k1==-1 ? k2 : k2==-1 ? k1 : Math.min(k1, k2); if(k==-1) throw new IllegalArgumentException(); cx = Double.valueOf(code.substring(i, k)); cy = Double.valueOf(code.substring(k+1, j)); setRotate(rotAngle, cx, cy); } } else if(code.startsWith(SVGAttributes.SVG_TRANSFORM_SCALE)) { k = code.indexOf(','); i = SVGAttributes.SVG_TRANSFORM_SCALE.length(); j = code.indexOf(')'); double sx, sy; if(i>=lgth || code.charAt(i)!='(' || j==-1) throw new IllegalArgumentException(); if(k==-1) k = code.indexOf(' '); if(k==-1) sx = sy = Double.valueOf(code.substring(i+1, j)); else { sx = Double.valueOf(code.substring(i+1, k)); sy = Double.valueOf(code.substring(k+1, j)); } setScale(sx, sy); } else if(code.startsWith(SVGAttributes.SVG_TRANSFORM_TRANSLATE)) { k = code.indexOf(','); i = SVGAttributes.SVG_TRANSFORM_TRANSLATE.length(); j = code.indexOf(')'); double tx, ty; if(i>=lgth || code.charAt(i)!='(' || j==-1) throw new IllegalArgumentException(); if(k==-1) k = code.indexOf(' '); if(k==-1) tx = ty = Double.valueOf(code.substring(i+1, j)); else { tx = Double.valueOf(code.substring(i+1, k)); ty = Double.valueOf(code.substring(k+1, j)); } setTranslate(tx, ty); } else if(code.startsWith(SVGAttributes.SVG_TRANSFORM_MATRIX)) { int nbPts = 6, l, k1, k2; i = SVGAttributes.SVG_TRANSFORM_MATRIX.length(); j = code.indexOf(')'); double coords[] = new double[nbPts]; if(i>=lgth || code.charAt(i)!='(' || j==-1) throw new IllegalArgumentException(); i++; for(l=0; l=lgth || code.charAt(i)!='(' || j==-1) throw new IllegalArgumentException(); setSkewX(Double.valueOf(code.substring(i+1, j))); } else if(code.startsWith(SVGAttributes.SVG_TRANSFORM_SKEW_Y)) { i = SVGAttributes.SVG_TRANSFORM_SKEW_Y.length(); j = code.indexOf(')'); if(i>=lgth || code.charAt(i)!='(' || j==-1) throw new IllegalArgumentException(); setSkewY(Double.valueOf(code.substring(i+1, j))); } else throw new IllegalArgumentException(); } /** * The transformation will be a translation. * @param tx The X translation. * @param ty The Y translation. * @since 0.1 */ public void setTranslate(double tx, double ty) { type = SVG_TRANSFORM_TRANSLATE; matrix.initMatrix(); matrix.translate(tx, ty); angle = Double.NaN; } /** * The transformation will be set by the given values. * @param a b c d e f The values of the matrix: [a, c, e, b, d, f, 0, 0, 1]. * @since 0.1 */ public void setMatrix(double a, double b, double c, double d, double e, double f) { type = SVG_TRANSFORM_MATRIX; matrix.setMatrix(a, b, c, d, e, f); angle = Double.NaN; } /** * The transformation will be a scaling. * @param sx The X scaling. * @param sy The Y scaling. * @since 0.1 */ public void setScale(double sx, double sy) { type = SVG_TRANSFORM_SCALE; matrix.initMatrix(); matrix.scaleNonUniform(sx, sy); angle = Double.NaN; } /** * The transformation will be a rotation form the origin. * @param angle The rotation angle in degree. * @param cx The X centre of the rotation. * @param cy The Y centre of the rotation. * @since 0.1 */ public void setRotate(double angle, double cx, double cy) { SVGMatrix m1 = new SVGMatrix(); SVGMatrix m2 = new SVGMatrix(); type = SVG_TRANSFORM_ROTATE; matrix.initMatrix(); m1.translate(cx, cy); m2.rotate(Math.toRadians(angle)); m1 = m1.multiply(m2); m2.translate(-cx, -cy); m1.multiply(m2); matrix.setMatrix(m1.a, m1.b, m1.c, m1.d, m1.e, m1.f); this.angle = angle; } /** * The transformation will be a X skew. * @param angle The angle of the skew in degree. * @since 0.1 */ public void setSkewX(double angle) { type = SVG_TRANSFORM_SKEWX; matrix.initMatrix(); matrix.skewX(Math.toRadians(angle)); this.angle = angle; } /** * The transformation will be a Y skew. * @param angle The angle of the skew in degree. * @since 0.1 */ public void setSkewY(double angle) { type = SVG_TRANSFORM_SKEWY; matrix.initMatrix(); matrix.skewY(Math.toRadians(angle)); this.angle = angle; } /** * @return the type of the transformation. * @since 0.1 */ public short getType() { return type; } /** * @return True if the transformation is a rotation. * @since 0.1 */ public boolean isRotation() { return getType()==SVG_TRANSFORM_ROTATE; } /** * @return True if the transformation is a translation. * @since 0.1 */ public boolean isTranslation() { return getType()==SVG_TRANSFORM_TRANSLATE; } /** * @return True if the transformation is a scale. * @since 0.1 */ public boolean isScale() { return getType()==SVG_TRANSFORM_SCALE; } /** * @return True if the transformation is a X skew. * @since 0.1 */ public boolean isXSkew() { return getType()==SVG_TRANSFORM_SKEWX; } /** * @return True if the transformation is a Y skew. * @since 0.1 */ public boolean isYSkew() { return getType()==SVG_TRANSFORM_SKEWY; } /** * @return The rotation angle in degree if the transformation is a rotation. NaN otherwise. */ public double getRotationAngle() { return isRotation() ? angle : Double.NaN; } /** * @return The skew angle in degree if the transformation is a X skew. NaN otherwise. */ public double getXSkewAngle() { return isXSkew() ? angle : Double.NaN; } /** * @return The skew angle in degree if the transformation is a Y skew. NaN otherwise. */ public double getYSkewAngle() { return isYSkew() ? angle : Double.NaN; } /** * @return The X scale factor if the transformation is a scaling. NaN otherwise. */ public double getXScaleFactor() { return isScale() ? matrix.getA() : Double.NaN; } /** * @return The Y scale factor if the transformation is a scaling. NaN otherwise. */ public double getYScaleFactor() { return isScale() ? matrix.getD() : Double.NaN; } /** * @return The X translation if the transformation is a translation. NaN otherwise. */ public double getTX() { return isTranslation() ? matrix.getE() : Double.NaN; } /** * @return The Y translation if the transformation is a translation. NaN otherwise. */ public double getTY() { return isTranslation() ? matrix.getF() : Double.NaN; } /** * @return the matrix. * @since 0.1 */ public SVGMatrix getMatrix() { return matrix; } /** * Creates a translation. * @param x The tx. * @param y The ty. * @return The created translation. * @since 2.0.0 */ public static SVGTransform createTranslation(double x, double y) { SVGTransform t = new SVGTransform(); t.setTranslate(x, y); return t; } /** * Creates a rotation. * @param cx The X centre of the rotation. * @param cy The Y centre of the rotation. * @param angle The angle of rotation in radian. * @return The created translation. * @since 0.1 */ public static SVGTransform createRotation(double angle, double cx, double cy) { SVGTransform r = new SVGTransform(); r.setRotate(angle, cx, cy); return r; } @Override public String toString() { StringBuffer code = new StringBuffer(); SVGMatrix m = getMatrix(); switch(getType()) { case SVG_TRANSFORM_MATRIX: code.append(SVGAttributes.SVG_TRANSFORM_MATRIX).append("(").append(m.toString()).append(")");//$NON-NLS-1$//$NON-NLS-2$ break; case SVG_TRANSFORM_ROTATE: code.append(SVGAttributes.SVG_TRANSFORM_ROTATE).append("(").append(getRotationAngle()).append(//$NON-NLS-1$ m.getE()==0 && m.getF()==0 ? "" : " " + m.getE() + " " + m.getF()).append(")");//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$ break; case SVG_TRANSFORM_SCALE: code.append(SVGAttributes.SVG_TRANSFORM_SCALE).append("(").append(getXScaleFactor()).append(" ").append(//$NON-NLS-2$//$NON-NLS-1$ getYScaleFactor()).append(")");//$NON-NLS-1$ break; case SVG_TRANSFORM_SKEWX: code.append(SVGAttributes.SVG_TRANSFORM_SKEW_X).append("(").append(getXSkewAngle()).append(")");//$NON-NLS-1$//$NON-NLS-2$ break; case SVG_TRANSFORM_SKEWY: code.append(SVGAttributes.SVG_TRANSFORM_SKEW_Y).append("(").append(getYSkewAngle()).append(")");//$NON-NLS-1$//$NON-NLS-2$ break; case SVG_TRANSFORM_TRANSLATE: code.append(SVGAttributes.SVG_TRANSFORM_TRANSLATE).append("(").append(getTX()).append(" ").append(//$NON-NLS-2$ //$NON-NLS-1$ getTY()).append(")");//$NON-NLS-1$ break; } return code.toString(); } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/SVGAttributes.java0000644000000000000000000005201711347255510021267 0ustar package latexDraw.parsers.svg; /** * Contains SVG attributes according to the SVG specification version 1.1.
    *
    * * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 06/04/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1
    */ public abstract class SVGAttributes { public static final String SVG_X = "x"; //$NON-NLS-1$ public static final String SVG_Y = "y"; //$NON-NLS-1$ public static final String SVG_X1 = "x1"; //$NON-NLS-1$ public static final String SVG_Y1 = "y1"; //$NON-NLS-1$ public static final String SVG_X2 = "x2"; //$NON-NLS-1$ public static final String SVG_Y2 = "y2"; //$NON-NLS-1$ public static final String SVG_RX = "rx"; //$NON-NLS-1$ public static final String SVG_RY = "ry"; //$NON-NLS-1$ public static final String SVG_ID = "id"; //$NON-NLS-1$ public static final String SVG_HEIGHT = "height"; //$NON-NLS-1$ public static final String SVG_WIDTH = "width"; //$NON-NLS-1$ public static final String SVG_FILL = "fill"; //$NON-NLS-1$ public static final String SVG_STROKE = "stroke"; //$NON-NLS-1$ public static final String SVG_STROKE_WIDTH = "stroke-width"; //$NON-NLS-1$ public static final String SVG_TRANSFORM = "transform"; //$NON-NLS-1$ public static final String SVG_OFFSET = "offset"; //$NON-NLS-1$ public static final String SVG_STOP_COLOR = "stop-color"; //$NON-NLS-1$ public static final String SVG_GRADIENT_UNITS = "gradientUnits"; //$NON-NLS-1$ public static final String SVG_PATTERN_UNITS = "patternUnits"; //$NON-NLS-1$ public static final String SVG_D = "d"; //$NON-NLS-1$ public static final String SVG_STROKE_DASHARRAY = "stroke-dasharray"; //$NON-NLS-1$ public static final String SVG_STROKE_LINECAP = "stroke-linecap"; //$NON-NLS-1$ public static final String SVG_POINTS = "points"; //$NON-NLS-1$ public static final String SVG_MARKER_END = "marker-end"; //$NON-NLS-1$ public static final String SVG_MARKER_START = "marker-start"; //$NON-NLS-1$ public static final String SVG_MARKER_MID = "marker-mid"; //$NON-NLS-1$ public static final String SVG_ORIENT = "orient"; //$NON-NLS-1$ public static final String SVG_R = "r"; //$NON-NLS-1$ public static final String SVG_REF_X = "refX"; //$NON-NLS-1$ public static final String SVG_REF_Y = "refY"; //$NON-NLS-1$ public static final String SVG_CX = "cx"; //$NON-NLS-1$ public static final String SVG_CY = "cy"; //$NON-NLS-1$ public static final String SVG_DX = "dx"; //$NON-NLS-1$ public static final String SVG_DY = "dy"; //$NON-NLS-1$ public static final String SVG_FONT_SIZE = "font-size"; //$NON-NLS-1$ public static final String SVG_FONT_FAMILY = "font-family"; //$NON-NLS-1$ public static final String SVG_VERSION = "version"; //$NON-NLS-1$ public static final String SVG_PATTERN_CONTENTS_UNITS = "patternContentUnits"; //$NON-NLS-1$ public static final String SVG_SPREAD_METHOD = "spreadMethod"; //$NON-NLS-1$ public static final String SVG_STYLE = "style"; //$NON-NLS-1$ public static final String SVG_MARKER_UNITS = "markerUnits"; //$NON-NLS-1$ public static final String SVG_MARKER_HEIGHT = "markerHeight"; //$NON-NLS-1$ public static final String SVG_MARKER_WIDTH = "markerWidth"; //$NON-NLS-1$ public static final String SVG_OVERFLOW = "overflow"; //$NON-NLS-1$ public static final String SVG_BASE_PROFILE = "baseProfile"; //$NON-NLS-1$ public static final String SVG_FONT_STYLE = "font-style"; //$NON-NLS-1$ public static final String SVG_FONT_WEIGHT = "font-weight"; //$NON-NLS-1$ public static final String SVG_VALUE_NONE = "none"; //$NON-NLS-1$ public static final String SVG_UNITS_VALUE_USR = "userSpaceOnUse"; //$NON-NLS-1$ public static final String SVG_UNITS_VALUE_OBJ = "objectBoundingBox"; //$NON-NLS-1$ public static final String SVG_LINECAP_VALUE_BUTT = "butt"; //$NON-NLS-1$ public static final String SVG_LINECAP_VALUE_ROUND = "round"; //$NON-NLS-1$ public static final String SVG_LINECAP_VALUE_SQUARE = "square"; //$NON-NLS-1$ public static final String SVG_VALUE_AUTO = "auto"; //$NON-NLS-1$ public static final String SVG_INHERIT = "inherit"; //$NON-NLS-1$ public static final String SVG_PAD = "pad"; //$NON-NLS-1$ public static final String SVG_REFLECT = "reflect"; //$NON-NLS-1$ public static final String SVG_REPEAT = "repeat"; //$NON-NLS-1$ public static final String SVG_UNITS_VALUE_STROKE = "strokeWidth"; //$NON-NLS-1$ public static final String SVG_VALUE_VISIBLE = "visible"; //$NON-NLS-1$ public static final String SVG_TRANSFORM_ROTATE = "rotate"; //$NON-NLS-1$ public static final String SVG_TRANSFORM_MATRIX = "matrix"; //$NON-NLS-1$ public static final String SVG_TRANSFORM_TRANSLATE = "translate"; //$NON-NLS-1$ public static final String SVG_TRANSFORM_SCALE = "scale"; //$NON-NLS-1$ public static final String SVG_TRANSFORM_SKEW_X = "skewX"; //$NON-NLS-1$ public static final String SVG_TRANSFORM_SKEW_Y = "skewY"; //$NON-NLS-1$ public static final String SVG_FONT_STYLE_NORMAL = "normal"; //$NON-NLS-1$ public static final String SVG_FONT_STYLE_OBLIQUE = "oblique"; //$NON-NLS-1$ public static final String SVG_FONT_STYLE_ITALIC = "italic"; //$NON-NLS-1$ public static final String SVG_FONT_WEIGHT_BOLD = "bold"; //$NON-NLS-1$ public static final String SVG_FONT_WEIGHT_NORMAL = "normal"; //$NON-NLS-1$ // public static final String SVG_TEXT_ANCHOR = "text-anchor"; //$NON-NLS-1$ // public static final String SVG_TEXT_ANCHOR_VALUE_END = "end"; //$NON-NLS-1$ // public static final String SVG_TEXT_ANCHOR_VALUE_START = "start"; //$NON-NLS-1$ // public static final String SVG_TEXT_ANCHOR_VALUE_MIDDLE = "middle"; //$NON-NLS-1$ // public static final String SVG_STOP_OPACITY = "stop-opacity"; //$NON-NLS-1$ // public static final String SVG_ACCENT_HEIGHT = "accent-height"; //$NON-NLS-1$ // public static final String SVG_ACCUMULATE = "accumulate"; //$NON-NLS-1$ // public static final String SVG_ALIGNMENT_BASELINE = "alignment-baseline"; //$NON-NLS-1$ // public static final String SVG_ALPHABETIC = "alphabetic"; //$NON-NLS-1$ // public static final String SVG_AMPLITUDE = "amplitude"; //$NON-NLS-1$ // public static final String SVG_ANIMATE = "animate"; //$NON-NLS-1$ // public static final String SVG_ARABIC_FORM = "arabic-form"; //$NON-NLS-1$ // public static final String SVG_ASCENT = "ascent"; //$NON-NLS-1$ // public static final String SVG_ATTRIBUTE_TYPE = "attributeType"; //$NON-NLS-1$ // public static final String SVG_AZIMUTH = "azimuth"; //$NON-NLS-1$ // public static final String SVG_BASE_FREQUENCY = "baseFrequency"; //$NON-NLS-1$ // public static final String SVG_BASELINE_SHIFT = "baseline-shift"; //$NON-NLS-1$ // public static final String SVG_BBOX = "bbox"; //$NON-NLS-1$ // public static final String SVG_BIAS = "bias"; //$NON-NLS-1$ // public static final String SVG_BY = "by"; //$NON-NLS-1$ // public static final String SVG_CALC_MODE = "calcMode"; //$NON-NLS-1$ // public static final String SVG_CAP_HEIGHT = "cap-height"; //$NON-NLS-1$ // public static final String SVG_CAP_CLASS = "class"; //$NON-NLS-1$ // public static final String SVG_CLIP = "clip"; //$NON-NLS-1$ // public static final String SVG_CLIP_PATH = "clip-path"; //$NON-NLS-1$ // public static final String SVG_CLIP_RULE = "clip-rule"; //$NON-NLS-1$ // public static final String SVG_CLIP_PATH_UNITS = "clipPathUnits"; //$NON-NLS-1$ // public static final String SVG_COLOR = "color"; //$NON-NLS-1$ // public static final String SVG_COLOR_INTERPOLATION = "color-interpolation"; //$NON-NLS-1$ // public static final String SVG_COLOR_INTERPOLATION_FILTERS = "color-interpolation-filters";//$NON-NLS-1$ // public static final String SVG_COLOR_PROFILE = "color-profile"; //$NON-NLS-1$ // public static final String SVG_COLOR_RENDERING = "color-rendering"; //$NON-NLS-1$ // public static final String SVG_CONTENT_SCRIPT_TYPE = "contentScriptType"; //$NON-NLS-1$ // public static final String SVG_CONTENT_STYLE_TYPE = "contentStyleType"; //$NON-NLS-1$ // public static final String SVG_CURSOR = "cursor"; //$NON-NLS-1$ // public static final String SVG_DESCENT = "descent"; //$NON-NLS-1$ // public static final String SVG_DIFFUSE_CONSTANT = "diffuseConstant"; //$NON-NLS-1$ // public static final String SVG_DIRECTION = "direction"; //$NON-NLS-1$ // public static final String SVG_DISPLAY = "display"; //$NON-NLS-1$ // public static final String SVG_DIVISOR = "divisor"; //$NON-NLS-1$ // public static final String SVG_DOMINANT_BASELINE = "dominant-baseline"; //$NON-NLS-1$ // public static final String SVG_EDGE_MODE = "edgeMode"; //$NON-NLS-1$ // public static final String SVG_ELEVATION = "elevation"; //$NON-NLS-1$ // public static final String SVG_ENABLE_BACKGROUND = "enable-background"; //$NON-NLS-1$ // public static final String SVG_END = "end"; //$NON-NLS-1$ // public static final String SVG_EXPONENT = "exponent"; //$NON-NLS-1$ // public static final String SVG_EXTERNAL_RESOURCES_REQUIRED = "externalResourcesRequired"; //$NON-NLS-1$ // public static final String SVG_FE_COLOR_MATRIX = "feColorMatrix"; //$NON-NLS-1$ // public static final String SVG_FE_COMPOSITE = "feComposite"; //$NON-NLS-1$ // public static final String SVG_FE_GAUSSIAN_BLUR = "feGaussianBlur"; //$NON-NLS-1$ // public static final String SVG_FE_MORPHOLOGY = "feMorphology"; //$NON-NLS-1$ // public static final String SVG_FE_TILE = "feTile"; //$NON-NLS-1$ // public static final String SVG_FILL_OPACITY = "fill-opacity"; //$NON-NLS-1$ // public static final String SVG_FILL_RULE = "fill-rule"; //$NON-NLS-1$ // public static final String SVG_FILTER = "filter"; //$NON-NLS-1$ // public static final String SVG_FILTER_RES = "filterRes"; //$NON-NLS-1$ // public static final String SVG_FILTER_UNITS = "filterUnits"; //$NON-NLS-1$ // public static final String SVG_FLOOD_COLOR = "flood-color"; //$NON-NLS-1$ // public static final String SVG_FLOOD_OPACITY = "flood-opacity"; //$NON-NLS-1$ // public static final String SVG_FONT_SIZE_ADJUST = "font-size-adjust"; //$NON-NLS-1$ // public static final String SVG_FONT_STRETCH = "font-stretch"; //$NON-NLS-1$ // public static final String SVG_FONT_VARIANT = "font-variant"; //$NON-NLS-1$ // public static final String SVG_FORMAT = "format"; //$NON-NLS-1$ // public static final String SVG_FROM = "from"; //$NON-NLS-1$ // public static final String SVG_FX = "fx"; //$NON-NLS-1$ // public static final String SVG_FY = "fy"; //$NON-NLS-1$ // public static final String SVG_G1 = "g1"; //$NON-NLS-1$ // public static final String SVG_G2 = "g2"; //$NON-NLS-1$ // public static final String SVG_GLYPH_NAME = "glyph-name"; //$NON-NLS-1$ // public static final String SVG_GLYPH_ORIENTATION_HORIZONTAL = "glyph-orientation-horizontal"; //$NON-NLS-1$ // public static final String SVG_GLYPH_ORIENTATION_VERTICAL = "glyph-orientation-vertical"; //$NON-NLS-1$ // public static final String SVG_GLYPH_REF = "glyphRef"; //$NON-NLS-1$ // public static final String SVG_GRADIENT_TRANSFORM = "gradientTransform"; //$NON-NLS-1$ // public static final String SVG_HANGING = "hanging"; //$NON-NLS-1$ // public static final String SVG_HORIZ_ADV_X = "horiz-adv-x"; //$NON-NLS-1$ // public static final String SVG_HORIZ_ORIGIN_X = "horiz-origin-x"; //$NON-NLS-1$ // public static final String SVG_HORIZ_ORIGIN_Y = "horiz-origin-y"; //$NON-NLS-1$ // public static final String SVG_IDEOGRAPHIC = "ideographic"; //$NON-NLS-1$ // public static final String SVG_IMAGE_RENDERING = "image-rendering"; //$NON-NLS-1$ // public static final String SVG_IN = "in"; //$NON-NLS-1$ // public static final String SVG_IN2 = "in2"; //$NON-NLS-1$ // public static final String SVG_INTERCEPT = "intercept"; //$NON-NLS-1$ // public static final String SVG_K = "k"; //$NON-NLS-1$ // public static final String SVG_K1 = "k1"; //$NON-NLS-1$ // public static final String SVG_K2 = "k2"; //$NON-NLS-1$ // public static final String SVG_K3 = "k3"; //$NON-NLS-1$ // public static final String SVG_K4 = "k4"; //$NON-NLS-1$ // public static final String SVG_KERNEL_MATRIX = "kernelMatrix"; //$NON-NLS-1$ // public static final String SVG_KERNEL_UNIT_LENGTH = "kernelUnitLength"; //$NON-NLS-1$ // public static final String SVG_KERNING = "kerning"; //$NON-NLS-1$ // public static final String SVG_KEY_POINTS = "keyPoints"; //$NON-NLS-1$ // public static final String SVG_KEY_SPLINES = "keySplines"; //$NON-NLS-1$ // public static final String SVG_KEY_TIMES = "keyTimes"; //$NON-NLS-1$ // public static final String SVG_LANG = "lang"; //$NON-NLS-1$ // public static final String SVG_LENGTH_ADJUST = "lengthAdjust"; //$NON-NLS-1$ // public static final String SVG_LETTER_SPACING = "letter-spacing"; //$NON-NLS-1$ // public static final String SVG_LIGHTING_COLOR = "lighting-color"; //$NON-NLS-1$ // public static final String SVG_LIMITING_CONE_ANGLE = "limitingConeAngle"; //$NON-NLS-1$ // public static final String SVG_LOCAL = "local"; //$NON-NLS-1$ // public static final String SVG_MASK = "mask"; //$NON-NLS-1$ // public static final String SVG_MASK_CONTENT_UNITS = "maskContentUnits"; //$NON-NLS-1$ // public static final String SVG_MASK_UNITS = "maskUnits"; //$NON-NLS-1$ // public static final String SVG_MASK_MATHEMATICAL = "mathematical"; //$NON-NLS-1$ // public static final String SVG_MAX = "max"; //$NON-NLS-1$ // public static final String SVG_MEDIA = "media"; //$NON-NLS-1$ // public static final String SVG_METHOD = "method"; //$NON-NLS-1$ // public static final String SVG_MIN = "min"; //$NON-NLS-1$ // public static final String SVG_MODE = "mode"; //$NON-NLS-1$ // public static final String SVG_NAME = "name"; //$NON-NLS-1$ // public static final String SVG_NUM_OCTAVES = "numOctaves"; //$NON-NLS-1$ // public static final String SVG_ONABORT = "onabort"; //$NON-NLS-1$ // public static final String SVG_ONACTIVE = "onactivate"; //$NON-NLS-1$ // public static final String SVG_ONBEGIN = "onbegin"; //$NON-NLS-1$ // public static final String SVG_ONCLICK = "onclick"; //$NON-NLS-1$ // public static final String SVG_ONEND = "onend"; //$NON-NLS-1$ // public static final String SVG_ONERROR = "onerror"; //$NON-NLS-1$ // public static final String SVG_ONFOCUSIN = "onfocusin"; //$NON-NLS-1$ // public static final String SVG_ONFOCUSOUT = "onfocusout"; //$NON-NLS-1$ // public static final String SVG_ONLOAD = "onload"; //$NON-NLS-1$ // public static final String SVG_ONMOUSEDOWN = "onmousedown"; //$NON-NLS-1$ // public static final String SVG_ONMOUSEMOVE = "onmousemove"; //$NON-NLS-1$ // public static final String SVG_ONMOUSEOUT = "onmouseout"; //$NON-NLS-1$ // public static final String SVG_ONMOUSEOVER = "onmouseover"; //$NON-NLS-1$ // public static final String SVG_ONMOUSEUP = "onmouseup"; //$NON-NLS-1$ // public static final String SVG_ONREPEAT = "onrepeat"; //$NON-NLS-1$ // public static final String SVG_ONRESIZE = "onresize"; //$NON-NLS-1$ // public static final String SVG_ONSCROLL = "onscroll"; //$NON-NLS-1$ // public static final String SVG_ONUNLOAD = "onunload"; //$NON-NLS-1$ // public static final String SVG_ONZOOM = "onzoom"; //$NON-NLS-1$ // public static final String SVG_OPACITY = "opacity"; //$NON-NLS-1$ // public static final String SVG_OPERATOR = "operator"; //$NON-NLS-1$ // public static final String SVG_ORDER = "order"; //$NON-NLS-1$ // public static final String SVG_ORIENTATION = "orientation"; //$NON-NLS-1$ // public static final String SVG_ORIGIN = "origin"; //$NON-NLS-1$ // public static final String SVG_OVERLINE_POSITION = "overline-position"; //$NON-NLS-1$ // public static final String SVG_OVERLINE_THICKNESS = "overline-thickness"; //$NON-NLS-1$ // public static final String SVG_PANOSE_1 = "panose-1"; //$NON-NLS-1$ // public static final String SVG_PATH = "path"; //$NON-NLS-1$ // public static final String SVG_PATH_LENGTH = "pathLength"; //$NON-NLS-1$ // public static final String SVG_PATTERN_TRANSFORMATION = "patternTransform"; //$NON-NLS-1$ // public static final String SVG_POINTER_EVENTS = "pointer-events"; //$NON-NLS-1$ // public static final String SVG_POINTS_AT_X = "pointsAtX"; //$NON-NLS-1$ // public static final String SVG_POINTS_AT_Y = "pointsAtY"; //$NON-NLS-1$ // public static final String SVG_POINTS_AT_Z = "pointsAtZ"; //$NON-NLS-1$ // public static final String SVG_PRESERVE_ALPHA = "preserveAlpha"; //$NON-NLS-1$ // public static final String SVG_PRESERVE_ASPECT_RATIO = "preserveAspectRatio"; //$NON-NLS-1$ // public static final String SVG_PRIMITIVE_UNITS = "primitiveUnits"; //$NON-NLS-1$ // public static final String SVG_RADIUS = "radius"; //$NON-NLS-1$ // public static final String SVG_RENDERING_INTENT = "rendering-intent"; //$NON-NLS-1$ // public static final String SVG_REPEAT_COUNT = "repeatCount"; //$NON-NLS-1$ // public static final String SVG_REPEAT_DUR = "repeatDur"; //$NON-NLS-1$ // public static final String SVG_REQUIRED_EXTENSIONS = "requiredExtensions"; //$NON-NLS-1$ // public static final String SVG_RESTART = "restart"; //$NON-NLS-1$ // public static final String SVG_RESULT = "result"; //$NON-NLS-1$ // public static final String SVG_ROTATE = "rotate"; //$NON-NLS-1$ // public static final String SVG_SCALE = "scale"; //$NON-NLS-1$ // public static final String SVG_SEED = "seed"; //$NON-NLS-1$ // public static final String SVG_SHAPE_RENDERING = "shape-rendering"; //$NON-NLS-1$ // public static final String SVG_SLOPE = "slope"; //$NON-NLS-1$ // public static final String SVG_SPACING = "spacing"; //$NON-NLS-1$ // public static final String SVG_SPECULAR_CONSTANT = "specularConstant"; //$NON-NLS-1$ // public static final String SVG_SPECULAR_EXPONENT = "specularExponent"; //$NON-NLS-1$ // public static final String SVG_START_OFFSET = "startOffset"; //$NON-NLS-1$ // public static final String SVG_STD_DEVIATION = "stdDeviation"; //$NON-NLS-1$ // public static final String SVG_STEMH = "stemh"; //$NON-NLS-1$ // public static final String SVG_STEMV = "stemv"; //$NON-NLS-1$ // public static final String SVG_STITCH_TILES = "stitchTiles"; //$NON-NLS-1$ // public static final String SVG_STRIKETHROUGH_POSITION = "strikethrough-position"; //$NON-NLS-1$ // public static final String SVG_STRIKETHROUGH_THICKNESS = "strikethrough-thickness"; //$NON-NLS-1$ // public static final String SVG_STROKE_DASHOFFSET = "stroke-dashoffset"; //$NON-NLS-1$ // public static final String SVG_STROKE_LINEJOIN = "stroke-linejoin"; //$NON-NLS-1$ // public static final String SVG_STROKE_MITERLIMIT = "stroke-miterlimit"; //$NON-NLS-1$ // public static final String SVG_STROKE_OPACITY = "stroke-opacity"; //$NON-NLS-1$ // public static final String SVG_SURFACE_SCALE = "surfaceScale"; //$NON-NLS-1$ // public static final String SVG_SYSTEM_LANGUAGE = "systemLanguage"; //$NON-NLS-1$ // public static final String SVG_TABLE_VALUES = "tableValues"; //$NON-NLS-1$ // public static final String SVG_TARGET = "target"; //$NON-NLS-1$ // public static final String SVG_TARGETX = "targetX"; //$NON-NLS-1$ // public static final String SVG_TARGETY = "targetY"; //$NON-NLS-1$ // public static final String SVG_TEXT_DECORATION = "text-decoration"; //$NON-NLS-1$ // public static final String SVG_TEXT_RENDERING = "text-rendering"; //$NON-NLS-1$ // public static final String SVG_TEXT_LENGTH = "textLength"; //$NON-NLS-1$ } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/parsers/0000755000000000000000000000000011347255510017370 5ustar latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/parsers/SVGPathParser.java0000644000000000000000000002405611347255510022673 0ustar package latexDraw.parsers.svg.parsers; import java.text.ParseException; import latexDraw.parsers.svg.elements.path.*; /** * Defines an SVGPath parser.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/20/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGPathParser extends SVGNumberParser { /** The handler of the SVGPath. @since 0.1 */ protected SVGPathHandler handler; /** * The main constructor. * @param code The path to parse. * @param handler The handler of the path. */ public SVGPathParser(String code, SVGPathHandler handler) { super(code); this.handler = handler; } @Override public void parse() throws ParseException { setPosition(0); skipWSP(); if(getChar()!='m' && getChar()!='M')// The first command must be a moveto command. throw new ParseException("moveto command (m|M) expected.", getPosition());//$NON-NLS-1$ parseMoveto(false);// If a relative moveto (m) appears as the first element of the path, then it is treated as a pair of absolute coordinates. while(!isEOC()) { skipWSP(); switch(getChar()) { case EOC: break; case 'Z': case 'z': parseClosepath(); break; case 'm': parseMoveto(true); break; case 'M': parseMoveto(false); break; case 'l': parseLineto(true); break; case 'L': parseLineto(false); break; case 'h': parseHorizontalLineto(true); break; case 'H': parseHorizontalLineto(false); break; case 'v': parseVerticalLineto(true); break; case 'V': parseVerticalLineto(false); break; case 'a': parseEllipticalArcto(true); break; case 'A': parseEllipticalArcto(false); break; case 'c': parseCurveto(true); break; case 'C': parseCurveto(false); break; case 'q': parseQuadraticBezierCurveto(true); break; case 'Q': parseQuadraticBezierCurveto(false); break; case 't': parseShorthandQuadraticBezierCurveto(true); break; case 'T': parseShorthandQuadraticBezierCurveto(false); break; case 's': parseShorthandCurveto(true); break; case 'S': parseShorthandCurveto(false); break; default: throw new ParseException("Invalid token:" + getChar(), getPosition());//$NON-NLS-1$ } } } /** * Parses an SVGPath smooth curveto. * @param isRelative True if segment is relative. * @throws ParseException If a problem occurs. * @since 0.1 */ protected void parseShorthandCurveto(boolean isRelative) throws ParseException { double x, y, x2, y2; nextChar(); skipWSP(); x2 = parseNumber(false); skipWSPComma(); y2 = parseNumber(false); skipWSPComma(); x = parseNumber(false); skipWSPComma(); y = parseNumber(false); skipWSPComma(); handler.onPathSeg(new SVGPathSegCurvetoCubicSmooth(x, y, x2, y2, isRelative)); while(!isEOC() && isNumber(false)) { x2 = parseNumber(false); skipWSPComma(); y2 = parseNumber(false); skipWSPComma(); x = parseNumber(false); skipWSPComma(); y = parseNumber(false); skipWSPComma(); handler.onPathSeg(new SVGPathSegCurvetoCubicSmooth(x, y, x2, y2, isRelative)); } nextChar(); } /** * Parses an SVGPath closepath. * @since 0.1 */ protected void parseClosepath() { handler.onPathSeg(new SVGPathSegClosePath()); nextChar(); } /** * Parses an SVGPath horizontal lineto. * @param isRelative True if segment is relative. * @throws ParseException If a problem occurs. * @since 0.1 */ protected void parseHorizontalLineto(boolean isRelative) throws ParseException { double h; nextChar(); skipWSP(); h = parseNumber(false); skipWSPComma(); handler.onPathSeg(new SVGPathSegLinetoHorizontal(h, isRelative)); while(!isEOC() && isNumber(false)) { h = parseNumber(false); skipWSPComma(); handler.onPathSeg(new SVGPathSegLinetoHorizontal(h, isRelative)); } } /** * Parses an SVGPath vertical lineto. * @param isRelative True if segment is relative. * @throws ParseException If a problem occurs. * @since 0.1 */ protected void parseVerticalLineto(boolean isRelative) throws ParseException { double v; nextChar(); skipWSP(); v = parseNumber(false); skipWSPComma(); handler.onPathSeg(new SVGPathSegLinetoVertical(v, isRelative)); while(!isEOC() && isNumber(false)) { v = parseNumber(false); skipWSPComma(); handler.onPathSeg(new SVGPathSegLinetoVertical(v, isRelative)); } } /** * Parses an SVGPath arc. * @param isRelative True if segment is relative. * @throws ParseException If a problem occurs. * @since 0.1 */ protected void parseEllipticalArcto(boolean isRelative) throws ParseException { double x, y, rx, ry, angle; boolean laf, sf; nextChar(); skipWSP(); rx = parseNumber(true); skipWSPComma(); ry = parseNumber(true); skipWSPComma(); angle = parseNumber(false); skipWSPComma(); laf = parseFlag(); skipWSPComma(); sf = parseFlag(); skipWSPComma(); x = parseNumber(false); skipWSPComma(); y = parseNumber(false); skipWSPComma(); handler.onPathSeg(new SVGPathSegArc(x, y, rx, ry, angle, laf, sf, isRelative)); while(!isEOC() && isNumber(true)) { rx = parseNumber(true); skipWSPComma(); ry = parseNumber(true); skipWSPComma(); angle = parseNumber(false); skipWSPComma(); laf = parseFlag(); skipWSPComma(); sf = parseFlag(); skipWSPComma(); x = parseNumber(false); skipWSPComma(); y = parseNumber(false); skipWSPComma(); handler.onPathSeg(new SVGPathSegArc(x, y, rx, ry, angle, laf, sf, isRelative)); } } /** * Parses an SVGPath curveto. * @param isRelative True if segment is relative. * @throws ParseException If a problem occurs. * @since 0.1 */ protected void parseCurveto(boolean isRelative) throws ParseException { double x, y, x1, x2, y1, y2; nextChar(); skipWSP(); x1 = parseNumber(false); skipWSPComma(); y1 = parseNumber(false); skipWSPComma(); x2 = parseNumber(false); skipWSPComma(); y2 = parseNumber(false); skipWSPComma(); x = parseNumber(false); skipWSPComma(); y = parseNumber(false); skipWSPComma(); handler.onPathSeg(new SVGPathSegCurvetoCubic(x, y, x1, y1, x2, y2, isRelative)); while(!isEOC() && isNumber(false)) { x1 = parseNumber(false); skipWSPComma(); y1 = parseNumber(false); skipWSPComma(); x2 = parseNumber(false); skipWSPComma(); y2 = parseNumber(false); skipWSPComma(); x = parseNumber(false); skipWSPComma(); y = parseNumber(false); skipWSPComma(); handler.onPathSeg(new SVGPathSegCurvetoCubic(x, y, x1, y1, x2, y2, isRelative)); } } /** * Parses an SVGPath quadratic curveto. * @param isRelative True if segment is relative. * @throws ParseException If a problem occurs. * @since 0.1 */ protected void parseQuadraticBezierCurveto(boolean isRelative) throws ParseException { double x, y, x1, y1; nextChar(); skipWSP(); x1 = parseNumber(false); skipWSPComma(); y1 = parseNumber(false); skipWSPComma(); x = parseNumber(false); skipWSPComma(); y = parseNumber(false); skipWSPComma(); handler.onPathSeg(new SVGPathSegCurvetoQuadratic(x, y, x1, y1, isRelative)); while(!isEOC() && isNumber(false)) { x1 = parseNumber(false); skipWSPComma(); y1 = parseNumber(false); skipWSPComma(); x = parseNumber(false); skipWSPComma(); y = parseNumber(false); skipWSPComma(); handler.onPathSeg(new SVGPathSegCurvetoQuadratic(x, y, x1, y1, isRelative)); } } /** * Parses an SVGPath quadratic smooth curveto. * @param isRelative True if segment is relative. * @throws ParseException If a problem occurs. * @since 0.1 */ protected void parseShorthandQuadraticBezierCurveto(boolean isRelative) throws ParseException { double x, y; nextChar(); skipWSP(); x = parseNumber(false); skipWSPComma(); y = parseNumber(false); skipWSPComma(); handler.onPathSeg(new SVGPathSegCurvetoQuadraticSmooth(x, y, isRelative)); while(!isEOC() && isNumber(false)) { x = parseNumber(false); skipWSPComma(); y = parseNumber(false); skipWSPComma(); handler.onPathSeg(new SVGPathSegLineto(x, y, isRelative)); } } /** * Parses an SVGPath lineto. * @param isRelative True if segment is relative. * @throws ParseException If a problem occurs. * @since 0.1 */ protected void parseLineto(boolean isRelative) throws ParseException { double x, y; nextChar(); skipWSP(); x = parseNumber(false); skipWSPComma(); y = parseNumber(false); skipWSPComma(); handler.onPathSeg(new SVGPathSegLineto(x, y, isRelative)); while(!isEOC() && isNumber(false)) { x = parseNumber(false); skipWSPComma(); y = parseNumber(false); skipWSPComma(); handler.onPathSeg(new SVGPathSegLineto(x, y, isRelative)); } } /** * Parses an SVGPath moveto. * @param isRelative True if segment is relative. * @throws ParseException If a problem occurs. * @since 0.1 */ protected void parseMoveto(boolean isRelative) throws ParseException { double x, y; nextChar(); skipWSP(); x = parseNumber(false); skipWSPComma(); y = parseNumber(false); skipWSPComma(); handler.onPathSeg(new SVGPathSegMoveto(x, y, isRelative)); while(!isEOC() && isNumber(false)) { x = parseNumber(false); skipWSPComma(); y = parseNumber(false); skipWSPComma(); handler.onPathSeg(new SVGPathSegLineto(x, y, isRelative)); } } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/parsers/AbstractSVGParser.java0000644000000000000000000000301611347255510023533 0ustar package latexDraw.parsers.svg.parsers; import latexDraw.parsers.CodeParser; /** * Defines a model for the SVG parsers.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/20/07
    * @author Arnaud BLOUIN
    * @version 2.0.3
    * @since 2.0.0 */ public abstract class AbstractSVGParser extends CodeParser { /** * The constructor. * @param code The path to parse. */ public AbstractSVGParser(String code) { super(code); } @Override public boolean isComment() { return false; } @Override public boolean isWSP() { int c = getChar(); return c==0x20 || c==0x9 || c==0xD || c==0xA; } @Override public void skipWSP() { while(!isEOC() && isWSP()) nextChar(); } /** * Skips the useless characters and a possible comma. * @since 0.1 */ public void skipWSPComma() { skipWSP(); if(getChar()==',') { nextChar(); skipWSP(); } } @Override public String skipComment() { return null; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/parsers/SVGLengthParser.java0000644000000000000000000001573411347255510023223 0ustar package latexDraw.parsers.svg.parsers; import java.text.ParseException; import latexDraw.parsers.svg.SVGLength; import latexDraw.parsers.svg.SVGLength.LengthType; /** * Defines a parser that parses SVG length code.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/24/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGLengthParser extends SVGNumberParser { /** * Describes textual value for the font-size attribute. * @author Arnaud BLOUIN */ public static enum FontSize { XXSMALL { @Override public float getPointValue() { return XSMALL.getPointValue()/SCALING_FACTOR; } @Override public String getToken() { return "xx-small"; } }, XSMALL { @Override public float getPointValue() { return SMALL.getPointValue()/SCALING_FACTOR; } @Override public String getToken() { return "x-small"; } }, SMALL { @Override public float getPointValue() { return MEDIUM.getPointValue()/SCALING_FACTOR; } @Override public String getToken() { return "small"; } }, MEDIUM { @Override public float getPointValue() { return 12f; } @Override public String getToken() { return "medium"; } }, LARGE { @Override public float getPointValue() { return MEDIUM.getPointValue()*SCALING_FACTOR; } @Override public String getToken() { return "large"; } }, XLARGE { @Override public float getPointValue() { return LARGE.getPointValue()*SCALING_FACTOR; } @Override public String getToken() { return "x-large"; } }, XXLARGE { @Override public float getPointValue() { return XLARGE.getPointValue()*SCALING_FACTOR; } @Override public String getToken() { return "xx-large"; } }; /** * @return The value in point of the token. */ public abstract float getPointValue(); /** * @return The token of the current font-size used in SVG documents. */ public abstract String getToken(); /** * @param token The token to test. * @return The value in point of the font-size given as argument, or -1 * if 'token' is not valid. */ public static float getFontSize(String token) { if(token==null) return -1f; if(token.equals(XXSMALL.getToken())) return XXSMALL.getPointValue(); if(token.equals(XSMALL.getToken())) return XSMALL.getPointValue(); if(token.equals(SMALL.getToken())) return SMALL.getPointValue(); if(token.equals(MEDIUM.getToken())) return MEDIUM.getPointValue(); if(token.equals(LARGE.getToken())) return LARGE.getPointValue(); if(token.equals(XLARGE.getToken())) return XLARGE.getPointValue(); if(token.equals(XXLARGE.getToken())) return XXLARGE.getPointValue(); return -1f; } public static final float SCALING_FACTOR=1.2f; } /** * Converts the font-size string value in point value. * @param fontSize The font-size value to convert. * @return the font-size value in point, or -1 if a * problem occurs. */ public static float fontSizetoPoint(String fontSize) { if(fontSize==null) return -1f; float value; try { value = Double.valueOf(fontSize).floatValue(); }catch(NumberFormatException e) { try { SVGLength lgth = new SVGLengthParser(fontSize).parseLength(); value = (float)UnitProcessor.toPoint(lgth.getValue(), lgth.getLengthType()); } catch(ParseException ex) { value = FontSize.getFontSize(fontSize); } } return value; } /** * The constructor. * @param code The code to parse. * @since 0.1 */ public SVGLengthParser(String code) { super(code); } /** * Parses an SVG length. * @return An SVGLength. * @throws ParseException If a problem occurs or if not managed unit are parsed (%, em and ex). * @since 0.1 */ public SVGLength parseLength() throws ParseException { double value = parseNumber(false); LengthType lgthType; String errorUnit = "Invalid unit", valueAsStr;//$NON-NLS-1$ setPosition(0); valueAsStr = parseNumberAsString(false); skipWSP(); switch(getChar()) { case EOC: lgthType = LengthType.NUMBER; break; case 'p': switch(nextChar()) { case EOC: default: throw new ParseException(errorUnit, getPosition()); case 't': lgthType = LengthType.PT; break; case 'x': lgthType = LengthType.PX; break; case 'c': lgthType = LengthType.PC; break; } break; case '%': throw new ParseException("Not yet managed: %", getPosition());//$NON-NLS-1$ case 'c': if(nextChar()=='m') lgthType = LengthType.CM; else throw new ParseException(errorUnit, getPosition()); break; case 'm': if(nextChar()=='m') lgthType = LengthType.MM; else throw new ParseException(errorUnit, getPosition()); break; case 'i': if(nextChar()=='n') lgthType = LengthType.IN; else throw new ParseException(errorUnit, getPosition()); break; case 'e': switch(nextChar()) { case EOC: default: throw new ParseException(errorUnit, getPosition()); case 'm': throw new ParseException("Not yet managed: em", getPosition());//$NON-NLS-1$ case 'x': throw new ParseException("Not yet managed: ex", getPosition());//$NON-NLS-1$ } default: throw new ParseException(errorUnit, getPosition()); } return new SVGLength(UnitProcessor.toUserUnit(value, lgthType), LengthType.PX, valueAsStr); } /** * Parses an SVG coordinate. * @return An SVGLength. * @throws ParseException If a problem occurs or if not managed unit are parsed (%, em and ex). * @since 0.1 */ public SVGLength parseCoordinate() throws ParseException { return parseLength(); } /** * Parses a number or a percentage (not yet managed). * @return An SVGLength. * @throws ParseException If a problem occurs or if a percentage is parsed. * @since 0.1 */ public SVGLength parseNumberOrPercent() throws ParseException { double value = parseNumber(false); LengthType type; String valueAsStr; setPosition(0); valueAsStr = parseNumberAsString(false); skipWSP(); switch(getChar()) { default: case EOC: type = LengthType.NUMBER; break; case '%': throw new ParseException("Not yet managed: %", getPosition());//$NON-NLS-1$ } return new SVGLength(UnitProcessor.toUserUnit(value, type), type, valueAsStr); } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/parsers/CSSStyleHandler.java0000644000000000000000000000174111347255510023205 0ustar package latexDraw.parsers.svg.parsers; /** * Defines the model of a CSS style handler.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/24/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public interface CSSStyleHandler { /** * Actions to do when a CSS style is parsed. * @param name The name of the style. * @param value The value of the style. * @since 0.1 */ public void onCSSStyle(String name, String value); } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/parsers/SVGNumberParser.java0000644000000000000000000000744211347255510023227 0ustar package latexDraw.parsers.svg.parsers; import java.text.ParseException; /** * Defines a SVG number parser.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/20/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGNumberParser extends AbstractSVGParser { /** * The constructor. * @param code The code to parse. */ public SVGNumberParser(String code) { super(code); } /** * Parses a flag (a boolean). * @return True or false. * @throws ParseException If an error occurs. * @since 0.1 */ public boolean parseFlag() throws ParseException { skipWSP(); int c = getChar(); if(c=='0' || c=='1') { boolean flag = c=='1' ? true : false; nextChar(); return flag; } throw new ParseException("Flag expected.", getPosition()); //$NON-NLS-1$ } /** * Parses a number (a double). * @param unsigned True: the parsed number must be unsigned. * @return The parsed number as a string. * @throws ParseException If an error occurs or if the parsed number is signed and unsigned is true. * @since 0.1 */ public String parseNumberAsString(boolean unsigned) throws ParseException { boolean again = true; int c, start; skipWSP(); start = getPosition(); c = getChar(); if(c=='-' || c=='+')// Reading the sign { if(unsigned) throw new ParseException("Unsigned number expected.", getPosition());//$NON-NLS-1$ c = nextChar(); } while(again && !isEOC()) // Reading the first part of the number. if(c<48 || c>58) again = false; else c = nextChar(); if(c=='.') { c = nextChar(); again = true; while(again && !isEOC()) // Reading the second part of the number. if(c<48 || c>58) again = false; else c = nextChar(); } if(c=='E' || c=='e')// Reading the exponent. { c = nextChar(); again = true; if(c=='-' || c=='+')// Reading the sign c = nextChar(); while(again && !isEOC()) // Reading the exponent. if(c<48 || c>58) again = false; else c = nextChar(); } try { Double.valueOf(getCode().substring(start, getPosition())); } catch(NumberFormatException e) { throw new ParseException("Invalid number.", getPosition()); }//$NON-NLS-1$ return getCode().substring(start, getPosition()); } /** * Parses a number (a double). * @param unsigned True: the parsed number must be unsigned. * @return The parsed number. * @throws ParseException If an error occurs or if the parsed number is signed and unsigned is true. * @since 0.1 */ public double parseNumber(boolean unsigned) throws ParseException { String number = parseNumberAsString(unsigned); try { return Double.valueOf(number); } catch(NumberFormatException e) { throw new ParseException("Invalid number.", getPosition()); }//$NON-NLS-1$ } /** * @return True if the current character is the beginning of a number. * @param unsigned True: the next number must not have a sign. * @since 0.1 */ protected boolean isNumber(boolean unsigned) { int c = getChar(); if(unsigned) return c=='.' || (c>=48 && c<=57); return c=='-' || c=='+' || c=='.' || (c>=48 && c<=57); } @Override public void parse() throws ParseException { // Nothing to do. } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/parsers/CSSStyleParser.java0000644000000000000000000000466111347255510023070 0ustar package latexDraw.parsers.svg.parsers; import java.text.ParseException; import latexDraw.parsers.css.AbstractCSSParser; /** * Defines a parser that parses a SVG CSS style attribute.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/24/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public class CSSStyleParser extends AbstractCSSParser { /** The handler which will manage actions to do when a CSS style is parsed. @since 0.1 */ protected CSSStyleHandler handler ; /** * The constructor. * @param code The code to parse (must not be null). * @param handler The CSS style handler. * @since 0.1 */ public CSSStyleParser(String code, CSSStyleHandler handler) { super(code); if(handler==null) throw new IllegalArgumentException(); this.handler = handler; } @Override public void parse() throws ParseException { StringBuffer name = new StringBuffer(); StringBuffer value = new StringBuffer(); skipWSPComments(); while(!isEOC()) { while(getChar()!=':' && !isWSP() && !isEOC() && !isComment()) { name.append((char)getChar()); nextChar(); } skipWSPComments(); if(name.length()==0 || isEOC() || getChar()!=':') throw new ParseException("Invalid CSS style definition.", getPosition());//$NON-NLS-1$ nextChar(); skipWSPComments(); while(getChar()!=';' && !isEOC() && !isComment()) { if(!isWSP()) value.append((char)getChar()); nextChar(); } if(value.length()==0) throw new ParseException("value expected but not found.", getPosition());//$NON-NLS-1$ handler.onCSSStyle(name.toString(), value.toString()); name.delete(0, name.length()); value.delete(0, value.length()); skipWSPComments(); if(!isEOC() && getChar()!=';') throw new ParseException("token ';' expected but not found.", getPosition());//$NON-NLS-1$ nextChar(); skipWSPComments(); }//while } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/parsers/SVGPathHandler.java0000644000000000000000000000175711347255510023017 0ustar package latexDraw.parsers.svg.parsers; import latexDraw.parsers.svg.elements.path.SVGPathSeg; /** * Defines the model of a SVGPath handler.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/20/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public interface SVGPathHandler { /** * Actions to do when a SVGPath is parsed and created. * @param pathSeg The parsed SVGPath. * @since 0.1 */ public void onPathSeg(SVGPathSeg pathSeg); } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/parsers/URIReferenceParser.java0000644000000000000000000000346511347255510023676 0ustar package latexDraw.parsers.svg.parsers; import java.text.ParseException; /** * Defines a parser that parses URI references.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 11/21/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class URIReferenceParser extends AbstractSVGParser { /** The parsed URI. */ protected String uri; /** * Creates a parser. * @param code The code to parse. */ public URIReferenceParser(String code) { super(code); } /** * Reads a URI reference string from an url(#ref) attribute - such as url(#id123) - returns the extracted reference (id123). * @return The parsed reference or an empty string if the format of the code is not valid (not "url(#ref)") * @since 0.1 */ public String getURI() { String str = "";//$NON-NLS-1$ skipWSP(); if(getChar()=='u' && nextChar()=='r' && nextChar()=='l' && nextChar()=='(') { nextChar(); skipWSP(); if(getChar()=='#') { while(nextChar()!=')' && !isEOC()) str += (char)getChar(); if(getChar()!=')') str = "";//$NON-NLS-1$ } } return str; } @Override public void parse() throws ParseException { uri = getURI(); } /** * @return The parsed URI. * @since 2.0.3 */ public String getUri() { return uri; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/parsers/UnitProcessor.java0000644000000000000000000000502611347255510023055 0ustar package latexDraw.parsers.svg.parsers; import latexDraw.parsers.svg.SVGLength.LengthType; /** * This processor manages and transforms value in different units.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/24/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class UnitProcessor { /** * Transforms a value in point according to the given unit (%, em and ex are not managed). * @param value The value to transform. * @param lgthType The type of the value. * @return The value in point. * @throws IllegalArgumentException If the given length type is not valid or not managed. * @since 0.1 */ public static double toPoint(double value, LengthType lgthType) { if(lgthType==null) throw new IllegalArgumentException(); if(lgthType==LengthType.PT) return value; return toUserUnit(value, lgthType)/1.25; } /** * Transforms a value in the user unit (in pixels) according to the given unit (%, em and ex are not managed). * @param value The value to transform. * @param lgthType The type of the value. * @return The value in the user unit (in pixels). * @throws IllegalArgumentException If the given length type is not valid or not managed. * @since 0.1 */ public static double toUserUnit(double value, LengthType lgthType) { if(lgthType==null) throw new IllegalArgumentException(); double userValue; switch(lgthType) { case CM: userValue = value * 35.43307; break; case IN: userValue = value * 90.; break; case MM: userValue = value * 3.543307; break; case PC: userValue = value * 15.; break; case PT: userValue = value * 1.25; break; case EM: case EX: case PERCENTAGE: throw new IllegalArgumentException("Not yet managed.");//$NON-NLS-1$ case NUMBER: case PX: case UNKNOWN: userValue = value ; break; default: throw new IllegalArgumentException("Invalid length type.");//$NON-NLS-1$ } return userValue; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/parsers/SVGPointsParser.java0000644000000000000000000000700511347255510023246 0ustar package latexDraw.parsers.svg.parsers; import java.awt.geom.Point2D; import java.text.ParseException; import java.util.Vector; /** * Defines a parser that parses points from polygons and polylines.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 12/04/08
    * @author Arnaud BLOUIN
    * @version 2.0.3
    * @since 2.0.3 */ public class SVGPointsParser extends AbstractSVGParser { /** The parsed points. */ protected Vector points; /** * Creates and initialises the parser. * @param code The code to parse. * @since 2.0.3 * @throws IllegalArgumentException If the given code is null. */ public SVGPointsParser(String code) { super(code); points = new Vector(); } /** * Parses the given code and return the parsed points or null. * @param code The code to parse. * @return The parsed points or null. * @since 2.0.3 */ public static Vector getPoints(String code) { try { SVGPointsParser pp = new SVGPointsParser(code); pp.parse(); return pp.getPoints(); } catch(Exception e) { return null; } } @Override public void parse() throws ParseException { double c1, c2; skipWSP(); while(!isEOC()) { c1 = readNumber(); skipWSPComma(); c2 = readNumber(); points.add(new Point2D.Double(c1, c2)); skipWSPComma(); } } /** * Reads a number. * @return The read number. * @throws ParseException If the number is not valid. * @since 2.0.3 */ public double readNumber() throws ParseException { double n; boolean isNegative; boolean isFractional = false; boolean isFloating = false; StringBuffer strn = new StringBuffer(); skipWSP(); if(getChar()=='-' || getChar()=='+') { isNegative = getChar()=='-'; nextChar(); } else isNegative = false; while(!isWSP() & getChar()!=',' && !isEOC()) { switch(getChar()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; case '.': if(isFractional) throw new ParseException("An unexpected dot was read: "+getCode(), getPosition()); isFractional = true; break; case 'e': case 'E': if(isFloating) throw new ParseException("An unexpected exponantial token was read: "+getCode(), getPosition()); isFloating = true; break; case '-': case '+': if(!isFloating) throw new ParseException("An unexpected sign was read: "+getCode(), getPosition()); break; default: throw new ParseException("The following character is not authorised:" + (char)getChar(), getPosition()); } strn.append((char)getChar()); nextChar(); } try { n = Double.valueOf(strn.toString()); } catch(Exception e) { throw new ParseException("Not able to parse to given number:" + strn.toString(), getPosition()); } return isNegative ? n*-1 : n; } /** * @return The points. * @since 2.0.3 */ public Vector getPoints() { return points; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/SVGNodeList.java0000644000000000000000000000314311347255510020656 0ustar package latexDraw.parsers.svg; import java.util.Vector; import latexDraw.parsers.svg.elements.SVGElement; import org.w3c.dom.NodeList; /** * Defines an SVG node list.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/16/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public class SVGNodeList implements NodeList { /** The nodes of the list. @since 0.1 */ protected Vector nodes; /** * The constructor by default. */ public SVGNodeList() { nodes = new Vector(); } public int getLength() { return nodes==null ? 0 : nodes.size(); } public SVGElement item(int index) { return nodes==null || index<0 || index>=nodes.size() ? null : nodes.elementAt(index); } @Override public String toString() { StringBuffer str = new StringBuffer().append("{");//$NON-NLS-1$ for(SVGElement e : nodes) str.append(e.toString()).append(", ");//$NON-NLS-1$ return str.append("}").toString();//$NON-NLS-1$ } /** * @return the nodes. * @since 0.1 */ public Vector getNodes() { return nodes; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/SVGMatrix.java0000644000000000000000000001151011347255510020376 0ustar package latexDraw.parsers.svg; /** * Defines a matrix according to the SVG specifications.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/16/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1
    */ public class SVGMatrix { public static final short WIDTH = 3; public static final short HEIGHT = 3; /** [a, c, e, b, d, f, 0, 0, 1] An element of the matrix. */ protected double a; /** [a, c, e, b, d, f, 0, 0, 1] An element of the matrix. */ protected double b; /** [a, c, e, b, d, f, 0, 0, 1] An element of the matrix. */ protected double c; /** [a, c, e, b, d, f, 0, 0, 1] An element of the matrix. */ protected double d; /** [a, c, e, b, d, f, 0, 0, 1] An element of the matrix. */ protected double e; /** [a, c, e, b, d, f, 0, 0, 1] An element of the matrix. */ protected double f; /** * Creates a matrix by initialising it as the identity. * @since 0.1 */ public SVGMatrix() { initMatrix(); } /** * Initialises the matrix as the identity. * @since 0.1 */ public void initMatrix() { a = d = 1; b = c = e = f = 0; } /** * Rotates the matrix (without reinitialisation). * @param angle The angle of rotation (in radian). * @since 0.1 */ public void rotate(double angle) { a = Math.cos(angle); b = Math.sin(angle); c = -Math.sin(angle); d = Math.cos(angle); } /** * Translates the matrix (without reinitialisation). * @param x The x translation. * @param y The y translation. * @since 0.1 */ public void translate(double x, double y) { e = x; f = y; } /** * Scales the matrix (without reinitialisation). * @param scaleFactor The scale factor. * @since 0.1 */ public void scale(double scaleFactor) { scaleNonUniform(scaleFactor, scaleFactor); } /** * Scales the matrix (without reinitialisation). * @param scaleFactorX The x scale factor. * @param scaleFactorY The y scale factor. * @since 0.1 */ public void scaleNonUniform(double scaleFactorX, double scaleFactorY) { a = scaleFactorX; d = scaleFactorY; } /** * Skews the matrix (without reinitialisation). * @param angle The X angle. * @since 0.1 */ public void skewX(double angle) { c = Math.tan(angle); } /** * Skews the matrix (without reinitialisation). * @param angle The Y angle. * @since 0.1 */ public void skewY(double angle) { b = Math.tan(angle); } /** * @param m The matrix to multiply to the called matrix: this * m = out. Or null if m is null. * @return Creates a SVGMatrix from the multiplication of the two given matrixes. */ public SVGMatrix multiply(SVGMatrix m) { if(m==null) return null; SVGMatrix out = new SVGMatrix(); out.a = a*m.a + c*m.b; out.b = b*m.a + d*m.b; out.c = a*m.c + c*m.d; out.d = b*m.c + d*m.d; out.e = a*m.e + c*m.f + e; out.f = b*m.e + d*m.f + f; return out; } /** * Sets the matrix with the given values. * @param a b c d e f The values of the matrix: [a, c, e, b, d, f, 0, 0, 1]. * @since 0.1 */ public void setMatrix(double a, double b, double c, double d, double e, double f) { this.a = a; this.b = b; this.c = c; this.d = d; this.e = e; this.f = f; } /** * @return The (0,0) element of the matrix. * @since 0.1 */ public double getA() { return a; } /** * @return The (1,0) element of the matrix. * @since 0.1 */ public double getB() { return b; } /** * @return The (2,0) element of the matrix. * @since 0.1 */ public double getC() { return c; } /** * @return The (0,1) element of the matrix. * @since 0.1 */ public double getD() { return d; } /** * @return The (1,1) element of the matrix. * @since 0.1 */ public double getE() { return e; } /** * @return The (2,1) element of the matrix. * @since 0.1 */ public double getF() { return f; } @Override public String toString() { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(a); stringBuffer.append(" "); //$NON-NLS-1$ stringBuffer.append(c); stringBuffer.append(" "); //$NON-NLS-1$ stringBuffer.append(e); stringBuffer.append(" "); //$NON-NLS-1$ stringBuffer.append(b); stringBuffer.append(" "); //$NON-NLS-1$ stringBuffer.append(d); stringBuffer.append(" "); //$NON-NLS-1$ stringBuffer.append(f); return stringBuffer.toString(); } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/SVGElements.java0000644000000000000000000001566211347255510020722 0ustar package latexDraw.parsers.svg; /** * Contains SVG elements according to the SVG specification version 1.1.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 06/03/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 2.0.0
    */ public abstract class SVGElements { public static final String SVG_CIRCLE = "circle"; //$NON-NLS-1$ public static final String SVG_DEFS = "defs"; //$NON-NLS-1$ // public static final String SVG_DESC = "desc"; //$NON-NLS-1$ // public static final String SVG_CLIP_PATH = "clipPath"; //$NON-NLS-1$ public static final String SVG_ELLIPSE = "ellipse"; //$NON-NLS-1$ // public static final String SVG_FONT = "font"; //$NON-NLS-1$ // public static final String SVG_FONT_FACE = "font-face"; //$NON-NLS-1$ // public static final String SVG_FONT_FACE_FORMAT = "font-face-format"; //$NON-NLS-1$ // public static final String SVG_FONT_FACE_NAME = "font-face-name"; //$NON-NLS-1$ public static final String SVG_G = "g"; //$NON-NLS-1$ public static final String SVG_METADATA = "metadata"; //$NON-NLS-1$ public static final String SVG_POLYGON = "polygon"; //$NON-NLS-1$ public static final String SVG_POLY_LINE = "polyline"; //$NON-NLS-1$ public static final String SVG_LINEAR_GRADIENT = "linearGradient"; //$NON-NLS-1$ public static final String SVG_RECT = "rect"; //$NON-NLS-1$ public static final String SVG_TEXT = "text"; //$NON-NLS-1$ // public static final String SVG_TEXT_PATH = "textPath"; //$NON-NLS-1$ public static final String SVG_SVG = "svg"; //$NON-NLS-1$ public static final String SVG_STOP = "stop"; //$NON-NLS-1$ public static final String SVG_PATTERN = "pattern"; //$NON-NLS-1$ public static final String SVG_PATH = "path"; //$NON-NLS-1$ public static final String SVG_USE = "use"; //$NON-NLS-1$ public static final String SVG_MARKER = "marker"; //$NON-NLS-1$ public static final String SVG_LINE = "line"; //$NON-NLS-1$ public static final String SVG_IMAGE = "image"; //$NON-NLS-1$ // public static final String SVG_RADIAL_GRADIENT = "radialGradient"; //$NON-NLS-1$ // public static final String SVG_A = "a"; //$NON-NLS-1$ // public static final String SVG_ALT_GLYPH = "altGlyph"; //$NON-NLS-1$ // public static final String SVG_ALT_GLYPH_DEF = "altGlyphDef"; //$NON-NLS-1$ // public static final String SVG_ALT_GLYPH_ITEM = "altGlyphItem"; //$NON-NLS-1$ // public static final String SVG_ANIMATE = "animate"; //$NON-NLS-1$ // public static final String SVG_ANIMATE_COLOR = "animateColor"; //$NON-NLS-1$ // public static final String SVG_ANIMATE_MOTION = "animateMotion"; //$NON-NLS-1$ // public static final String SVG_ANIMATE_TRANSFORM = "animateTransform"; //$NON-NLS-1$ // public static final String SVG_COLOR_PROFILE = "color-profile"; //$NON-NLS-1$ // public static final String SVG_CURSOR = "cursor"; //$NON-NLS-1$ // public static final String SVG_DEFINITION_SRC = "definition-src"; //$NON-NLS-1$ // public static final String SVG_FE_BLEND = "feBlend"; //$NON-NLS-1$ // public static final String SVG_FE_COLOR_MATRIX = "feColorMatrix"; //$NON-NLS-1$ // public static final String SVG_FE_COMPONENT_TRANSFER= "feComponentTransfer"; //$NON-NLS-1$ // public static final String SVG_FE_COMPOSITE = "feComposite"; //$NON-NLS-1$ // public static final String SVG_FE_CONVOLVE_MATRIX = "feConvolveMatrix"; //$NON-NLS-1$ // public static final String SVG_FE_DIFFUSE_LIGHTING = "feDiffuseLighting"; //$NON-NLS-1$ // public static final String SVG_FE_DISPLACEMENT_MAP = "feDisplacementMap"; //$NON-NLS-1$ // public static final String SVG_FE_DISTANT_LIGHT = "feDistantLight"; //$NON-NLS-1$ // public static final String SVG_FE_FLOOD = "feFlood"; //$NON-NLS-1$ // public static final String SVG_FE_FUNC_A = "feFuncA"; //$NON-NLS-1$ // public static final String SVG_FE_FUNC_B = "feFuncB"; //$NON-NLS-1$ // public static final String SVG_FE_FUNC_R = "feFuncR"; //$NON-NLS-1$ // public static final String SVG_FE_FUNC_G = "feFuncG"; //$NON-NLS-1$ // public static final String SVG_FE_GAUSSIAN_BLUR = "feGaussianBlur"; //$NON-NLS-1$ // public static final String SVG_FE_IMAGE = "feImage"; //$NON-NLS-1$ // public static final String SVG_FE_MERGE = "feMerge"; //$NON-NLS-1$ // public static final String SVG_FE_MERGE_NODE = "feMergeNode"; //$NON-NLS-1$ // public static final String SVG_FE_MORPHOLOGY = "feMorphology"; //$NON-NLS-1$ // public static final String SVG_FE_OFFSET = "feOffset"; //$NON-NLS-1$ // public static final String SVG_FE_POINT_LIGHT = "fePointLight"; //$NON-NLS-1$ // public static final String SVG_FE_SPECULAR_LIGHTING = "feSpecularLighting"; //$NON-NLS-1$ // public static final String SVG_FE_SPOT_LIGHT = "feSpotLight"; //$NON-NLS-1$ // public static final String SVG_FE_TILE = "feTile"; //$NON-NLS-1$ // public static final String SVG_FE_TURBULENCE = "feTurbulence"; //$NON-NLS-1$ // public static final String SVG_FILTER = "filter"; //$NON-NLS-1$ // public static final String SVG_FONT_FACE_SRC = "font-face-src"; //$NON-NLS-1$ // public static final String SVG_FONT_FACE_URI = "font-face-uri"; //$NON-NLS-1$ // public static final String SVG_FOREIGN_OBJECT = "foreignObject"; //$NON-NLS-1$ // public static final String SVG_GLYPH = "glyph"; //$NON-NLS-1$ // public static final String SVG_GLYPH_REF = "glyphRef"; //$NON-NLS-1$ // public static final String SVG_HKERN = "hkern"; //$NON-NLS-1$ // public static final String SVG_MASK = "mask"; //$NON-NLS-1$ // public static final String SVG_MISSING_GLYPH = "missing-glyph"; //$NON-NLS-1$ // public static final String SVG_MPATH = "mpath"; //$NON-NLS-1$ // public static final String SVG_SCRIPT = "script"; //$NON-NLS-1$ // public static final String SVG_SET = "set"; //$NON-NLS-1$ // public static final String SVG_STYLE = "style"; //$NON-NLS-1$ // public static final String SVG_SWITCH = "switch"; //$NON-NLS-1$ // public static final String SVG_SYMBOL = "symbol"; //$NON-NLS-1$ // public static final String SVG_TITLE = "title"; //$NON-NLS-1$ // public static final String SVG_TREF = "tref"; //$NON-NLS-1$ // public static final String SVG_TSPAN = "tspan"; //$NON-NLS-1$ // public static final String SVG_VIEW = "view"; //$NON-NLS-1$ // public static final String SVG_VKERN = "vkern"; //$NON-NLS-1$ } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/MalformedSVGDocument.java0000644000000000000000000000167711347255510022554 0ustar package latexDraw.parsers.svg; /** * Defines the exception to use when an SVG document is malformed.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/11/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public class MalformedSVGDocument extends Exception { private static final long serialVersionUID = 1L; @Override public String toString() { return "The SVG document is malformed.";//$NON-NLS-1$ } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/CSSStyleList.java0000644000000000000000000000274711347255510021073 0ustar package latexDraw.parsers.svg; import java.util.HashMap; import latexDraw.parsers.svg.parsers.CSSStyleHandler; /** * Defines a list of CSS styles.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/24/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public class CSSStyleList extends HashMap implements CSSStyleHandler { private static final long serialVersionUID = 1L; /** * Adds a CSS style to the list. * @param name The name of the style. * @param value The value of the style. * @since 0.1 */ public void addCSSStyle(String name, String value) { if(name!=null && value!=null) put(name, value); } /** * @param styleName The name of the style. * @return The value of the given CSS style name or null. */ public String getCSSValue(String styleName) { return get(styleName); } public void onCSSStyle(String name, String value) { if(name!=null && value!=null) addCSSStyle(name, value); } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/SVGLength.java0000644000000000000000000000424111347255510020356 0ustar package latexDraw.parsers.svg; /** * Defines an SVG length implementation.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/24/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGLength { public static enum LengthType { UNKNOWN, NUMBER, PERCENTAGE, EM, EX, PX, CM, MM, IN, PT, PC } /** The value of the length in the user space. @since 0.1 */ protected double value; /** The type of the length. @since 0.1 */ protected LengthType lengthType; /** The original parsed length value (without the length token). @since 0.1 */ protected String valueAsString; /** * Builds an SVGLength. * @param value The value of the length in the user space. * @param lengthType The type of the length. * @param valueAsString The original parsed length value (without the length token). * @since 0.1 */ public SVGLength(double value, LengthType lengthType, String valueAsString) { if(lengthType==null || valueAsString==null) throw new IllegalArgumentException(); try{ Double.valueOf(valueAsString); } catch(NumberFormatException e){ throw new IllegalArgumentException(); } this.value = value; this.lengthType = lengthType; this.valueAsString = valueAsString; } /** * @return the value * @since 0.1 */ public double getValue() { return value; } /** * @return the lengthType * @since 0.1 */ public LengthType getLengthType() { return lengthType; } /** * @return the valueAsString * @since 0.1 */ public String getValueAsString() { return valueAsString; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/SVGComment.java0000644000000000000000000000212111347255510020532 0ustar package latexDraw.parsers.svg; import org.w3c.dom.Comment; import org.w3c.dom.Node; /** * Defines a comment node.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/31/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public class SVGComment extends SVGText implements Comment { public SVGComment(String comment, SVGDocument owner) { super(comment, owner); } @Override public short getNodeType() { return Node.COMMENT_NODE; } @Override public String getNodeName() { return "#comment";//$NON-NLS-1$ } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/SVGCDATASection.java0000644000000000000000000000206011347255510021273 0ustar package latexDraw.parsers.svg; import org.w3c.dom.CDATASection; import org.w3c.dom.Node; /** * Defines a CDATA node.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/31/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public class SVGCDATASection extends SVGText implements CDATASection { public SVGCDATASection(String text, SVGDocument owner) { super(text, owner); setNodeName("#cdata-section");//$NON-NLS-1$ } @Override public short getNodeType() { return Node.CDATA_SECTION_NODE; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/SVGElementsFactory.java0000644000000000000000000000753111347255510022246 0ustar /* * SVGElementFactory.java */ package latexDraw.parsers.svg; import java.text.ParseException; import latexDraw.parsers.svg.elements.*; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; /** * This class must be used to create SVG elements.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/11/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public class SVGElementsFactory { /** * This factory can be used in order to create an SVG element according to the given SVG node (tag). * @param src The node that will be used to create the SVG element. * @return The created SVG element. * @since 0.1 */ public static SVGElement createSVGElement(Node src, SVGElement parent) { if(src==null || parent==null) return null; try { String name = src.getNodeName(); if(name==null) return null; String pref = src.getNodeName().contains(":") ? src.getNodeName().substring(0, src.getNodeName().indexOf(':')) : null;//$NON-NLS-1$ NamedNodeMap nnm = src.getAttributes(); String ns; if(nnm==null) ns = parent.lookupNamespaceURI(pref); else { Node xmlnsNode = nnm.getNamedItem(pref==null ? "xmlns" : "xmlns:"+pref);//$NON-NLS-1$//$NON-NLS-2$ if(xmlnsNode==null) ns = parent.lookupNamespaceURI(pref); else ns = xmlnsNode.getNodeValue(); } if(ns==null || name.endsWith("#text") || name.endsWith("#comment"))//$NON-NLS-1$//$NON-NLS-2$ return null; if(SVGDocument.SVG_NAMESPACE.equals(ns)) { if(name.endsWith(SVGElements.SVG_SVG)) return new SVGSVGElement(src, parent); else if(name.endsWith(SVGElements.SVG_G)) return new SVGGElement(src, parent); else if(name.endsWith(SVGElements.SVG_RECT)) return new SVGRectElement(src, parent); else if(name.endsWith(SVGElements.SVG_ELLIPSE)) return new SVGEllipseElement(src, parent); else if(name.endsWith(SVGElements.SVG_CIRCLE)) return new SVGCircleElement(src, parent); else if(name.endsWith(SVGElements.SVG_POLY_LINE)) return new SVGPolyLineElement(src, parent); else if(name.endsWith(SVGElements.SVG_LINE)) return new SVGLineElement(src, parent); else if(name.endsWith(SVGElements.SVG_POLYGON)) return new SVGPolygonElement(src, parent); else if(name.endsWith(SVGElements.SVG_METADATA)) return new SVGMetadataElement(src, parent); else if(name.endsWith(SVGElements.SVG_DEFS)) return new SVGDefsElement(src, parent); else if(name.endsWith(SVGElements.SVG_PATTERN)) return new SVGPatternElement(src, parent); else if(name.endsWith(SVGElements.SVG_LINEAR_GRADIENT)) return new SVGLinearGradientElement(src, parent); else if(name.endsWith(SVGElements.SVG_STOP)) return new SVGStopElement(src, parent); else if(name.endsWith(SVGElements.SVG_PATH)) return new SVGPathElement(src, parent); else if(name.endsWith(SVGElements.SVG_MARKER)) return new SVGMarkerElement(src, parent); else if(name.endsWith(SVGElements.SVG_TEXT)) return new SVGTextElement(src, parent); else if(name.endsWith(SVGElements.SVG_IMAGE)) return new SVGImageElement(src, parent); } else return new OtherNSElement(src, parent); } catch(MalformedSVGDocument ex) { ex.printStackTrace(); return null; } catch(ParseException ex) { ex.printStackTrace(); return null; } return null; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/0000755000000000000000000000000011347255510017525 5ustar latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/path/0000755000000000000000000000000011347255510020461 5ustar latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/path/SVGPathSegLineto.java0000644000000000000000000000414511347255510024416 0ustar package latexDraw.parsers.svg.elements.path; import java.awt.geom.Point2D; /** * Defines the SVGPath lineto segment.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/20/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGPathSegLineto extends SVGPathSeg { /** The X-coordinate of the second point of the line. @since 0.1 */ protected double x; /** The Y-coordinate of the second point of the line. @since 0.1 */ protected double y; /** * The main constructor. * @param x The X-coordinate of the second point of the line. * @param y The Y-coordinate of the second point of the line. * @param isRelative isRelative True: the path segment is relative, false it is absolute. */ public SVGPathSegLineto(double x, double y, boolean isRelative) { super(isRelative); this.x = x; this.y = y; } /** * @return the x. * @since 0.1 */ public double getX() { return x; } /** * @return the y. * @since 0.1 */ public double getY() { return y; } /** * @return The position of the segment. * @since 0.1 */ public Point2D getPoint() { return new Point2D.Double(x, y); } @Override public PathSeg getType() { return isRelative() ? PathSeg.LINETO_REL : PathSeg.LINETO_ABS; } @Override public String toString() { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append((isRelative() ? "l" : "L"));//$NON-NLS-1$//$NON-NLS-2$ stringBuffer.append(' '); stringBuffer.append(x); stringBuffer.append(' '); stringBuffer.append(y); return stringBuffer.toString(); } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/path/SVGPathSegClosePath.java0000644000000000000000000000203711347255510025044 0ustar package latexDraw.parsers.svg.elements.path; /** * Defines the SVGPath closepath segment.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/20/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGPathSegClosePath extends SVGPathSeg { /** * The constructor. * @since 0.1 */ public SVGPathSegClosePath() { super(true); } @Override public String toString() { return "z";//$NON-NLS-1$ } @Override public PathSeg getType() { return PathSeg.CLOSEPATH; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/path/SVGPathSegCurvetoCubicSmooth.java0000644000000000000000000000516711347255510026760 0ustar package latexDraw.parsers.svg.elements.path; /** * Defines the SVGPath smooth curveto segment.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/20/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGPathSegCurvetoCubicSmooth extends SVGPathSeg { /** The X-coordinate of the second point of the curve. @since 0.1 */ protected double x; /** The Y-coordinate of the second point of the curve. @since 0.1 */ protected double y; /** The x-coordinate of the second control point. @since 0.1 */ protected double x2; /** The y-coordinate of the second control point. @since 0.1 */ protected double y2; /** * The main constructor. * @param x The X-coordinate of the second point of the curve. * @param y The Y-coordinate of the second point of the curve. * @param x2 The x-coordinate of the second control point. * @param y2 The y-coordinate of the second control point. * @param isRelative isRelative True: the path segment is relative, false it is absolute. */ public SVGPathSegCurvetoCubicSmooth(double x, double y, double x2, double y2, boolean isRelative) { super(isRelative); this.x = x; this.y = y; this.x2 = x2; this.y2 = y2; } @Override public String toString() { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append((isRelative() ? "s" : "S"));//$NON-NLS-1$//$NON-NLS-2$ stringBuffer.append(' '); stringBuffer.append(x2); stringBuffer.append(' '); stringBuffer.append(y2); stringBuffer.append(' '); stringBuffer.append(x); stringBuffer.append(' '); stringBuffer.append(y); return stringBuffer.toString(); } /** * @return the x. * @since 0.1 */ public double getX() { return x; } /** * @return the y. * @since 0.1 */ public double getY() { return y; } /** * @return the x2. * @since 0.1 */ public double getX2() { return x2; } /** * @return the y2. * @since 0.1 */ public double getY2() { return y2; } @Override public PathSeg getType() { return isRelative() ? PathSeg.CURVETO_CUBIC_SMOOTH_REL : PathSeg.CURVETO_CUBIC_SMOOTH_ABS; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/path/SVGPathSegCurvetoQuadraticSmooth.java0000644000000000000000000000402611347255510027641 0ustar package latexDraw.parsers.svg.elements.path; /** * Defines the SVGPath quadratic smooth curveto segment.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/20/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGPathSegCurvetoQuadraticSmooth extends SVGPathSeg { /** The X-coordinate of the second point of the curve. @since 0.1 */ protected double x; /** The Y-coordinate of the second point of the curve. @since 0.1 */ protected double y; /** * The main constructor. * @param x The X-coordinate of the second point of the curve. * @param y The Y-coordinate of the second point of the curve. * @param isRelative isRelative True: the path segment is relative, false it is absolute. */ public SVGPathSegCurvetoQuadraticSmooth(double x, double y, boolean isRelative) { super(isRelative); this.x = x; this.y = y; } @Override public String toString() { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append((isRelative() ? "t" : "T"));//$NON-NLS-1$//$NON-NLS-2$ stringBuffer.append(' '); stringBuffer.append(x); stringBuffer.append(' '); stringBuffer.append(y); return stringBuffer.toString(); } @Override public PathSeg getType() { return isRelative() ? PathSeg.CURVETO_QUADRATIC_SMOOTH_REL : PathSeg.CURVETO_QUADRATIC_SMOOTH_ABS; } /** * @return the x. * @since 0.1 */ public double getX() { return x; } /** * @return the y. * @since 0.1 */ public double getY() { return y; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/path/SVGPathSegLinetoHorizontal.java0000644000000000000000000000305711347255510026471 0ustar package latexDraw.parsers.svg.elements.path; /** * Defines the SVGPath horizontal lineto segment.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/20/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGPathSegLinetoHorizontal extends SVGPathSegLineto { /** * The main constructor. * @param x The X-coordinate of the second point of the line. * @param isRelative isRelative True: the path segment is relative, false it is absolute. */ public SVGPathSegLinetoHorizontal(double x, boolean isRelative) { super(x, x, isRelative); } @Override public String toString() { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append((isRelative() ? "h" : "H"));//$NON-NLS-1$//$NON-NLS-2$ stringBuffer.append(' '); stringBuffer.append(x); return stringBuffer.toString() ; } @Override public PathSeg getType() { return isRelative() ? PathSeg.LINETO_HORIZONTAL_REL : PathSeg.LINETO_HORIZONTAL_ABS; } @Override public double getY() { return getX(); } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/path/SVGPathSegMoveto.java0000644000000000000000000000273511347255510024440 0ustar package latexDraw.parsers.svg.elements.path; /** * Defines the SVGPath moveto segment.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/20/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGPathSegMoveto extends SVGPathSegLineto { /** * The main constructor. * @param x The X-coordinate of the point to go. * @param y The Y-coordinate of the point to go. * @param isRelative */ public SVGPathSegMoveto(double x, double y, boolean isRelative) { super(x, y, isRelative); } @Override public String toString() { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append((isRelative() ? "m" : "M"));//$NON-NLS-1$//$NON-NLS-2$ stringBuffer.append(' '); stringBuffer.append(x); stringBuffer.append(' '); stringBuffer.append(y); return stringBuffer.toString(); } @Override public PathSeg getType() { return isRelative() ? PathSeg.MOVETO_REL : PathSeg.MOVETO_ABS; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/path/SVGPathSeg.java0000644000000000000000000000374411347255510023247 0ustar package latexDraw.parsers.svg.elements.path; /** * Defines a model for the SVGPath segments.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/20/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public abstract class SVGPathSeg { public static enum PathSeg { UNKNOWN, CLOSEPATH, MOVETO_ABS, MOVETO_REL, LINETO_ABS, LINETO_REL, CURVETO_CUBIC_ABS, CURVETO_CUBIC_REL, CURVETO_QUADRATIC_ABS, CURVETO_QUADRATIC_REL, ARC_ABS, ARC_REL, LINETO_HORIZONTAL_ABS, LINETO_HORIZONTAL_REL, LINETO_VERTICAL_ABS, LINETO_VERTICAL_REL, CURVETO_CUBIC_SMOOTH_ABS, CURVETO_CUBIC_SMOOTH_REL, CURVETO_QUADRATIC_SMOOTH_ABS, CURVETO_QUADRATIC_SMOOTH_REL } /** Defines if the segment path is relative or absolute. @since 0.1 */ protected boolean isRelative; /** The type of the segment path. @since 0.1 */ protected PathSeg type; /** * The main constructor. * @param isRelative True: the path segment is relative, false it is absolute. * @since 0.1 */ public SVGPathSeg(boolean isRelative) { this.isRelative = isRelative; } /** * @return The type of the segment path. * @since 0.1 */ public abstract PathSeg getType(); /** * @return the isRelative. * @since 0.1 */ public boolean isRelative() { return isRelative; } /** * @param isRelative the isRelative to set. * @since 0.1 */ public void setRelative(boolean isRelative) { this.isRelative = isRelative; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/path/SVGPathSegArc.java0000644000000000000000000001351611347255510023673 0ustar package latexDraw.parsers.svg.elements.path; import java.awt.geom.Arc2D; /** * Defines the SVGPath arc segment.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/20/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGPathSegArc extends SVGPathSeg { /** The X-coordinate of the second point of the arc. @since 0.1 */ protected double x; /** The Y-coordinate of the second point of the arc. @since 0.1 */ protected double y; /** The x radius of the arc. @since 0.1 */ protected double rx; /** The y radius of the arc. @since 0.1 */ protected double ry; /** The x-axis rotation angle. @since 0.1 */ protected double angle; protected boolean largeArcFlag; protected boolean sweepFlag; /** * The main constructor. * @param x The X-coordinate of the second point of the arc. * @param y The Y-coordinate of the second point of the arc. * @param rx The x radius of the arc. * @param ry The y radius of the arc. * @param angle The x-axis rotation angle. * @param isRelative True: the path segment is relative, false it is absolute. */ public SVGPathSegArc(double x, double y, double rx, double ry, double angle, boolean largeArcFlag, boolean sweepFlag, boolean isRelative) { super(isRelative); this.x = x; this.y = y; this.rx = rx; this.ry = ry; this.angle = angle; this.largeArcFlag = largeArcFlag; this.sweepFlag = sweepFlag; } /** * Creates a Java Arc2D corresponding to the position and the angles of the arc segment (computations based on the SVG * specification instructions concerning the build of an arc, p. 643-649). * @param x0 The X-coordinate of the initial position. * @param y0 The Y-coordinate of the initial position. * @return An Java Arc2D with double values. * @since 0.1 */ public Arc2D getArc2D(double x0, double y0) { double a = getAngle(); double _rx = getRX(); double _ry = getRY(); double _x = getX(); double _y = getY(); boolean laf = isLargeArcFlag(); boolean sf = isSweepFlag(); double dx2 = (x0-_x)/2.; double dy2 = (y0-_y)/2.; a = Math.toRadians(a%360.); // Step 1: Compute (x1', y1') double x1 = Math.cos(a)*dx2 + Math.sin(a)*dy2; double y1 = -Math.sin(a)*dx2 + Math.cos(a)*dy2; // Ensure radii are large enough _rx = Math.abs(_rx); _ry = Math.abs(_ry); double Prx = _rx*_rx; double Pry = _ry*_ry; double Px1 = x1*x1; double Py1 = y1*y1; double radiiCheck = Px1/Prx + Py1/Pry; if(radiiCheck>1) { _rx = Math.sqrt(radiiCheck) * _rx; _ry = Math.sqrt(radiiCheck) * _ry; Prx = _rx * _rx; Pry = _ry * _ry; } // Step 2: Compute (cx1, cy1) double sign = (laf == sf) ? -1 : 1; double sq = ((Prx * Pry) - (Prx * Py1) - (Pry * Px1)) / ((Prx * Py1) + (Pry * Px1)); sq = (sq < 0) ? 0 : sq; double coef = (sign * Math.sqrt(sq)); double cx1 = coef * ((_rx * y1) / _ry); double cy1 = coef * -((_ry * x1) / _rx); // Step 3: Compute (cx, cy) from (cx1, cy1) double sx2 = (x0+_x)/2.; double sy2 = (y0+_y)/2.; double cx = sx2 + (Math.cos(a) * cx1 - Math.sin(a) * cy1); double cy = sy2 + (Math.sin(a) * cx1 + Math.cos(a) * cy1); // Step 4: Compute the angleStart (angle1) and the angleExtent (dangle) double ux = (x1 - cx1) / _rx; double uy = (y1 - cy1) / _ry; double vx = (-x1 - cx1) / _rx; double vy = (-y1 - cy1) / _ry; double p = ux, n = Math.sqrt((ux * ux) + (uy * uy)); sign = (uy < 0) ? -1. : 1.; double angleStart = Math.toDegrees(sign * Math.acos(p / n)); // Compute the angle extent n = Math.sqrt((ux * ux + uy * uy) * (vx * vx + vy * vy)); p = ux * vx + uy * vy; sign = (ux * vy - uy * vx < 0) ? -1. : 1.; double angleExtent = Math.toDegrees(sign * Math.acos(p / n)); if(!sf && angleExtent > 0) angleExtent -= 360.; else if(sf && angleExtent < 0) angleExtent += 360.; return new Arc2D.Double(cx-_rx, cy-_ry, _rx*2., _ry*2., -angleStart%360., -angleExtent%360., Arc2D.OPEN); } /** * @return the x. * @since 0.1 */ public double getX() { return x; } /** * @return the y. * @since 0.1 */ public double getY() { return y; } /** * @return the rx. * @since 0.1 */ public double getRX() { return rx; } /** * @return the ry. * @since 0.1 */ public double getRY() { return ry; } /** * @return the angle. * @since 0.1 */ public double getAngle() { return angle; } /** * @return the largeArcFlag. * @since 0.1 */ public boolean isLargeArcFlag() { return largeArcFlag; } /** * @return the sweepFlag. * @since 0.1 */ public boolean isSweepFlag() { return sweepFlag; } @Override public PathSeg getType() { return isRelative() ? PathSeg.ARC_REL : PathSeg.ARC_ABS; } @Override public String toString() { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append((isRelative() ? "a" : "A")); //$NON-NLS-1$ //$NON-NLS-2$ stringBuffer.append(' '); stringBuffer.append(rx); stringBuffer.append(' '); stringBuffer.append(ry); stringBuffer.append(' '); stringBuffer.append(angle); stringBuffer.append(' '); stringBuffer.append((largeArcFlag?'1':'0')); stringBuffer.append(' '); stringBuffer.append((sweepFlag?'1':'0')); stringBuffer.append(' '); stringBuffer.append(x); stringBuffer.append(' '); stringBuffer.append(y); return stringBuffer.toString(); } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/path/SVGPathSegLinetoVertical.java0000644000000000000000000000304511347255510026106 0ustar package latexDraw.parsers.svg.elements.path; /** * Defines the SVGPath vertical lineto segment.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/20/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGPathSegLinetoVertical extends SVGPathSegLineto { /** * The main constructor. * @param y The Y-coordinate of the second point of the line. * @param isRelative isRelative True: the path segment is relative, false it is absolute. */ public SVGPathSegLinetoVertical(double y, boolean isRelative) { super(y, y, isRelative); } @Override public PathSeg getType() { return isRelative() ? PathSeg.LINETO_VERTICAL_REL : PathSeg.LINETO_VERTICAL_ABS; } @Override public String toString() { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append((isRelative() ? "v" : "V"));//$NON-NLS-1$//$NON-NLS-2$ stringBuffer.append(' '); stringBuffer.append(y); return stringBuffer.toString(); } @Override public double getX() { return getY(); } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/path/SVGPathSegCurvetoQuadratic.java0000644000000000000000000000516311347255510026452 0ustar package latexDraw.parsers.svg.elements.path; /** * Defines the SVGPath quadratic curveto segment.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/20/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGPathSegCurvetoQuadratic extends SVGPathSeg { /** The X-coordinate of the second point of the curve. @since 0.1 */ protected double x; /** The Y-coordinate of the second point of the curve. @since 0.1 */ protected double y; /** The x-coordinate of the first control point. @since 0.1 */ protected double x1; /** The y-coordinate of the first control point. @since 0.1 */ protected double y1; /** * The main constructor. * @param x The X-coordinate of the second point of the curve. * @param y The Y-coordinate of the second point of the curve. * @param x1 The x-coordinate of the first control point. * @param y1 The y-coordinate of the first control point * @param isRelative isRelative True: the path segment is relative, false it is absolute. */ public SVGPathSegCurvetoQuadratic(double x, double y, double x1, double y1, boolean isRelative) { super(isRelative); this.x = x; this.y = y; this.x1 = x1; this.y1 = y1; } @Override public String toString() { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append((isRelative() ? "q" : "Q")); //$NON-NLS-1$ //$NON-NLS-2$ stringBuffer.append(' '); stringBuffer.append(x1); stringBuffer.append(' '); stringBuffer.append(y1); stringBuffer.append(' '); stringBuffer.append(x); stringBuffer.append(' '); stringBuffer.append(y); return stringBuffer.toString(); } /** * @return the x. * @since 0.1 */ public double getX() { return x; } /** * @return the y. * @since 0.1 */ public double getY() { return y; } /** * @return the x1. * @since 0.1 */ public double getX1() { return x1; } /** * @return the y1. * @since 0.1 */ public double getY1() { return y1; } @Override public PathSeg getType() { return isRelative() ? PathSeg.CURVETO_QUADRATIC_REL : PathSeg.CURVETO_QUADRATIC_ABS; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/path/SVGPathSegCurvetoCubic.java0000644000000000000000000000632611347255510025564 0ustar package latexDraw.parsers.svg.elements.path; /** * Defines the SVGPath curveto segment.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/20/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGPathSegCurvetoCubic extends SVGPathSeg { /** The X-coordinate of the second point of the curve. @since 0.1 */ protected double x; /** The Y-coordinate of the second point of the curve. @since 0.1 */ protected double y; /** The x-coordinate of the first control point. @since 0.1 */ protected double x1; /** The y-coordinate of the first control point. @since 0.1 */ protected double y1; /** The x-coordinate of the second control point. @since 0.1 */ protected double x2; /** The y-coordinate of the second control point. @since 0.1 */ protected double y2; /** * The main constructor. * @param x The X-coordinate of the second point of the curve. * @param y The Y-coordinate of the second point of the curve. * @param x1 The x-coordinate of the first control point. * @param y1 The y-coordinate of the first control point * @param x2 The x-coordinate of the second control point. * @param y2 The y-coordinate of the second control point. * @param isRelative isRelative True: the path segment is relative, false it is absolute. */ public SVGPathSegCurvetoCubic(double x, double y, double x1, double y1, double x2, double y2, boolean isRelative) { super(isRelative); this.x = x; this.y = y; this.x1 = x1; this.x2 = x2; this.y1 = y1; this.y2 = y2; } @Override public String toString() { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append((isRelative() ? "c" : "C"));//$NON-NLS-1$//$NON-NLS-2$ stringBuffer.append(' '); stringBuffer.append(x1); stringBuffer.append(' '); stringBuffer.append(y1); stringBuffer.append(' '); stringBuffer.append(x2); stringBuffer.append(' '); stringBuffer.append(y2); stringBuffer.append(' '); stringBuffer.append(x); stringBuffer.append(' '); stringBuffer.append(y); return stringBuffer.toString(); } /** * @return the x. * @since 0.1 */ public double getX() { return x; } /** * @return the y. * @since 0.1 */ public double getY() { return y; } /** * @return the x1. * @since 0.1 */ public double getX1() { return x1; } /** * @return the y1. * @since 0.1 */ public double getY1() { return y1; } /** * @return the x2. * @since 0.1 */ public double getX2() { return x2; } /** * @return the y2. * @since 0.1 */ public double getY2() { return y2; } @Override public PathSeg getType() { return isRelative() ? PathSeg.CURVETO_CUBIC_REL : PathSeg.CURVETO_CUBIC_ABS; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/path/SVGPathSegList.java0000644000000000000000000001145711347255510024103 0ustar package latexDraw.parsers.svg.elements.path; import java.awt.geom.Point2D; import java.text.ParseException; import java.util.Vector; import latexDraw.parsers.svg.elements.path.SVGPathSeg.PathSeg; import latexDraw.parsers.svg.parsers.SVGPathHandler; import latexDraw.parsers.svg.parsers.SVGPathParser; /** * Defines a list of SVGPath segments.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/20/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGPathSegList extends Vector implements SVGPathHandler { private static final long serialVersionUID = 1L; /** * The constructor by default. * @since 0.1 */ public SVGPathSegList() { super(); } /** * This constructor creates some segment paths which will be created from given path parsing. * @param path The path to parse. * @throws IllegalArgumentException If the path is not valid. * @since 0.1 */ public SVGPathSegList(String path) { this(); addSVGSegPaths(path); } @Override public synchronized String toString() { StringBuffer path = new StringBuffer(); for(SVGPathSeg seg : this) if(seg!=null) { path.append(seg.toString()); path.append(' '); } return path.toString(); } /** * Adds to the list some SVGSegPath which will be created from given path parsing. * @param path The path to parse. * @throws IllegalArgumentException If the path is not valid. * @since 0.1 */ public void addSVGSegPaths(String path) { if(path==null) return ; SVGPathParser pp = new SVGPathParser(path, this); try{ pp.parse(); } catch(ParseException e) { throw new IllegalArgumentException(e.toString() + " But : \"" + path + "\" found."); } } public void onPathSeg(SVGPathSeg pathSeg) { if(pathSeg!=null) add(pathSeg); } /** * Returns the current point with absolute values at the end of the SVGPathSeg at the position i. * @param pos The position of the SVGPathSeg to compute the current point. * @return The current point with absolute values. * @since 0.1 */ @SuppressWarnings("incomplete-switch") public Point2D getCurrentPoint(int pos) { if(pos<0 || pos>=size()) return null; Point2D.Double pt = new Point2D.Double(), pt2; SVGPathSeg p = elementAt(pos); switch(p.getType()) { case LINETO_ABS: pt.setLocation(((SVGPathSegLineto)p).getX(), ((SVGPathSegLineto)p).getY()); break; case MOVETO_ABS: pt.setLocation(((SVGPathSegMoveto)p).getX(), ((SVGPathSegMoveto)p).getY()); break; case CLOSEPATH: pt.setLocation(getInitialPoint(pos-1)); break; case ARC_ABS: pt.setLocation(((SVGPathSegArc)p).getX(), ((SVGPathSegArc)p).getY()); break; case CURVETO_CUBIC_ABS: pt.setLocation(((SVGPathSegCurvetoCubic)p).getX(), ((SVGPathSegCurvetoCubic)p).getY()); break; case CURVETO_CUBIC_SMOOTH_ABS: pt.setLocation(((SVGPathSegCurvetoCubicSmooth)p).getX(), ((SVGPathSegCurvetoCubicSmooth)p).getY()); break; case CURVETO_QUADRATIC_ABS: pt.setLocation(((SVGPathSegCurvetoQuadratic)p).getX(), ((SVGPathSegCurvetoQuadratic)p).getY()); break; case CURVETO_QUADRATIC_SMOOTH_ABS: pt.setLocation(((SVGPathSegCurvetoQuadraticSmooth)p).getX(), ((SVGPathSegCurvetoQuadraticSmooth)p).getY()); break; case LINETO_HORIZONTAL_ABS: pt2 = (Point2D.Double)getCurrentPoint(pos-1); if(pt2==null) pt=null; else pt.setLocation(((SVGPathSegLinetoHorizontal)p).getX(), pt2.getY()); break; case LINETO_VERTICAL_ABS: pt2 = (Point2D.Double)getCurrentPoint(pos-1); if(pt2==null) pt=null; else pt.setLocation(pt2.getX(), ((SVGPathSegLinetoVertical)p).getY()); break; } return pt; } /** * Returns the initial point of the path containing the element at the position i. * @param pos The position the begin the research. * @return The initial point of the path. * @since 0.1 */ public Point2D getInitialPoint(int pos) { if(pos<0 || pos>=size()) return null; SVGPathSegMoveto m=null; int i = pos; while(m==null && i>0) if(elementAt(i).getType()==PathSeg.MOVETO_ABS) m = (SVGPathSegMoveto)elementAt(i); if(m==null) return null; return new Point2D.Double(m.getX(), m.getY()); } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/SVGGElement.java0000644000000000000000000000320211347255510022445 0ustar /* * SVGGElement.java */ package latexDraw.parsers.svg.elements; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.SVGElements; import org.w3c.dom.Node; /** * Defines the SVG tag g.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/11/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public class SVGGElement extends SVGElement { /** * See {@link SVGElement#SVGElement(Node, SVGElement)}. * @throws MalformedSVGDocument If the element is not well formed. */ public SVGGElement(Node n, SVGElement p) throws MalformedSVGDocument { super(n, p); } /** * Creates an empty G element. * @param owner The owner document. * @throws IllegalArgumentException If p is null. * @since 0.1 */ public SVGGElement(SVGDocument owner) { super(); if(owner==null) throw new IllegalArgumentException(); ownerDocument = owner; setNodeName(SVGElements.SVG_G); } @Override public boolean checkAttributes() { return true; } @Override public boolean enableRendering() { return true; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/SVGEllipseElement.java0000644000000000000000000001012511347255510023656 0ustar package latexDraw.parsers.svg.elements; import java.text.ParseException; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.SVGElements; import latexDraw.parsers.svg.parsers.SVGLengthParser; import org.w3c.dom.Node; /** * Defines the SVG tag ellipse.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/11/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGEllipseElement extends SVGElement { public SVGEllipseElement(Node n, SVGElement p) throws MalformedSVGDocument { super(n, p); } /** * Creates an SVG ellipse element. * @param cx The X-centre coordinate. * @param cy The Y-centre coordinate. * @param rx The X-radius of the ellipse. * @param ry The Y-radius of the ellipse. * @param owner The document owner. * @throws IllegalArgumentException If owner is null or if a given value is not valid. * @since 0.1 */ public SVGEllipseElement(double cx, double cy, double rx, double ry, SVGDocument owner) { super(owner); setAttribute(SVGAttributes.SVG_CX, String.valueOf(cx)); setAttribute(SVGAttributes.SVG_CY, String.valueOf(cy)); setAttribute(SVGAttributes.SVG_RX, String.valueOf(rx)); setAttribute(SVGAttributes.SVG_RY, String.valueOf(ry)); setNodeName(SVGElements.SVG_ELLIPSE); ownerDocument = owner; if(!checkAttributes()) throw new IllegalArgumentException(); } /** * Creates an empty ellipse. * @param doc The owner document. * @since 0.1 */ public SVGEllipseElement(SVGDocument doc) { super(doc); setNodeName(SVGElements.SVG_ELLIPSE); setAttribute(SVGAttributes.SVG_RX, "0");//$NON-NLS-1$ setAttribute(SVGAttributes.SVG_RY, "0");//$NON-NLS-1$ } /** * @return The x-axis coordinate of the centre of the ellipse (0 if there it does not exist or it is not a coordinate). * @since 0.1 */ public double getCx() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_CX); double cx; try { cx = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { cx = 0; } return cx; } /** * @return The y-axis coordinate of the centre of the ellipse (0 if there it does not exist or it is not a coordinate). * @since 0.1 */ public double getCy() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_CY); double cy; try { cy = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { cy = 0; } return cy; } /** * @return The x-axis radius of the ellipse (NaN if there it does not exist or it is not a length). * @since 0.1 */ public double getRx() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_RX); double rx; try { rx = v==null ? Double.NaN : new SVGLengthParser(v).parseLength().getValue(); } catch(ParseException e) { rx = Double.NaN; } return rx; } /** * @return The y-axis radius of the ellipse (NaN if there it does not exist or it is not a length). * @since 0.1 */ public double getRy() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_RY); double ry; try { ry = v==null ? Double.NaN : new SVGLengthParser(v).parseLength().getValue(); } catch(ParseException e) { ry = Double.NaN; } return ry; } @Override public boolean checkAttributes() { double rx = getRx(), ry = getRy(); return !Double.isNaN(rx) && !Double.isNaN(ry) && rx>=0 && ry>=0; } @Override public boolean enableRendering() { return getRx()!=0 && getRy()!=0 ; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/SVGElement.java0000644000000000000000000006467711347255510022365 0ustar package latexDraw.parsers.svg.elements; import java.awt.Color; import java.text.ParseException; import latexDraw.parsers.svg.*; import latexDraw.parsers.svg.parsers.CSSStyleParser; import latexDraw.parsers.svg.parsers.SVGLengthParser; import org.w3c.dom.*; /** * Defines an SVG element.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/11/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public abstract class SVGElement implements Element, Cloneable { /** The attributes of the element. @since 0.1 */ protected SVGNamedNodeMap attributes; /** The children of this element. @since 0.1 */ protected SVGNodeList children; /** The parent SVGElement of this element. @since 0.1 */ protected SVGElement parent; /** The name of the tag. @since 0.1 */ protected String name; /** The list of transformations which concern the element. @since 0.1 */ protected SVGTransformList transform; /** The list of the CSS styles of the SVG attribute style. @since 0.1 */ protected CSSStyleList stylesCSS; /** The document containing the element. @since 0.1 */ protected SVGDocument ownerDocument; /** * The constructor by default. * @since 0.1 */ public SVGElement() { children = new SVGNodeList(); attributes = null; transform = null; stylesCSS = null; parent = null; name = null; ownerDocument = null; } /** * Creates an simple SVGElement with the owner document. * @param owner The owner document. * @since 0.1 */ public SVGElement(SVGDocument owner) { this(); if(owner==null) throw new IllegalArgumentException(); ownerDocument = owner; } /** * The constructor using a node in order to be initialised. * @param n The node. * @throws MalformedSVGDocument If the element is not well formed. * @since 0.1 */ public SVGElement(Node n) throws MalformedSVGDocument { this(n, null); } /** * The constructor using a node to create the SVG element and an SVG element to be its parent. * @param n The node. * @param p The parent SVG element. * @throws MalformedSVGDocument If the element is not well formed. * @since 0.1 */ public SVGElement(Node n, SVGElement p) throws MalformedSVGDocument { this(); if(n==null) throw new IllegalArgumentException(); if(p!=null) { ownerDocument = p.getOwnerDocument(); setParent(p); } setAttributes(n); setNodeValue(n.getNodeValue()); setNodeName(n.getNodeName()); String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_TRANSFORM); if(v!=null) { transform = new SVGTransformList(); transform.addTransformations(getAttribute(getUsablePrefix()+SVGAttributes.SVG_TRANSFORM)); } v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_STYLE); if(v!=null) { stylesCSS = new CSSStyleList(); try { new CSSStyleParser(v, stylesCSS).parse(); } catch(ParseException e) {e.printStackTrace(); } } if(!checkAttributes()) throw new MalformedSVGDocument(); NodeList nl = n.getChildNodes(); int i, size = nl.getLength(); if(size==1) if(nl.item(0).getNodeName().equals("#text") || nl.item(0).getNodeName().equals("#cdata-section"))//$NON-NLS-1$//$NON-NLS-2$ setTextContent(n.getTextContent()); for(i=0; i0) { if(attributes==null) attributes = new SVGNamedNodeMap(); for(i=0; i0) str.append(children.getNodes().lastElement().toString()); str.append('}'); return str.append(']').toString(); } public String getNodeName() { return name; } public void setNodeName(String name) { this.name = name; } public String getAttribute(String nameAttr) { if(attributes==null || nameAttr==null) return null; Node n = attributes.getNamedItem(nameAttr); if(n!=null) return n.getNodeValue(); return null; } public Attr getAttributeNode(String nameAttr) { if(attributes==null) return null; return (Attr)attributes.getNamedItem(nameAttr); } public String getTagName() { return getNodeName(); } public Node appendChild(Node newChild) throws DOMException { if(!(newChild instanceof SVGElement)) throw new DOMException(DOMException.TYPE_MISMATCH_ERR, "SVGElement excepted here.");//$NON-NLS-1$ if(children.getNodes().contains(newChild)) children.getNodes().remove(newChild); children.getNodes().add((SVGElement)newChild); ((SVGElement)newChild).setParent(this); return newChild; } public NodeList getChildNodes() { return children; } public Node getFirstChild() { return children==null || children.getNodes()==null || children.getNodes().isEmpty() ? null : children.getNodes().firstElement(); } public Node getLastChild() { return children==null || children.getNodes()==null || children.getNodes().isEmpty() ? null : children.getNodes().lastElement(); } public short getNodeType() { return Node.ELEMENT_NODE; } public SVGDocument getOwnerDocument() { return ownerDocument; } public Node getParentNode() { return parent; } public boolean hasAttributes() { return attributes!=null && attributes.getAttributes()!=null && !attributes.getAttributes().isEmpty(); } public boolean hasChildNodes() { return children!=null && children.getNodes()!=null && !children.getNodes().isEmpty(); } public Node insertBefore(Node newChild, Node refChild) throws DOMException { boolean ok = false; if(children!=null && newChild!=null && refChild!=null) { int pos = children.getNodes().indexOf(refChild); if(pos!=-1 && newChild instanceof SVGElement) { children.getNodes().add(pos, (SVGElement)newChild); ok = true; } } return ok ? newChild : null; } public boolean isEqualNode(Node node) { if(node==null || !(node instanceof SVGElement)) return false; SVGElement elt = (SVGElement)node; String uri = lookupNamespaceURI(null); String val = getNodeValue(); boolean valEq = val==null ? elt.getNodeValue()==null : val.equals(elt.getNodeValue()); boolean uriEq = uri==null ? elt.lookupNamespaceURI(null)==null : uri.equals(elt.lookupNamespaceURI(null)); boolean attrEq = attributes==null ? elt.attributes==null : attributes.equals(elt.attributes); return name.equals(elt.name) && getUsablePrefix().equals(elt.getUsablePrefix()) && uriEq && valEq && attrEq; } public boolean isSameNode(Node other) { return other!=null && other==this; } public Node removeChild(Node oldChild) throws DOMException { boolean ok = false; if(children!=null && oldChild!=null) ok = children.getNodes().remove(oldChild); return ok ? oldChild : null; } public void setTextContent(String textContent) throws DOMException { if(textContent==null) throw new DOMException(DOMException.DOMSTRING_SIZE_ERR, "textContent is null.");//$NON-NLS-1$ appendChild(new SVGText(textContent, getOwnerDocument())); } public String lookupPrefix(String namespaceURI) { if(namespaceURI == null) return null; String pref = null, xmlns = "xmlns";//$NON-NLS-1$ if(attributes!=null) { int i=0, size = attributes.getLength(); boolean again = true; while(i0; } public String getNamespaceURI() { return lookupNamespaceURI(getPrefix()); } public String lookupNamespaceURI(String pref) { String uri = null; if(attributes!=null) if(pref==null) { int i=0, size = attributes.getLength(); boolean again = true; String xmlns = "xmlns";//$NON-NLS-1$ while(i=nl.getLength() ? null : nl.getNodes().elementAt(index+1); } public Node getPreviousSibling() { if(parent==null) return null; SVGNodeList nl = (SVGNodeList)parent.getChildNodes(); int index = nl.getNodes().indexOf(this); if(index==-1) return null; return index-1<0 ? null : nl.getNodes().elementAt(index+1); } public NodeList getElementsByTagName(String nameElt) { if("*".equals(nameElt)) //$NON-NLS-1$ return getChildNodes(); SVGNodeList nl = new SVGNodeList(); if(nameElt!=null) { NodeList nl2 = getChildNodes(); int i, size = nl2.getLength(); Node n; for(i=0; i0) setAttribute(getUsablePrefix()+SVGAttributes.SVG_STROKE_WIDTH, String.valueOf(strokeW)); } /** * @return The stroke width of the element (if it is possible) or 1. * @since 0.1 */ public double getStrokeWidth() { String swStr = getSVGAttribute(SVGAttributes.SVG_STROKE_WIDTH, getUsablePrefix()); double sw; try { sw = swStr==null ? parent==null ? 1 : parent.getStrokeWidth() : new SVGLengthParser(swStr).parseLength().getValue(); } catch(ParseException e){ sw = 1; } return sw; } /** * @return The dash array of the element (if it is possible) or null. * @since 0.1 */ public String getStrokeDasharray() { String da = getSVGAttribute(SVGAttributes.SVG_STROKE_DASHARRAY, getUsablePrefix()); return da==null ? parent==null ? SVGAttributes.SVG_VALUE_NONE : parent.getStrokeDasharray() : da; } /** * @return The linecap of the element (if it is possible) or null. * @since 0.1 */ public String getLinecap() { String linecap = getSVGAttribute(SVGAttributes.SVG_STROKE_LINECAP, getUsablePrefix()); return linecap==null ? parent==null ? SVGAttributes.SVG_LINECAP_VALUE_BUTT : parent.getLinecap() : linecap; } /** * Sets the colour of the filling. * @param c The new filling colour. * @since 0.1 */ public void setFill(Color c) { if(c!=null) setAttribute(getUsablePrefix()+SVGAttributes.SVG_FILL, CSSColors.getColorName(c, true)); } /** * @return The fill content of the element (if it is possible) or null. * @since 0.1 */ public String getFill() { String fill = getSVGAttribute(SVGAttributes.SVG_FILL, getUsablePrefix()); return fill==null ? parent==null ? CSSColors.CSS_BLACK_NAME : parent.getFill() : fill; } /** * @return The font-size value in point of the element, or from one of its parents. */ public float getFontSize() { String fs = getSVGAttribute(SVGAttributes.SVG_FONT_SIZE, getUsablePrefix()); return fs==null ? parent==null ? SVGLengthParser.FontSize.MEDIUM.getPointValue() : parent.getFontSize() : SVGLengthParser.fontSizetoPoint(fs); } /** * @return The defined or inherited font family. Otherwise, an empty string. */ public String getFontFamily() { String fam = getSVGAttribute(SVGAttributes.SVG_FONT_FAMILY, getUsablePrefix()); return fam==null ? parent==null ? "" : parent.getFontFamily() : fam; } /** * @return The defined or inherited font style. Otherwise, the default value "normal" is returned. */ public String getFontStyle() { String style = getSVGAttribute(SVGAttributes.SVG_FONT_STYLE, getUsablePrefix()); return style==null ? parent==null ? SVGAttributes.SVG_FONT_STYLE_NORMAL : parent.getFontStyle() : style; } /** * @return The defined or inherited font weight. Otherwise, the default value "normal" is returned. */ public String getFontWeight() { String weight = getSVGAttribute(SVGAttributes.SVG_FONT_WEIGHT, getUsablePrefix()); return weight==null ? parent==null ? SVGAttributes.SVG_FONT_WEIGHT_NORMAL : parent.getFontWeight() : weight; } /** * Sets The colour of the stroke. * @param c The new colour of the stroke (must not be null). * @since 0.1 */ public void setStroke(Color c) { if(c!=null) setAttribute(getUsablePrefix()+SVGAttributes.SVG_STROKE, CSSColors.getColorName(c, true)); } /** * @return The fill content of the element (if it is possible) or null. * @since 0.1 */ public Color getStroke() { String stroke = getSVGAttribute(SVGAttributes.SVG_STROKE, getUsablePrefix()); return stroke==null ? parent==null ? null : parent.getStroke() : CSSColors.getRGBColour(stroke); } /** * @return The prefix followed by ':' if there is a prefix. An empty string is returned in the other case. * @since 0.1 */ public String getUsablePrefix(String uri) { String pref = lookupPrefix(uri); return pref==null || pref.length()==0 ? "" : pref+':';//$NON-NLS-1$ } /** * @return The list of transformations of the current SVG element (may be null). * @since 0.1 */ public SVGTransformList getTransform() { return transform; } /** * @return The list of all the transformations of the node's parents followed by the node's transformations. * The first transformations will be the transformations of the oldest parent and the last ones, the * transformations of the current node. If no transformation are defined, an empty list is returned. * @since 0.1 */ public SVGTransformList getWholeTransform() { SVGTransformList tl = new SVGTransformList(); // The list that will be returned. SVGElement p = getParent(); // A parent element. if(getTransform()!=null) tl.addAll(getTransform()); while(p!=null) { if(p.getTransform()!=null) tl.addAll(0, p.getTransform()); p = p.getParent(); } return tl; } /** * Sets the owner document of the node. * @param doc The document to set. * @since 2.0.0 */ public void setOwnerDocument(SVGDocument doc) { if(doc!=null) { ownerDocument = doc; for(int i=0, size=children.getLength(); ilinearGradient.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/04/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public class SVGLinearGradientElement extends SVGElement { public SVGLinearGradientElement(Node n, SVGElement p) throws MalformedSVGDocument { super(n, p); } /** * Creates an simple SVGLinearGradientElement with the owner document. * @param owner The owner document. * @throws IllegalArgumentException If owner is null. * @since 0.1 */ public SVGLinearGradientElement(SVGDocument owner) { super(owner); setNodeName(SVGElements.SVG_LINEAR_GRADIENT); } @Override public boolean checkAttributes() { return true; } @Override public boolean enableRendering() { return true; } /** * @return The coordinate system for attributes x1, y1, x2 and y2. * @since 0.1 */ public String getGradientUnits() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_GRADIENT_UNITS); return v==null || (!SVGAttributes.SVG_UNITS_VALUE_OBJ.equals(v) && !SVGAttributes.SVG_UNITS_VALUE_USR.equals(v)) ? SVGAttributes.SVG_UNITS_VALUE_OBJ : v; } /** * @return The value of the X1 attribute (0 if there it does not exist or it is not a length). * @since 0.1 */ public double getX1() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_X1); double x1; try { x1 = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { x1 = 0; } return x1; } /** * @return The value of the Y1 attribute (0 if there it does not exist or it is not a length). * @since 0.1 */ public double getY1() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_Y1); double y1; try { y1 = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { y1 = 0; } return y1; } /** * @return The value of the X2 attribute (0 if there it does not exist or it is not a length). * @since 0.1 */ public double getX2() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_X2); double x2; try { x2 = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { x2 = 0; } return x2; } /** * @return The value of the Y2 attribute (0 if there it does not exist or it is not a length). * @since 0.1 */ public double getY2() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_Y2); double y2; try { y2 = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { y2 = 0; } return y2; } /** * @return The start colour of the gradient or null. * @since 0.1 */ public Color getStartColor() { SVGNodeList nl = getChildren(SVGElements.SVG_STOP); if(nl.getLength()==2) { if(((SVGStopElement)nl.item(0)).getOffset()<((SVGStopElement)nl.item(1)).getOffset()) return ((SVGStopElement)nl.item(0)).getStopColor(); return ((SVGStopElement)nl.item(1)).getStopColor(); } else if(nl.getLength()==3) { SVGStopElement s1 = ((SVGStopElement)nl.item(0)), s2 = ((SVGStopElement)nl.item(1)); SVGStopElement s3 = ((SVGStopElement)nl.item(2)); if(s1.getOffset()((SVGStopElement)nl.item(1)).getOffset()) return ((SVGStopElement)nl.item(0)).getStopColor(); return ((SVGStopElement)nl.item(1)).getStopColor(); } else if(nl.getLength()==3) { SVGStopElement s1 = ((SVGStopElement)nl.item(0)), s2 = ((SVGStopElement)nl.item(1)); SVGStopElement s3 = ((SVGStopElement)nl.item(2)); if(s1.getOffset()>s2.getOffset()) { if(s1.getOffset()s2.getOffset()) if(s1.getOffset()width attribute. * @since 0.1 */ public double getWidth() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_WIDTH); double width; try { width = v==null ? Double.NaN : new SVGLengthParser(v).parseLength().getValue(); } catch(ParseException e) { width = Double.NaN; } return width; } /** * @return The value of the height attribute. * @since 0.1 */ public double getHeight() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_HEIGHT); double height; try { height = v==null ? Double.NaN : new SVGLengthParser(v).parseLength().getValue(); } catch(ParseException e) { height = Double.NaN; } return height; } /** * @return The URI reference. * @since 0.1 */ public String getURI() { return getAttribute("xlink:href");//$NON-NLS-1$ } @Override public boolean checkAttributes() { double vWidth = getWidth(); double vHeight = getHeight(); if(Double.isNaN(vWidth) || Double.isNaN(vHeight) || vWidth<0 || vHeight<0) return false; return true; } @Override public boolean enableRendering() { if(getWidth()==0 || getHeight()==0 || getURI()==null) return false; try { URI uri = new URI(getURI()); File f = new File(uri.getPath()); if(!f.exists() || !f.canRead()) return false; } catch(URISyntaxException e) { return false; } return true; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/SVGMarkerElement.java0000644000000000000000000000702311347255510023505 0ustar package latexDraw.parsers.svg.elements; import java.text.ParseException; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.SVGElements; import latexDraw.parsers.svg.parsers.SVGLengthParser; import org.w3c.dom.Node; /** * Defines the SVG tag marker.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 11/04/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGMarkerElement extends SVGElement { public SVGMarkerElement(SVGDocument owner) { super(owner); setNodeName(SVGElements.SVG_MARKER); } public SVGMarkerElement(Node n, SVGElement p) throws MalformedSVGDocument { super(n, p); } /** * @return The x-axis coordinate of the reference point which is to be aligned exactly at the marker position. * @since 0.1 */ public double getRefX() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_REF_X); double refx; try { refx = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { refx = 0; } return refx; } /** * @return The y-axis coordinate of the reference point which is to be aligned exactly at the marker position. * @since 0.1 */ public double getRefY() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_REF_Y); double refy; try { refy = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { refy = 0; } return refy; } /** * @return Represents the width of the viewport into which the marker is to be fitted when it is rendered. * @since 0.1 */ public double getMarkerWidth() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_MARKER_WIDTH); double markerW; try { markerW = v==null ? 3 : new SVGLengthParser(v).parseLength().getValue(); } catch(ParseException e) { markerW = 3; } return markerW; } /** * @return Represents the height of the viewport into which the marker is to be fitted when it is rendered. * @since 0.1 */ public double getMarkerHeight() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_MARKER_HEIGHT); double markerH; try { markerH = v==null ? 3 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { markerH = 3; } return markerH; } /** * @return The coordinate system for attributes markerWidth, markerHeight and the contents of the 'marker'. * @since 0.1 */ public String getMarkerUnits() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_MARKER_UNITS); return v==null || (!SVGAttributes.SVG_UNITS_VALUE_STROKE.equals(v) && !SVGAttributes.SVG_UNITS_VALUE_USR.equals(v)) ? SVGAttributes.SVG_UNITS_VALUE_STROKE : v; } @Override public boolean checkAttributes() { return getMarkerWidth()>=0 && getMarkerHeight()>=0; } @Override public boolean enableRendering() { return getMarkerWidth()>0 && getMarkerHeight()>0; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/OtherNSElement.java0000644000000000000000000000314411347255510023226 0ustar /* * OtherNSElement.java */ package latexDraw.parsers.svg.elements; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGDocument; import org.w3c.dom.Node; /** * Defines a generic element to store a non-SVG tag.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/12/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public class OtherNSElement extends SVGElement { /** * See {@link SVGElement#SVGElement(Node, SVGElement)}. * @throws MalformedSVGDocument If the element is not well formed. */ public OtherNSElement(Node n, SVGElement p) throws MalformedSVGDocument { super(n, p); } /** * Creates an non SVG element. * @param document The owner document. * @throws IllegalArgumentException if document is null. * @since 0.1 */ public OtherNSElement(SVGDocument document) { super(); if(document==null) throw new IllegalArgumentException(); ownerDocument = document; } @Override public boolean checkAttributes() { return true; } @Override public boolean enableRendering() { return false; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/SVGCircleElement.java0000644000000000000000000001024511347255510023465 0ustar package latexDraw.parsers.svg.elements; import java.text.ParseException; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.SVGElements; import latexDraw.parsers.svg.parsers.SVGLengthParser; import org.w3c.dom.Node; /** * Defines the SVG tag ciricle.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/11/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGCircleElement extends SVGElement { public SVGCircleElement(Node n, SVGElement p) throws MalformedSVGDocument { super(n, p); } /** * Creates an SVG circle element. * @param cx The X-centre coordinate. * @param cy The Y-centre coordinate. * @param r The radius of the circle. * @param owner The document owner. * @throws IllegalArgumentException If owner is null or if a given value is not valid. * @since 0.1 */ public SVGCircleElement(double cx, double cy, double r, SVGDocument owner) { super(owner); setAttribute(SVGAttributes.SVG_CX, String.valueOf(cx)); setAttribute(SVGAttributes.SVG_CY, String.valueOf(cy)); setAttribute(SVGAttributes.SVG_R, String.valueOf(r)); setNodeName(SVGElements.SVG_CIRCLE); ownerDocument = owner; if(!checkAttributes()) throw new IllegalArgumentException(); } /** * Creates a circle with a radius equal to 0. * @param doc The owner document. * @since 0.1 */ public SVGCircleElement(SVGDocument doc) { super(doc); setNodeName(SVGElements.SVG_CIRCLE); setAttribute(SVGAttributes.SVG_R, "0");//$NON-NLS-1$ } /** * @return The x-axis coordinate of the centre of the circle (0 if there it does not exist or it is not a coordinate). * @since 0.1 */ public double getCx() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_CX); double cx; try { cx = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { cx = 0; } return cx; } /** * @return The y-axis coordinate of the centre of the circle (0 if there it does not exist or it is not a coordinate). * @since 0.1 */ public double getCy() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_CY); double cy; try { cy = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { cy = 0; } return cy; } /** * @return The radius of the circle (NaN if there it does not exist or it is not a length). * @since 0.1 */ public double getR() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_R); double r; try { r = v==null ? Double.NaN : new SVGLengthParser(v).parseLength().getValue(); } catch(ParseException e) { r = Double.NaN; } return r; } /** * Sets the X-coordinate of the circle. * @param cx The new X-coordinate of the circle. * @since 0.1 */ public void setCx(double cx) { setAttribute(getUsablePrefix()+SVGAttributes.SVG_CX, String.valueOf(cx)); } /** * Sets the Y-coordinate of the circle. * @param cy The new Y-coordinate of the circle. * @since 0.1 */ public void setCy(Double cy) { setAttribute(getUsablePrefix()+SVGAttributes.SVG_CY, String.valueOf(cy)); } /** * Sets the radius of the circle. * @param width The new radius of the circle. * @since 0.1 */ public void setR(double width) { if(width>=0) setAttribute(getUsablePrefix()+SVGAttributes.SVG_R, String.valueOf(width)); } @Override public boolean checkAttributes() { double r = getR(); return !Double.isNaN(r) && r>=0; } @Override public boolean enableRendering() { return getR()!=0 ; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/SVGDefsElement.java0000644000000000000000000000405311347255510023145 0ustar /* * SVGDefsElement.java */ package latexDraw.parsers.svg.elements; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.SVGElements; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * Defines the SVG tag defs.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/11/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public class SVGDefsElement extends SVGElement { /** * See {@link SVGElement#SVGElement(Node, SVGElement)}. * @throws MalformedSVGDocument If the element is not well formed. */ public SVGDefsElement(Node n, SVGElement p) throws MalformedSVGDocument { super(n, p); } /** * Creates a meta data element. * @param owner The owner document. * @throws IllegalArgumentException If owner is null. * @since 0.1 */ public SVGDefsElement(SVGDocument owner) { super(); if(owner==null) throw new IllegalArgumentException(); ownerDocument = owner; setNodeName(SVGElements.SVG_DEFS); } @Override public boolean checkAttributes() { return true; } @Override public boolean enableRendering() { return false; } @Override public SVGElement getDef(String id) { if(id==null) return null; NodeList nl = getChildNodes(); SVGElement e = null; Node n; for(int i=0, size = nl.getLength(); istop.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/06/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGStopElement extends SVGElement { /** * See {@link SVGElement#SVGElement(Node, SVGElement)}. * @throws MalformedSVGDocument If the element is not well formed. */ public SVGStopElement(Node n, SVGElement p) throws MalformedSVGDocument { super(n, p); } @Override public boolean checkAttributes() { return !Double.isNaN(getOffset()); } @Override public boolean enableRendering() { return true; } /** * The offset attribute indicates where the gradient stop is placed. * @return The read offset or NaN. * @since 0.1 */ public double getOffset() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_OFFSET); double offset; try { offset = v==null ? Double.NaN : new SVGLengthParser(v).parseNumberOrPercent().getValue(); } catch(ParseException e) { offset = Double.NaN; } return offset; } /** * Indicates what colour to use at that gradient stop. * @return The read colour or black. * @since 0.1 */ public Color getStopColor() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_STOP_COLOR); Color c = CSSColors.getRGBColour(v); return c==null ? Color.BLACK : c; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/SVGPolygonElement.java0000644000000000000000000000243211347255510023712 0ustar package latexDraw.parsers.svg.elements; import java.text.ParseException; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.SVGElements; import org.w3c.dom.Node; /** * Defines the SVG tag polygon.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/11/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGPolygonElement extends AbstractPointsElement { public SVGPolygonElement(Node n, SVGElement p) throws MalformedSVGDocument, ParseException { super(n, p); } public SVGPolygonElement(SVGDocument doc) { super(doc); setNodeName(SVGElements.SVG_POLYGON); } @Override public boolean enableRendering() { return true; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/AbstractPointsElement.java0000644000000000000000000000511011347255510024637 0ustar package latexDraw.parsers.svg.elements; import java.awt.geom.Point2D; import java.text.ParseException; import java.util.Vector; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.parsers.SVGPointsParser; import org.w3c.dom.Node; /** * Defines a model for shapes that have the points SVG attribute.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/11/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public abstract class AbstractPointsElement extends SVGElement { /** The points of the element. @since 2.0.3 */ protected Vector points; public AbstractPointsElement(Node n, SVGElement p) throws MalformedSVGDocument, ParseException { super(n, p); parsePoints(); } /** * Parses the points of the element. * @throws ParseException If the format of the points is not valid. * @since 2.0.3 */ public void parsePoints() throws ParseException { SVGPointsParser parser = new SVGPointsParser(getPoints()); parser.parse(); points = parser.getPoints(); } public AbstractPointsElement(SVGDocument doc) { super(doc); try { setPoints("0,0 1,1"); }//$NON-NLS-1$ catch(ParseException e) { e.printStackTrace(); } } @Override public boolean checkAttributes() { return getPoints()!=null; } /** * Parses and sets the points to the element. * @throws ParseException If the format of the points is not valid. * @since 2.0.3 */ public void setPoints(String points) throws ParseException { if(points!=null) { setAttribute(SVGAttributes.SVG_POINTS, points); parsePoints(); } } /** * @return The points that make up the shape. * @since 0.1 */ public String getPoints() { return getAttribute(getUsablePrefix()+SVGAttributes.SVG_POINTS); } /** * @return The set of points in the Point2D format or null if the format of points is not valid. * @since 0.1 */ public Vector getPoints2D() { return points; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/SVGPolyLineElement.java0000644000000000000000000000244211347255510024017 0ustar package latexDraw.parsers.svg.elements; import java.text.ParseException; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.SVGElements; import org.w3c.dom.Node; /** * Defines the SVG tag polyline.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/11/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGPolyLineElement extends AbstractPointsElement { public SVGPolyLineElement(Node n, SVGElement p) throws MalformedSVGDocument, ParseException { super(n, p); } public SVGPolyLineElement(SVGDocument doc) { super(doc); setNodeName(SVGElements.SVG_POLY_LINE); } @Override public boolean enableRendering() { return true; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/SVGTextElement.java0000644000000000000000000000605511347255510023214 0ustar package latexDraw.parsers.svg.elements; import java.text.ParseException; import latexDraw.parsers.svg.*; import latexDraw.parsers.svg.parsers.SVGLengthParser; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * Defines the SVG tag text.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 11/05/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGTextElement extends SVGElement { public SVGTextElement(SVGDocument owner) { super(owner); setNodeName(SVGElements.SVG_TEXT); } public SVGTextElement(Node n, SVGElement p) throws MalformedSVGDocument { super(n, p); } /** * @return The text of the SVG text element. * @since 0.1 */ public String getText() { String txt = ""; //$NON-NLS-1$ NodeList nl = getChildNodes(); int i, size = nl.getLength(); for(i=0; imetadata.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/11/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public class SVGMetadataElement extends SVGElement { /** * See {@link SVGElement#SVGElement(Node, SVGElement)}. * @throws MalformedSVGDocument If the element is not well formed. */ public SVGMetadataElement(Node n, SVGElement p) throws MalformedSVGDocument { super(n, p); } /** * Creates a meta data element. * @param owner The owner document. * @throws IllegalArgumentException If owner is null. * @since 0.1 */ public SVGMetadataElement(SVGDocument owner) { super(owner); setNodeName(SVGElements.SVG_METADATA); } @Override public boolean checkAttributes() { return true; } @Override public boolean enableRendering() { return false; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/SVGLineElement.java0000644000000000000000000001140311347255510023150 0ustar package latexDraw.parsers.svg.elements; import java.text.ParseException; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.SVGElements; import latexDraw.parsers.svg.parsers.SVGLengthParser; import org.w3c.dom.Node; /** * Defines the SVG tag line.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/11/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGLineElement extends SVGElement { public SVGLineElement(Node n, SVGElement p) throws MalformedSVGDocument { super(n, p); } /** * Creates an SVGLine. * @param owner The owner document. * @throws MalformedSVGDocument If the given coordinates are not valid. * @since 0.1 */ public SVGLineElement(double x1, double y1, double x2, double y2, SVGDocument owner) throws MalformedSVGDocument { this(owner); setAttribute(SVGAttributes.SVG_X1, String.valueOf(x1)); setAttribute(SVGAttributes.SVG_X2, String.valueOf(x2)); setAttribute(SVGAttributes.SVG_Y1, String.valueOf(y1)); setAttribute(SVGAttributes.SVG_Y2, String.valueOf(y2)); if(!checkAttributes()) throw new MalformedSVGDocument(); } /** * Creates an SVG line (0,0 ; 0,0) * @param doc The owner document. * @since 0.1 */ public SVGLineElement(SVGDocument doc) { super(doc); setNodeName(SVGElements.SVG_LINE); setAttribute(SVGAttributes.SVG_X1, "0");//$NON-NLS-1$ setAttribute(SVGAttributes.SVG_X2, "0");//$NON-NLS-1$ setAttribute(SVGAttributes.SVG_Y1, "0");//$NON-NLS-1$ setAttribute(SVGAttributes.SVG_Y2, "0");//$NON-NLS-1$ } /** * @return The x-axis coordinate of the start of the line (0 if there it does not exist or it is not a length). * @since 0.1 */ public double getX1() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_X1); double x1; try { x1 = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { x1 = 0; } return x1; } /** * @return The y-axis coordinate of the start of the line (0 if there it does not exist or it is not a length). * @since 0.1 */ public double getY1() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_Y1); double y1; try { y1 = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { y1 = 0; } return y1; } /** * @return The x-axis coordinate of the end of the line (0 if there it does not exist or it is not a length). * @since 0.1 */ public double getX2() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_X2); double x2; try { x2 = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { x2 = 0; } return x2; } /** * @return The y-axis coordinate of the end of the line (0 if there it does not exist or it is not a length). * @since 0.1 */ public double getY2() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_Y2); double y2; try { y2 = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { y2 = 0; } return y2; } /** * Sets the first X-coordinate of the line. * @param x1 The first X-coordinate of the line. * @since 2.0.0 */ public void setX1(double x1) { setAttribute(getUsablePrefix()+SVGAttributes.SVG_X1, String.valueOf(x1)); } /** * Sets the second X-coordinate of the line. * @param x2 The second X-coordinate of the line. * @since 2.0.0 */ public void setX2(double x2) { setAttribute(getUsablePrefix()+SVGAttributes.SVG_X2, String.valueOf(x2)); } /** * Sets the first Y-coordinate of the line. * @param y1 The first Y-coordinate of the line. * @since 2.0.0 */ public void setY1(double y1) { setAttribute(getUsablePrefix()+SVGAttributes.SVG_Y1, String.valueOf(y1)); } /** * Sets the second Y-coordinate of the line. * @param y2 The second Y-coordinate of the line. * @since 2.0.0 */ public void setY2(double y2) { setAttribute(getUsablePrefix()+SVGAttributes.SVG_Y2, String.valueOf(y2)); } @Override public boolean checkAttributes() { return true; } @Override public boolean enableRendering() { return true; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/SVGPathElement.java0000644000000000000000000000711011347255510023155 0ustar package latexDraw.parsers.svg.elements; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.SVGElements; import latexDraw.parsers.svg.elements.path.*; import org.w3c.dom.Node; /** * Defines the SVG tag path.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/06/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGPathElement extends SVGElement { /** * See {@link SVGElement#SVGElement(Node, SVGElement)}. * @throws MalformedSVGDocument If the element is not well formed. */ public SVGPathElement(Node n, SVGElement p) throws MalformedSVGDocument { super(n, p); } /** * Creates an empty SVG path element. * @param owner The owner document. * @since 0.1 */ public SVGPathElement(SVGDocument owner) { super(owner); setAttribute(SVGAttributes.SVG_D, "");//$NON-NLS-1$ setNodeName(SVGElements.SVG_PATH); } /** * @return True if the path is a unique line. * @since 0.1 */ public boolean isLine() { SVGPathSegList segList = getSegList(); return segList.size()==2 && segList.firstElement() instanceof SVGPathSegMoveto && segList.elementAt(1) instanceof SVGPathSegLineto ; } /** * @return True if the path is composed of lines and has a 'close path' segment at the end. * @since 0.1 */ public boolean isLines() { SVGPathSegList segList = getSegList(); if(segList.size()<3 || !(segList.firstElement() instanceof SVGPathSegMoveto)) return false; boolean ok = true; int i, size; for(i=1, size=segList.size()-1; i0; } /** * @return the segList. * @since 0.1 */ public SVGPathSegList getSegList() { return new SVGPathSegList(getPathData()); } /** * Sets the path data. * @param path The path to set. * @since 2.0.0 */ public void setPathData(SVGPathSegList path) { if(path!=null) setAttribute(SVGAttributes.SVG_D, path.toString()); } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/SVGPatternElement.java0000644000000000000000000001522411347255510023703 0ustar package latexDraw.parsers.svg.elements; import java.awt.Color; import java.text.ParseException; import latexDraw.parsers.svg.CSSColors; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.parsers.SVGLengthParser; import org.w3c.dom.Node; /** * Defines the SVG tag pattern.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/04/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGPatternElement extends SVGElement { /** * See {@link SVGElement#SVGElement(Node, SVGElement)}. * @throws MalformedSVGDocument If the element is not well formed. */ public SVGPatternElement(Node n, SVGElement p) throws MalformedSVGDocument { super(n, p); } @Override public boolean checkAttributes() { double width = getWidth(); double height = getHeight(); if(width<0 || height<0) return false; return true; } @Override public boolean enableRendering() { if(getWidth()==0 || getHeight()==0) return false; return true; } /** * @return The value of the X attribute (0 if there it does not exist or it is not a length). * @since 0.1 */ public double getX() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_X); double x; try { x = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { x = 0; } return x; } /** * @return The value of the Y attribute (0 if there it does not exist or it is not a length). * @since 0.1 */ public double getY() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_Y); double y; try { y = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { y = 0; } return y; } /** * @return The value of the width attribute. * @since 0.1 */ public double getWidth() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_WIDTH); double width; try { width = v==null ? 0 : new SVGLengthParser(v).parseLength().getValue(); } catch(ParseException e) { width = 0; } return width; } /** * @return The value of the height attribute. * @since 0.1 */ public double getHeight() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_HEIGHT); double height; try { height = v==null ? 0 : new SVGLengthParser(v).parseLength().getValue(); } catch(ParseException e) { height = 0; } return height; } /** * @return The coordinate system for the contents of the 'pattern'. * @since 0.1 */ public String getPatternContentUnits() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_PATTERN_CONTENTS_UNITS); return v==null || (!SVGAttributes.SVG_UNITS_VALUE_OBJ.equals(v) && !SVGAttributes.SVG_UNITS_VALUE_USR.equals(v)) ? SVGAttributes.SVG_UNITS_VALUE_USR : v; } /** * @return The coordinate system for attributes x, y, width and height. * @since 0.1 */ public String getPatternUnits() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_PATTERN_UNITS); return v==null || (!SVGAttributes.SVG_UNITS_VALUE_OBJ.equals(v) && !SVGAttributes.SVG_UNITS_VALUE_USR.equals(v)) ? SVGAttributes.SVG_UNITS_VALUE_OBJ : v; } /** * @return The g element of the pattern if there is a one (used to define if there is hatching). * @since 0.1 */ protected SVGGElement getGElement() { int i=0, size = children.getLength(); SVGGElement g = null; while(g==null && irect.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/11/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGRectElement extends SVGElement { /** * See {@link SVGElement#SVGElement(Node, SVGElement)}. * @throws MalformedSVGDocument If the element is not well formed. */ public SVGRectElement(Node n, SVGElement p) throws MalformedSVGDocument { super(n, p); } /** * Creates an SVG rect element. * @param x The top-left X coordinate. * @param y The top-left Y coordinate. * @param w The width of the rectangle. * @param h The height of the rectangle. * @param owner The document owner. * @throws IllegalArgumentException If owner is null or if a given value is not valid. * @since 0.1 */ public SVGRectElement(double x, double y, double w, double h, SVGDocument owner) { super(owner); setAttribute(SVGAttributes.SVG_X, String.valueOf(x)); setAttribute(SVGAttributes.SVG_Y, String.valueOf(y)); setAttribute(SVGAttributes.SVG_WIDTH, String.valueOf(w)); setAttribute(SVGAttributes.SVG_HEIGHT, String.valueOf(h)); setNodeName(SVGElements.SVG_RECT); ownerDocument = owner; if(!checkAttributes()) throw new IllegalArgumentException(); } /** * Creates an SVG rectangle with width=height=0. * @param doc The owner document. * @since 0.1 */ public SVGRectElement(SVGDocument doc) { super(doc); setNodeName(SVGElements.SVG_RECT); setAttribute(SVGAttributes.SVG_WIDTH, "0");//$NON-NLS-1$ setAttribute(SVGAttributes.SVG_HEIGHT, "0");//$NON-NLS-1$ } @Override public boolean checkAttributes() { double vWidth = getWidth(); double vHeight = getHeight(); double vrx = getRx(); double vry = getRy(); if(Double.isNaN(vWidth) || Double.isNaN(vHeight) || vWidth<0 || vHeight<0 || vrx<0 || vry<0) return false; return true; } @Override public boolean enableRendering() { if(getWidth()==0 || getHeight()==0) return false; return true; } /** * @return The value of the X attribute (0 if there it does not exist or it is not a length). * @since 0.1 */ public double getX() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_X); double x; try { x = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { x = 0; } return x; } /** * @return The value of the Y attribute (0 if there it does not exist or it is not a length). * @since 0.1 */ public double getY() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_Y); double y; try { y = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { y = 0; } return y; } /** * @return The value of the width attribute. * @since 0.1 */ public double getWidth() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_WIDTH); double width; try { width = v==null ? Double.NaN : new SVGLengthParser(v).parseLength().getValue(); } catch(ParseException e) { width = Double.NaN; } return width; } /** * @return The value of the height attribute. * @since 0.1 */ public double getHeight() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_HEIGHT); double height; try { height = v==null ? Double.NaN : new SVGLengthParser(v).parseLength().getValue(); } catch(ParseException e) { height = Double.NaN; } return height; } /** * @return The value of the rx attribute (0 if there it does not exist or it is not a length). * @since 0.1 */ public double getRx() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_RX); double rx; try { rx = v==null ? 0 : new SVGLengthParser(v).parseLength().getValue(); } catch(ParseException e) { rx = 0; } return rx; } /** * @return The value of the ry attribute (0 if there it does not exist or it is not a length). * @since 0.1 */ public double getRy() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_RY); double ry; try { ry = v==null ? 0 : new SVGLengthParser(v).parseLength().getValue(); } catch(ParseException e) { ry = 0; } return ry; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/elements/SVGSVGElement.java0000644000000000000000000001544511347255510022732 0ustar /* * SVGSVGElement.java */ package latexDraw.parsers.svg.elements; import java.lang.reflect.InvocationTargetException; import java.text.ParseException; import javax.swing.JProgressBar; import javax.swing.SwingUtilities; import latexDraw.figures.Draw; import latexDraw.figures.Figure; import latexDraw.parsers.svg.*; import latexDraw.parsers.svg.parsers.SVGLengthParser; import org.w3c.dom.Node; /** * Defines the SVG tag SVG.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/11/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1 */ public class SVGSVGElement extends SVGElement { /** * See {@link SVGElement#SVGElement()} * @param n The node. * @throws MalformedSVGDocument If the tag is not valid. */ public SVGSVGElement(SVGDocument owner, Node n) throws MalformedSVGDocument { super(n); if(n==null || !n.getNodeName().endsWith(SVGElements.SVG_SVG) || owner==null) throw new IllegalArgumentException(); if(!checkAttributes()) throw new MalformedSVGDocument(); ownerDocument = owner; } /** * * @param n The source node. * @param e Will not be used. * @throws MalformedSVGDocument If the document is not valid. */ public SVGSVGElement(Node n, SVGElement e) throws MalformedSVGDocument { super(n, e); if(n==null || !n.getNodeName().endsWith(SVGElements.SVG_SVG)) throw new IllegalArgumentException(); if(!checkAttributes()) throw new MalformedSVGDocument(); } /** * Creates an empty SVG element. * @param owner The owner document. * @throws IllegalArgumentException If owner is null. */ public SVGSVGElement(SVGDocument owner) { super(); if(owner==null) throw new IllegalArgumentException(); setAttribute("xmlns", SVGDocument.SVG_NAMESPACE);//$NON-NLS-1$ ownerDocument = owner; setNodeName(SVGElements.SVG_SVG); } /** * @return the meta element or null. * @since 0.1 */ public SVGMetadataElement getMeta() { SVGMetadataElement meta = null; for(int i=0, size=children.getLength(); i0) str.append(children.getNodes().lastElement().toString()); str.append('}'); return str.append(']').toString(); } @Override public boolean checkAttributes() { return true; } @Override public boolean enableRendering() { return getWidth()!=0 && getHeight()!=0; } /** * @return The value of the X attribute (0 if there it does not exist or it is not a length). * @since 0.1 */ public double getX() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_X); double x; try { x = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { x = 0; } return x; } /** * @return The value of the X attribute (0 if there it does not exist or it is not a length). * @since 0.1 */ public double getY() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_Y); double y; try { y = v==null ? 0 : new SVGLengthParser(v).parseCoordinate().getValue(); } catch(ParseException e) { y = 0; } return y; } /** * @return The value of the width attribute (0 if there it does not exist or it is not a length). * @since 0.1 */ public double getWidth() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_WIDTH); double width; try { width = v==null ? 1 : new SVGLengthParser(v).parseLength().getValue(); } catch(ParseException e) { width = 1; } return width;//FIXME: doit retourner 100% } /** * @return The value of the height attribute (0 if there it does not exist or it is not a length). * @since 0.1 */ public double getHeight() { String v = getAttribute(getUsablePrefix()+SVGAttributes.SVG_HEIGHT); double height; try { height = v==null ? 1 : new SVGLengthParser(v).parseLength().getValue(); } catch(ParseException e) { height = 1; } return height; //FIXME: doit retourner 100% } /** * @return The version of the SVG document or an empty string if it is not specified. * @since 0.1 */ public String getVersion() { return getAttribute(getUsablePrefix()+SVGAttributes.SVG_VERSION); } /** * Creates a set of latexdraw figure. * @return The latexdraw figures or null. * @since 0.1 */ public Figure toLaTeXDraw(final JProgressBar progressBar) { Draw figures = new Draw(false, false); Figure f; double increment = progressBar==null ? 0 : (progressBar.getMaximum()-progressBar.getValue())/(double)getNbChildren(2); double value = progressBar==null ? 0 : progressBar.getValue(); for(SVGElement e : children.getNodes()) { f = LaTeXDrawFiguresFactory.createFigure(e); if(f!=null) figures.addFigure(f); if(progressBar!=null) try { final int valueFinal = (int)(value+increment); value += increment; SwingUtilities.invokeAndWait(new Runnable() { public void run() { progressBar.setValue(valueFinal); } }); } catch(InterruptedException ex) { ex.printStackTrace(); } catch(InvocationTargetException ex) { ex.printStackTrace(); } } return figures.size() == 1 ? figures.getFigureAt(0) : figures.size()==0 ? null : figures; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/svg/LaTeXDrawFiguresFactory.java0000644000000000000000000001322611347255510023230 0ustar package latexDraw.parsers.svg; import latexDraw.figures.*; import latexDraw.generators.svg.*; import latexDraw.parsers.svg.elements.*; import latexDraw.util.LaTeXDrawNamespace; /** * Creates latexdraw figures according to the given SVG element.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/21/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public class LaTeXDrawFiguresFactory { public static Figure createFigure(SVGElement e) { return createFigure(e, true); } public static Figure createFigure(SVGElement e, boolean withTransformations) { if(e==null || !e.enableRendering()) return null; try { if(e instanceof SVGRectElement) return new LRectangleSVGGenerator((SVGRectElement)e).getShape(); else if(e instanceof SVGEllipseElement) return new LEllipseSVGGenerator((SVGEllipseElement)e).getShape(); else if(e instanceof SVGCircleElement) return new LCircleSVGGenerator((SVGCircleElement)e).getShape(); else if(e instanceof SVGPolygonElement) return new LPolygonSVGGenerator((SVGPolygonElement)e).getShape(); else if(e instanceof SVGPolyLineElement) return new LLinesSVGGenerator((SVGPolyLineElement)e).getShape(); else if(e instanceof SVGImageElement) return new LPictureSVGGenerator((SVGImageElement)e).getShape(); else if(e instanceof SVGLineElement) return new LLineSVGGenerator((SVGLineElement)e).getShape(); else if(e instanceof SVGTextElement) return new LTextSVGGenerator((SVGTextElement)e).getShape(); else if(e instanceof SVGPathElement) { SVGPathElement p = (SVGPathElement)e; if(p.isPolygon()) return new LPolygonSVGGenerator((SVGPathElement)e).getShape(); else if(p.isLines()) return new LLinesSVGGenerator((SVGPathElement)e).getShape(); else if(p.isLine()) return new LLineSVGGenerator((SVGPathElement)e).getShape(); } else if(e instanceof SVGGElement) { String ltdPref = e.lookupPrefixUsable(LaTeXDrawNamespace.LATEXDRAW_NAMESPACE_URI); String type = e.getAttribute(ltdPref+LaTeXDrawNamespace.XML_TYPE); if(type==null || type.length()==0 || LaTeXDrawNamespace.XML_TYPE_DRAWING.equals(type)) { switch(e.getChildNodes().getLength()) { case 0: return null; case 1: return createFigure((SVGElement)e.getChildNodes().item(0)); default: return new LDrawingSVGGenerator((SVGGElement)e, withTransformations).getShape(); } } if(type.equals(LaTeXDrawNamespace.XML_TYPE_RECT)) return new LRectangleSVGGenerator((SVGGElement)e, withTransformations).getShape(); else if(type.equals(LaTeXDrawNamespace.XML_TYPE_ELLIPSE)) return new LEllipseSVGGenerator((SVGGElement)e, withTransformations).getShape(); else if(type.equals(LaTeXDrawNamespace.XML_TYPE_CIRCLE)) return new LCircleSVGGenerator((SVGGElement)e, withTransformations).getShape(); else if(type.equals(LaTeXDrawNamespace.XML_TYPE_POLYGON)) return new LPolygonSVGGenerator((SVGGElement)e, withTransformations).getShape(); else if(type.equals(LaTeXDrawNamespace.XML_TYPE_SQUARE)) return new LSquareSVGGenerator((SVGGElement)e, withTransformations).getShape(); else if(type.equals(LaTeXDrawNamespace.XML_TYPE_TRIANGLE)) return new LTriangleSVGGenerator((SVGGElement)e, withTransformations).getShape(); else if(type.equals(LaTeXDrawNamespace.XML_TYPE_RHOMBUS)) return new LRhombusSVGGenerator((SVGGElement)e, withTransformations).getShape(); else if(type.equals(LaTeXDrawNamespace.XML_TYPE_JOINED_LINES)) return new LLinesSVGGenerator((SVGGElement)e, withTransformations).getShape(); else if(type.equals(LaTeXDrawNamespace.XML_TYPE_AKIN_PTS)) return new LFreeHandSVGGenerator((SVGGElement)e, withTransformations).getShape(); else if(type.equals(LaTeXDrawNamespace.XML_TYPE_LINE)) return new LLineSVGGenerator((SVGGElement)e, withTransformations).getShape(); else if(type.equals(LaTeXDrawNamespace.XML_TYPE_BEZIER_CURVE)) return new LBezierCurveSVGGenerator((SVGGElement)e, withTransformations).getShape(); else if(type.equals(LaTeXDrawNamespace.XML_TYPE_GRID)) return new LGridSVGGenerator((SVGGElement)e, withTransformations).getShape(); else if(type.equals(LaTeXDrawNamespace.XML_TYPE_AXE)) return new LAxeSVGGenerator((SVGGElement)e, withTransformations).getShape(); else if(type.equals(LaTeXDrawNamespace.XML_TYPE_TEXT)) return new LTextSVGGenerator((SVGGElement)e, withTransformations).getShape(); else if(type.equals(LaTeXDrawNamespace.XML_TYPE_DRAWING)) return new LDrawingSVGGenerator((SVGGElement)e, withTransformations).getShape(); else if(type.equals(LaTeXDrawNamespace.XML_TYPE_DOT)) return new LDotSVGGenerator((SVGGElement)e, withTransformations).getShape(); else if(type.equals(LaTeXDrawNamespace.XML_TYPE_ARC)) return new LArcSVGGenerator((SVGGElement)e, withTransformations).getShape(); else if(type.equals(LaTeXDrawNamespace.XML_TYPE_PICTURE)) return new LPictureSVGGenerator((SVGGElement)e, withTransformations).getShape(); } } catch(Exception ex) { ex.printStackTrace(); } return null; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/css/0000755000000000000000000000000011347255510015702 5ustar latexdraw-2.0.8+1.orig/latexDraw/parsers/css/AbstractCSSParser.java0000644000000000000000000000352411347255510022042 0ustar package latexDraw.parsers.css; import latexDraw.parsers.CodeParser; /** * Defines an abstract CSS parser that contains functions to help the CSS parsing. *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 12/05/08
    * @author Arnaud BLOUIN
    * @version 2.0.3
    * @since 2.0.3 */ public abstract class AbstractCSSParser extends CodeParser { /** * Creates and initialises the CSS parser. * @param code The code to parse. * @throws IllegalArgumentException If the given code is null. * @since 2.0.3 */ public AbstractCSSParser(String code) { super(code); } @Override public boolean isComment() { return getChar()=='/' && getCharAt(getPosition()+1)=='*'; } @Override public String skipComment() { if(!isComment()) return null; StringBuffer comment = new StringBuffer(); boolean again = true; nextChar(); nextChar(); while(again && !isEOC()) { if(getChar()=='*' && getCharAt(getPosition()+1)=='/') { again = false; nextChar(); } else comment.append((char)getChar()); nextChar(); } return comment.toString(); } @Override public boolean isWSP() { int c = getChar(); return c=='\t' || c==' ' || c=='\r' || c=='\n' || c=='\f'; } @Override public void skipWSP() { while(isWSP() && !isEOC()) nextChar(); } } latexdraw-2.0.8+1.orig/latexDraw/parsers/InvalidFormatCommandException.java0000644000000000000000000000327211347255510023676 0ustar package latexDraw.parsers; /** * This kind of exception occurs when the format of a command is incorrect. * * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 02/15/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class InvalidFormatCommandException extends UnknownCommandException { private static final long serialVersionUID = 1L; /** * The constructor using the number of the line of the ignored command. * @param nl The number of line of the ignored command. */ public InvalidFormatCommandException(int nl) { this("", nl);//$NON-NLS-1$ } /** * The constructor using the name of the ignored command. * @param ms The name of the ignored command. * @param nl The number of line of the ignored command. */ public InvalidFormatCommandException(String ms, int nl) { super(ms, nl); } @Override public String toString() { if(command==null || command.length()==0) return "Line "+ nLine + " : the format of the command is invalid!";//$NON-NLS-1$//$NON-NLS-2$ return "Line "+ nLine + " : the command "+command+" is invalid!";//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ } } latexdraw-2.0.8+1.orig/latexDraw/parsers/UnexceptedEndOfFileException.java0000644000000000000000000000204711347255510023457 0ustar package latexDraw.parsers; /** * The kind of exception occurred when you reach the end of the file * during the parsing of a command. * * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 02/01/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class UnexceptedEndOfFileException extends FatalErrorParsingException { private static final long serialVersionUID = 1L; public UnexceptedEndOfFileException() { msg = "The unexpected end of the file was reached!";//$NON-NLS-1$ } } latexdraw-2.0.8+1.orig/latexDraw/parsers/UnclosedBracketsException.java0000644000000000000000000000176511347255510023100 0ustar package latexDraw.parsers; /** * The kind of exception occurred when too many brackets are not closed. * * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 02/01/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class UnclosedBracketsException extends FatalErrorParsingException { private static final long serialVersionUID = 1L; public UnclosedBracketsException() { msg = "A closing bracket was expected.";//$NON-NLS-1$ } } latexdraw-2.0.8+1.orig/latexDraw/parsers/ParserMessagesFrame.java0000644000000000000000000001414111347255510021655 0ustar package latexDraw.parsers; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; import javax.swing.*; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableColumnModel; import javax.swing.table.TableModel; import latexDraw.lang.LaTeXDrawLang; /** * This class define a frame which can contains the messages that appeared during * the parsing.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * * 02/02/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class ParserMessagesFrame extends JDialog implements ActionListener { private static final long serialVersionUID = 1L; /** The label of the button "ok" */ public static final String LABEL_OK = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.4"); //$NON-NLS-1$ /** If true the messages must by displayed in a frame, else in * the console. */ private boolean displayInFrame; /** The table to display */ private JTable table; /** The messages of the parser */ private Vector messages; /** * The constructor by default. * @param displayInF True : the messages will be displayed in a frame, else in the console. * @param msg The messages. */ public ParserMessagesFrame(JFrame parent, boolean displayInF, Vector msg) { super(parent, true); try { displayInFrame = displayInF ; messages = msg; int i, size = msg.size(); final String[] titles = {LaTeXDrawLang.getString1_6("ParserMessagesFrame.0"), LaTeXDrawLang.getString1_6("ParserMessagesFrame.1"), LaTeXDrawLang.getString1_6("ParserMessagesFrame.2")}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ final Object[][] data = new String[size][ParserCmdMessage.NB_COL]; for(i=0; i getColumnClass(int c) {return getValueAt(0, c).getClass();} @Override public boolean isCellEditable(int row, int col) {return false;} @Override public void setValueAt(Object aValue, int row, int column) { data[row][column] = aValue; } }; table = new JTable(dataModel); table.getTableHeader().setReorderingAllowed(false); TableColumnModel colmodel = table.getColumnModel(); colmodel.getColumn(0).setPreferredWidth(120); colmodel.getColumn(1).setPreferredWidth(15); colmodel.getColumn(2).setPreferredWidth(205); JScrollPane scrollPane = new JScrollPane(); JViewport vp = scrollPane.getViewport(); vp.add(table); JPanel topPanel = new JPanel(); topPanel.add(new JLabel(LaTeXDrawLang.getString1_6("ParserMessagesFrame.3"))); //$NON-NLS-1$ JPanel bPanel = new JPanel(new GridLayout(1, 1)); JButton okB = new JButton(LABEL_OK); okB.setActionCommand(LABEL_OK); okB.addActionListener(this); bPanel.add(okB); setTitle(LaTeXDrawLang.getString1_6("ParserMessagesFrame.4")); //$NON-NLS-1$ getContentPane().setLayout(new BorderLayout()); getContentPane().add(topPanel,BorderLayout.NORTH); getContentPane().add(scrollPane, BorderLayout.CENTER); getContentPane().add(bPanel, BorderLayout.SOUTH); } catch(Exception ex) { ex.printStackTrace(); if(displayInFrame) JOptionPane.showMessageDialog( this, LaTeXDrawLang.getDialogFrameString("ExceptionFrameDialog.4") + //$NON-NLS-1$ ex.toString(), LaTeXDrawLang.getDialogFrameString("ExceptionFrameDialog.5"), //$NON-NLS-1$ JOptionPane.WARNING_MESSAGE ); } } @Override public void setVisible(boolean visible) { if(visible) { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); setLocation(dim.width/2-300, dim.height/2-200); setSize(600, 400); } super.setVisible(visible); } /** * Allows to display a frame which contains the messages which appeared during to * parsing. * @param msg All the messages * @param displayInFrame If true, the messages are printed in a frame ; else they are * printed in the console. */ public static void showParserMessagesFrame(JFrame parent, boolean displayInFrame, Vector msg) { ParserMessagesFrame f = new ParserMessagesFrame(parent, displayInFrame, msg); if(displayInFrame) f.setVisible(true); else if(msg!=null) for(ParserCmdMessage pcm : msg) System.out.println(pcm); } /** * The actions to do bound to the buttons. */ public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if(o instanceof JButton) { String msg = ((JButton)o).getActionCommand(); if(msg.equals(LABEL_OK)) { setVisible(false); return ; } } } } latexdraw-2.0.8+1.orig/latexDraw/parsers/NotYetManagedException.java0000644000000000000000000000331211347255510022332 0ustar package latexDraw.parsers; /** * This class allows the management of exceptions : a command * "not yet managed" can generate an NotYetManagedException
    * * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/24/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class NotYetManagedException extends Exception { private static final long serialVersionUID = 1L; /** The command which is not managed */ String command; /** The number of the line that command was in the file */ int nLine; /** * The constructor using the name of the not managed command. */ public NotYetManagedException(String cmd, int nl) { command = cmd; nLine = nl; } @Override public String toString() { if(command==null || command.length()==0) return "Line "+ nLine + " : a command is unknown!";//$NON-NLS-1$//$NON-NLS-2$ return "Line "+ nLine + " : the command "+command+" is not yet managed!";//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ } /** * @return the command */ public String getCommand() { return command; } /** * @return the nLine */ public int getNLine() { return nLine; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/TooManyBracketsException.java0000644000000000000000000000226411347255510022705 0ustar package latexDraw.parsers; /** * This kind of exception occurred when there is too many brackets at a * given time.
    * * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 02/01/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TooManyBracketsException extends FatalErrorParsingException { private static final long serialVersionUID = 1L; private int nLine; public TooManyBracketsException(int nl) { nLine = nl; msg = "At the line "+nLine+", the closing bracket is of excess.";//$NON-NLS-1$ //$NON-NLS-2$ } /** * @return the nLine */ public int getNLine() { return nLine; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/WillNeverBeManagedException.java0000644000000000000000000000336411347255510023275 0ustar package latexDraw.parsers; /** * A WillNeverBeManagedException exception occurred when the parser * reach a command that will never be managed because it is obsolete * or something else.
    * * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 02/02/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class WillNeverBeManagedException extends Exception { private static final long serialVersionUID = 1L; /** The command which is not managed */ String command; /** The number of the line that command was in the file */ int nLine; /** * The constructor using the name of the non managed command * @param cmd The name of the ignored command * @param nl The number of line of the non managed command */ public WillNeverBeManagedException(String cmd, int nl) { command = cmd; nLine = nl; } @Override public String toString() { return "Line "+ nLine + " : the command "+command+" is will never be managed!";//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ } /** * @return the command */ public String getCommand() { return command; } /** * @return the nLine */ public int getNLine() { return nLine; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/Parser.java0000644000000000000000000000207511347255510017215 0ustar /* * Parser.java */ package latexDraw.parsers; /** * This class defines the general structure of a parser.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * * 09/09/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public abstract class Parser { /** The value corresponding to a bad parsing. */ public static final short ERROR_PARSING = -1; /** The value corresponding to a good parsing. */ public static final short OK_PARSING = 1; /** The value corresponding to a cancelled parsing. */ public static final short CANCEL_PARSING = 0; } latexdraw-2.0.8+1.orig/latexDraw/parsers/latexdraw/0000755000000000000000000000000011347255510017105 5ustar latexdraw-2.0.8+1.orig/latexDraw/parsers/latexdraw/LPSTParser.java0000644000000000000000000005215711347255510021721 0ustar package latexDraw.parsers.latexdraw; import java.awt.geom.Point2D; import java.util.Stack; import java.util.Vector; import latexDraw.figures.AkinPoints; import latexDraw.figures.Figure; import latexDraw.figures.FramedBox; import latexDraw.figures.Text; import latexDraw.parsers.*; import latexDraw.parsers.pst.PSTParameters; import latexDraw.parsers.pst.PSTParser; import latexDraw.parsers.pst.PSTParameters.PositionParameters; import latexDraw.psTricks.PSTricksConstants; import latexDraw.util.LaTeXDrawPoint2D; /** * Defines an PSTricks parser specific to latexdraw.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 11/21/08
    * @author Arnaud BLOUIN
    * @version 2.0.2
    */ public class LPSTParser extends PSTParser { /** The parsed shapes. */ protected Vector
    shapes; /** The figures contained in the pscustom command. Cleared at the end of each pscustom command.*/ public Vector
    psCustFigures; /** * Creates and initialises the pstricks parser. * @param code The code to parse. * @throws IllegalArgumentException If the given code is null. */ public LPSTParser(String code) { super(code); shapes = new Vector
    (); psCustFigures = new Vector
    (); } /** * Parses only the framed boxes of the code. Used to save and read text shape * saved into SVG documents. * @throws TooManyBracketsException If there is a problem of brackets * @throws InvalidFormatCommandException If the format of a command is not respected. * @throws UnclosedBracketsException If a bracket is not closed. * @since 2.0.2 */ public void parseFramedBox() throws TooManyBracketsException, InvalidFormatCommandException, UnclosedBracketsException { boolean isFramedBox = false; Stack ignorableBracket = new Stack(); initialise(); started = true; params.add(new PSTParameters()); while(!isEOC()) try { switch(getChar()) { case '\\': int pos = getPosition(); boolean ok = true; PSTParameters tp = params.lastElement(); switch(nextChar()) { case 'p': switch(nextChar()) { case 's':// \ps switch(nextChar()) { case 'f': // \psf if(nextChar()=='r' && nextChar()=='a' && nextChar()=='m' && nextChar()=='e' && nextChar()=='b' && nextChar()=='o' && nextChar()=='x' && !Character.isLetter(nextChar())) {// \psframebox if(tp.psBox.isEmpty()) tp.psBoxText.setText("");//$NON-NLS-1$ actionsOnFramedBox(0); isFramedBox = true; } else ok = false; break; case 'd': // \psd switch(nextChar()) { case 'i': // \psdi if(nextChar()=='a' && nextChar()=='b' && nextChar()=='o' && nextChar()=='x' && !Character.isLetter(nextChar())) {// \psdiabox actionsOnFramedBox(3); isFramedBox = true; } else ok = false; break; case 'b': // \psdb if(nextChar()=='l' && nextChar()=='f' && nextChar()=='r' && nextChar()=='a' && nextChar()=='m' && nextChar()=='e' && nextChar()=='b' && nextChar()=='o' && nextChar()=='x' && !Character.isLetter(nextChar())) {// \psdblframebox actionsOnFramedBox(5); isFramedBox = true; } else ok = false; break; default: ok = false; break; } break; case 'c': // \psc if(nextChar()=='i' && nextChar()=='r' && nextChar()=='c' && nextChar()=='l' && nextChar()=='e' && nextChar()=='b' && nextChar()=='o' && nextChar()=='x' && !Character.isLetter(nextChar())) {// \pscirclebox actionsOnFramedBox(1); isFramedBox = true; } else ok = false; break; case 't': // \pst if(nextChar()=='r' && nextChar()=='i' && nextChar()=='b' && nextChar()=='o' && nextChar()=='x' && !Character.isLetter(nextChar())) {// \pstribox actionsOnFramedBox(2); isFramedBox = true; } else ok = false; break; case 'o': // \pso if(nextChar()=='v' && nextChar()=='a' && nextChar()=='l' && nextChar()=='b' && nextChar()=='o' && nextChar()=='x' && !Character.isLetter(nextChar())) {// \psovalbox actionsOnFramedBox(4); isFramedBox = true; } else ok = false; break; case 's': // \pss if(nextChar()=='h' && nextChar()=='a' && nextChar()=='d' && nextChar()=='o' && nextChar()=='w' && nextChar()=='b' && nextChar()=='o' && nextChar()=='x' && !Character.isLetter(nextChar())) {// \psshadowbox actionsOnFramedBox(6); isFramedBox = true; } else ok = false; break; } break; case 'u': // \pu if(nextChar()=='t' && !Character.isLetter(nextChar())) // \put { skipWSPComments(); parse_put(); skipWSPComments(); if(getChar()!='{') throw new InvalidFormatCommandException(getLinePosition()); ignorableBracket.add(false); nextChar(); } else ok = false; break; default: ok = false; } break; case 'd':// \d if(nextChar()=='e' && nextChar()=='f' && nextChar()=='i' && nextChar()=='n' && nextChar()=='e' && nextChar()=='c' && nextChar()=='o' && nextChar()=='l' && nextChar()=='o' && nextChar()=='r' && !Character.isLetter(nextChar())) {// \definecolor parse_definecolor(); } else ok = false; break; case 'c': // \c if(nextChar()=='o' && nextChar()=='l' && nextChar()=='o' && nextChar()=='r' && !Character.isLetter(nextChar())) {// \color parse_color(); } else ok = false; break; case '{' : // \{ case '}' : // \} case '$' : // \$ case '&' : // \& case '#' : // \# case '%' : // \% case '\\': // \\ setPosition(getPosition()-1); addParsedText(); nextChar(); addParsedText(); nextChar(); break; default: ok = false; break; } if(!ok) { setPosition(pos); addParsedText(); nextChar(); } break; case '{' : if(isFramedBox) { params.add(new PSTParameters(params.lastElement())); params.lastElement().fromFramedBox = true; isFramedBox = false; ignorableBracket.add(false); } else { addParsedText(); ignorableBracket.add(true); } nextChar(); break; case '}': if(params.size()<1) throw new TooManyBracketsException(getLinePosition()); if(!ignorableBracket.isEmpty() && ignorableBracket.lastElement()) addParsedText(); else { PSTParameters tp1 = params.lastElement(); if(tp1.fromFramedBox) { PSTParameters pp = null; int k = params.size()-1; while(pp==null && k>=0) if(params.elementAt(k).getPosition()==null) k--; else pp = params.elementAt(k); if(pp==null) pp = params.firstElement(); pp.psBox.lastElement().setEnd(pp.textForFrame.length()); pp.psBox.add(0, pp.psBox.remove(pp.psBox.size()-1)); } else if(tp1.getPosition()!=null && !tp1.psBox.isEmpty()) { Vector fbs = new Vector(); while(!tp1.psBox.isEmpty()) fbs.add(tp1.psBox.remove(tp1.psBox.size()-1)); tp1.psBox = fbs; tp1.psBoxText.setText(tp1.textForFrame); actionsOnTerminatedFramedBoxes(); } else try {actionsOnText();} catch(InvalidFormatCommandException e) { /* Nothing to do.*/ } params.removeElementAt(params.size()-1); } if(!ignorableBracket.isEmpty()) ignorableBracket.remove(ignorableBracket.size()-1); nextChar(); break; case '$': parseMathText(); break; default: if(isEOL()) incLinePosition(); addParsedText(); if(isWSP()) { nextChar(); skipWSP();// Only a piece of blank must be took in account. } else nextChar(); break; }//switch }//while catch(UnexceptedEndOfFileException ex) { ex.printStackTrace(); } if(params.size()>1) throw new UnclosedBracketsException(); } @Override public void actionsOnterminatedPsCustom() throws NotFullyManagedException { Figure f; int i=0; while(!psCustFigures.isEmpty()) { f = psCustFigures.remove(0); if(!(f instanceof AkinPoints) || ((AkinPoints)f).getNbPoints()>1) { if(f instanceof AkinPoints && ((AkinPoints)f).getType()==AkinPoints.TYPE_CURVES) {// We must transform the read points. AkinPoints ak = (AkinPoints)f; int j, size = ak.getNbPoints(); LaTeXDrawPoint2D prev, curr = ak.getPoint(0); for(j=1; j getShapes() { return shapes; } @Override public void actionsOnFramedBox(int type) throws UnclosedBracketsException { boolean hasStar; int i = params.size()-1; PSTParameters pp = null; while(pp==null && i>=0) if(params.elementAt(i).getPosition()!=null) pp = params.elementAt(i); else i--; if(pp==null) pp = params.firstElement(); FramedBox fb = new FramedBox(pp.psBoxText); fb.setStart(pp.textForFrame.length()); pp.psBox.add(fb); PSTParameters newP = new PSTParameters(params.lastElement()); if(getChar()=='*') { hasStar = true; nextChar(); } else hasStar = false; paramParser.setParam(newP); paramParser.parse(); paramParser.setParam(null); skipWSPComments(); switch(type) { case 0: fb.setBoxType(FramedBox.BOX_RECTANGLE); break; case 1: fb.setBoxType(FramedBox.BOX_CIRCLE); break; case 2: fb.setBoxType(FramedBox.BOX_TRIANGLE); break; case 3: fb.setBoxType(FramedBox.BOX_DIAMOND); break; case 4: fb.setBoxType(FramedBox.BOX_ELLIPSE); break; case 5: fb.setBoxType(FramedBox.BOX_RECTANGLE); break; case 6: fb.setBoxType(FramedBox.BOX_RECTANGLE); break; } if(getChar()!='{')//psframebox3, psframebox[framesep=0.3]3 for instance. { PSTParameters p; boolean again = true; int k = params.size()-1; while(again && k>=0) { p = params.elementAt(k); p.textForFrame+=(char)getChar(); if(p.getPosition()==null) k--; else again = false; } k = params.size()-1; p=null; while(p==null && k>=0) if(params.elementAt(k).getPosition()==null) k--; else p = params.elementAt(k); if(p==null) p = params.firstElement(); p.psBox.lastElement().setEnd(p.textForFrame.length()); p.psBox.add(0, p.psBox.remove(p.psBox.size()-1)); } fb.setFrameSep(newP.frameSep*Figure.PPC); fb.setBoxSep(newP.boxSep); setFigureParameters(newP, fb.getBox(), hasStar); if(hasStar) { fb.getBox().setIsFilled(true); fb.getBox().setInteriorColor(newP.fillColor); fb.getBox().setLinesColor(newP.fillColor); } switch(type) { case 5: fb.getBox().setHasDoubleBoundary(true); break; case 6: fb.getBox().setHasShadow(true); break; } } @Override public void actionsOnTerminatedFramedBoxes() throws InvalidFormatCommandException { PSTParameters pp = params.lastElement(); String str = pp.psBoxText.getText(); if(str.length()==0) str = " ";//$NON-NLS-1$ pp.textParsed = pp.textForFrame; actionsOnText(); if(pp.psBox.isEmpty()) return; if(shapes.isEmpty()) return; Text txt = (Text)shapes.remove(shapes.size()-1); boolean simpleBox = pp.psBox.size()==1 && pp.psBox.firstElement().getBoxedText().equals(txt.getText()); if(simpleBox) { FramedBox fb = pp.psBox.firstElement(); fb.setText(txt); fb.setStart(-1); fb.setEnd(-1); fb.getBox().setBordersPosition(PSTricksConstants.BORDERS_OUTSIDE); txt.setSimpleBox(fb); } else for(FramedBox fb : pp.psBox) { fb.setText(txt); txt.addBox(fb); fb.getBox().setBordersPosition(PSTricksConstants.BORDERS_OUTSIDE); } txt.setHasFramedBox(!pp.psBox.isEmpty()); txt.setHasSimpleFramedBox(simpleBox); txt.updateFramedBoxes(); txt.updateFontsBorders(); if(!pp.psCustomP.fromPsCustom) shapes.add(txt); if(simpleBox) { if(txt.getSimpleBox().getBoxType()==FramedBox.BOX_TRIANGLE) { double height = (txt.getSimpleBox().getBox().getTheSEBoundPoint().y- txt.getSimpleBox().getBox().getTheNWBoundPoint().y)/4.; LaTeXDrawPoint2D pos = txt.getPosition(); txt.setPosition(new LaTeXDrawPoint2D(pos.x, pos.y+height)); txt.getSimpleBox().getBox().updateShape(); } } else { FramedBox fb, max=null; double xMin=Double.MAX_VALUE; int i=0, size = txt.getMultipleBox().size(); while(if. * @param p The set of pstricks parameters to use to set the shape. * @param f The shape to set. * @param hasStar True if the command of the pstricks shape is followed by a star * (for instance: psframe*[...](..)(..)). */ public void setFigureParameters(PSTParameters p, Figure f, boolean hasStar) { if(f==null || p==null) return ; if(f.canHaveShadow()) { f.setHasShadow(p.isShadow); f.setShadowAngle(Math.toRadians(p.shadowAngle)); f.setShadowSize(Math.abs(p.shadowSize)*Figure.PPC); f.setShadowColor(p.shadowCol); } if(f.canBeHatched()) { f.setHatchingSep(p.hatchSep*Figure.PPC); f.setGradientAngle(Math.toRadians(p.gradAngle)); f.setGradientEndColor(p.gradEnd); f.setGradientMidPoint(p.gradMidPoint); f.setGradientStartColor(p.gradBegin); } f.setLinesColor(p.lineColor); f.setBordersPosition(p.borderPos); f.setDoubleColor(p.dbleColor); f.setDoubleSep(Math.abs(p.dbleSep*Figure.PPC)); f.setHasDoubleBoundary(p.dbleLine); f.setHatchingColor(p.hatchCol); if(p.fillStyle.equals(PSTricksConstants.TOKEN_FILL_SOLID)) f.setHatchingStyle(PSTricksConstants.TOKEN_FILL_NONE); else f.setHatchingStyle( p.fillStyle.endsWith("*") ? p.fillStyle.substring(0, p.fillStyle.length()-1) : p.fillStyle);//$NON-NLS-1$ f.setHatchingWidth((float)Math.abs(p.hatchWidth*Figure.PPC)); f.setDotSep((float) p.dotStep*Figure.PPC); f.setHatchingAngle(Math.toRadians(p.hatchAngle)); f.setBlackDashLength((float)p.dashBlack*Figure.PPC); f.setWhiteDashLength((float)p.dashWhite*Figure.PPC); f.setInteriorColor(p.fillColor); f.setIsFilled(p.fillStyle.equals(PSTricksConstants.TOKEN_FILL_SOLID) || p.fillStyle.equals(PSTricksConstants.TOKEN_FILL_CROSSHATCH_F) || p.fillStyle.equals(PSTricksConstants.TOKEN_FILL_HLINES_F) || p.fillStyle.equals(PSTricksConstants.TOKEN_FILL_VLINES_F)); f.setLineStyle(p.lineStyle); f.setThickness((float)(Math.abs(p.lineWidth*Figure.PPC))); if(hasStar) { f.setIsFilled(true); f.setInteriorColor(f.getLinesColor()); f.setHasDoubleBoundary(false); f.setLineStyle(PSTricksConstants.LINE_NONE_STYLE); f.setHatchingStyle(PSTricksConstants.TOKEN_FILL_NONE); f.setBordersPosition(PSTricksConstants.BORDERS_INSIDE); } } @Override public void actionsOnText() throws InvalidFormatCommandException { if(params.isEmpty()) return; if(params.lastElement().textParsed.length()!=0) { PSTParameters last = params.lastElement(); PositionParameters pp = null; int i = params.size()-1; while(pp==null && i>=0) { pp = params.elementAt(i).getPosition(); i--; } if(pp==null) pp = new PositionParameters(); Text t = new Text(true); Point2D.Double posit = moveCoordinate(new Point2D.Double(0,0)); double angle = Math.toRadians(PSTParameters.getWholeRotationAngle(params)); if(posit==null) throw new InvalidFormatCommandException("text", -1); //$NON-NLS-1$ if(last.textSize!=null && last.textSize.length()!=0) t.setSizeByCommand(last.textSize); if((last.textSeries!=null && last.textSeries.equals("b")) || last.textBold) //$NON-NLS-1$ t.setIsBold(true); else t.setIsBold(false); if((last.textShape!=null && (last.textShape.equals("sl") || //$NON-NLS-1$ last.textShape.equals("it")) || last.textItalic)) //$NON-NLS-1$ t.setIsItalic(true); else t.setIsItalic(false); t.setRotationAngle(-angle); t.setText(last.textParsed); t.setLinesColor(last.textColor); if(last.textFamily!=null && last.textFamily.length()!=0) t.setTextFontByFamily(last.textFamily); t.updateFontsBorders(); LaTeXDrawPoint2D pos = new LaTeXDrawPoint2D(posit.x*Figure.PPC-t.getWidth()/2., (posit.y*Figure.PPC-t.getFontMetrics().getHeight()/4.)*-1); if(pp.refPoint!=PositionParameters.REF_POINT_DEFAULT_CENTER) { double addX=0, addY=0; Point2D.Double gc = new Point2D.Double((pos.x+t.getWidth())/2.,(pos.y+t.getHeight())/2.); if(pp.refPoint==PositionParameters.REF_POINT_BASE) addY=-t.getFontMetrics().getDescent(); else if(pp.refPoint==PositionParameters.REF_POINT_TOP) addY=t.getFontMetrics().getAscent()/2.; else if(pp.refPoint==PositionParameters.REF_POINT_BOTTOM) addY=-t.getFontMetrics().getDescent()*2; else if(pp.refPoint==PositionParameters.REF_POINT_LEFT) addX=t.getWidth()/2.; else if(pp.refPoint==PositionParameters.REF_POINT_RIGHT) addX=-t.getWidth()/2.; else if(pp.refPoint==PositionParameters.REF_POINT_RIGHT+PositionParameters.REF_POINT_BASE) { addY=-t.getFontMetrics().getDescent(); addX=-t.getWidth()/2.; }else if(pp.refPoint==PositionParameters.REF_POINT_RIGHT+PositionParameters.REF_POINT_BOTTOM) { addY=-t.getFontMetrics().getDescent()*2; addX=-t.getWidth()/2.; }else if(pp.refPoint==PositionParameters.REF_POINT_RIGHT+PositionParameters.REF_POINT_TOP) { addY=t.getFontMetrics().getAscent()/2.; addX=-t.getWidth()/2.; }else if(pp.refPoint==PositionParameters.REF_POINT_LEFT+PositionParameters.REF_POINT_BASE) { addY=-t.getFontMetrics().getDescent(); addX=t.getWidth()/2.; }else if(pp.refPoint==PositionParameters.REF_POINT_LEFT+PositionParameters.REF_POINT_BOTTOM) { addY=-t.getFontMetrics().getDescent()*2; addX=t.getWidth()/2.; }else if(pp.refPoint==PositionParameters.REF_POINT_LEFT+PositionParameters.REF_POINT_TOP) { addY=t.getFontMetrics().getAscent()/2.; addX=t.getWidth()/2.; } addX+=pp.labelSep*Figure.PPC; Point2D.Double pt = rotatePoint(new Point2D.Double(gc.x+addX, gc.y-addY), gc, angle); pos.setLocation(pos.x+(pt.x-gc.x), pos.y-(pt.y-gc.y)); } t.setPosition(pos); t.updateFontsBorders(); if(last.psCustomP.fromPsCustom) psCustFigures.add(t); else shapes.add(t); } } } latexdraw-2.0.8+1.orig/latexDraw/parsers/pst/0000755000000000000000000000000011347255510015720 5ustar latexdraw-2.0.8+1.orig/latexDraw/parsers/pst/PSTParameters.java0000644000000000000000000004631611347255510021267 0ustar package latexDraw.parsers.pst; import java.awt.Color; import java.awt.geom.Point2D; import java.awt.geom.Point2D.Double; import java.util.Vector; import latexDraw.figures.FramedBox; import latexDraw.figures.Text; import latexDraw.psTricks.PSTricksConstants; /** * This class defines a set of PSTricks parameters. *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/01/06
    * @author Arnaud BLOUIN
    * @version 0.5
    */ public class PSTParameters { /** * Defines the parameters of the pscustom parameters. * @author Arnaud BLOUIN
    * @version 0.3
    */ public class PsCustomParameters implements Cloneable { /** Defines if the command pscustom has a star. */ public boolean hasStar; /** Defines if the current PSTParameters comes from a pscustom command. */ public boolean fromPsCustom; /** The last position (cf. \moveto pstricks command). */ public Point2D.Double lastPosition; public PsCustomParameters() { hasStar = false; fromPsCustom = false; lastPosition = new Point2D.Double(); } @Override public Object clone() throws CloneNotSupportedException { PsCustomParameters pscp = (PsCustomParameters)super.clone(); pscp.fromPsCustom = fromPsCustom; pscp.hasStar = hasStar; pscp.lastPosition = (Double)lastPosition.clone(); return pscp; } } /** * This class defines the position managed with the rput and uput commands of the figures.
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * * 03/16/06
    * @author Arnaud BLOUIN
    * @version 0.5
    */ public static class PositionParameters implements Cloneable { public static final short REF_POINT_DEFAULT_CENTER= 0; public static final short REF_POINT_LEFT = 10; public static final short REF_POINT_RIGHT = 20; public static final short REF_POINT_TOP = 1; public static final short REF_POINT_BOTTOM = 2; public static final short REF_POINT_BASE = 3; /** True if the current {...} allows to sum all the rotations :
    * rput{30}(0,0){ rput{*40}{...} ... } -> false
    * rput{30}(0,0){ rput{40} {...} ... } -> true
    */ public boolean isSumRotation; /** The x gap */ public double dx; /** The y gap */ public double dy; /** The rput angle in degrees */ public double angleRput; /** The uput angle in degrees. */ public double angleUput; /** The gap of the label */ public double labelSep; /** The point of reference (for rput). */ public int refPoint; /** The angle of reference (for uput in degrees). */ public double refAngle; /** * The constructor by default. */ public PositionParameters() { this(true, 0, 0, 0, 0, 0, REF_POINT_DEFAULT_CENTER, REF_POINT_RIGHT); } /** * The main constructor. * @param isSumRot True if allows to sum all the rotations * @param x The x gap * @param y The y gap * @param rputA The rput angle * @param uputA The uput angle * @param labSep The gap of the label (for uput). * @param refPt The point of reference (for rput). * @param refA The angle of reference (for uput). */ public PositionParameters(boolean isSumRot, double x, double y, double rputA, double uputA, double labSep, int refPt, double refA) { isSumRotation = isSumRot; dx = x; dy = y; angleRput = rputA; angleUput = uputA; labelSep = labSep; if(refPt==REF_POINT_LEFT || refPt==REF_POINT_BOTTOM || refPt== REF_POINT_BOTTOM+REF_POINT_LEFT || refPt==REF_POINT_BOTTOM+REF_POINT_RIGHT || refPt==REF_POINT_DEFAULT_CENTER || refPt==REF_POINT_RIGHT || refPt==REF_POINT_TOP || refPt==REF_POINT_TOP+REF_POINT_LEFT || refPt==REF_POINT_TOP+REF_POINT_RIGHT || refPt==REF_POINT_BASE || refPt==REF_POINT_BASE+REF_POINT_LEFT || refPt==REF_POINT_BASE+REF_POINT_RIGHT) refPoint = refPt; else refPoint = REF_POINT_DEFAULT_CENTER; if(refA==REF_POINT_LEFT || refA==REF_POINT_BOTTOM || refA== REF_POINT_BOTTOM+REF_POINT_LEFT || refA==REF_POINT_BOTTOM+REF_POINT_RIGHT || refA==REF_POINT_DEFAULT_CENTER || refA==REF_POINT_RIGHT || refA==REF_POINT_TOP || refA==REF_POINT_TOP+REF_POINT_LEFT || refA==REF_POINT_TOP+REF_POINT_RIGHT || refA==REF_POINT_BASE || refA==REF_POINT_BASE+REF_POINT_LEFT || refA==REF_POINT_BASE+REF_POINT_RIGHT) refAngle = refA; else refAngle = REF_POINT_RIGHT; } @Override public String toString() { return "PositionParameters : ";//$NON-NLS-1$//$NON-NLS-2$ } @Override public Object clone() throws CloneNotSupportedException { return super.clone(); } } public static boolean isCentered = false; public static Point2D.Double pictureSWPt=null; public static Point2D.Double pictureNEPt=null; public static String tokenPosition = "";//$NON-NLS-1$ private PositionParameters position; public String axesStyle; public String[] arrowStyle; public double arrowSizeD; public double arrowSizeN; public double arrowLgth; public double arrowInset; public double arrowTBarSD; public double arrowTBarSN; public double arrowBrLgth; public double arrowrBrLgth; public double arrowDotSD; public double arrowDotSN; public double arrowScale1; public double arrowScale2; public double arcSep; public double arcSepA; public double arcSepB; public boolean boxSep; public Color borderColor; public String borderPos; public double border; public double curvature1; public double curvature2; public double curvature3; public double dxIncrement; public double dyIncrement; public double dxLabelDist; public double dyLabelDist; public String dotStyle; public double dotScale1; public double dotScale2; public double dotAngle; public double dotStep; public double dashBlack; public double dashWhite; public boolean dbleLine; public double dbleSep; public Color dbleColor; public double degrees; public double frameSep; public double frameArc; public String fillStyle; public Color fillColor; public double gridWidth; public double gridLabel; public int gridDots; public double gradAngle; public Color gridColor; public double gradMidPoint; public Color gradBegin; public Color gradEnd; public int gradLines; public double gangle; public double hatchWidth; public double hatchSep; public Color hatchCol; public double hatchAngle; public boolean isCornerRel; public boolean isShadow; public double lineWidth; public Color lineColor; public Color labelsGridCol; public String labels; public double lineArc; public String lineStyle; public double ox; public double oy; public boolean onRadians; public Point2D.Double origin; public boolean specialCoor; public boolean showPoints; public boolean showOrigin; public double subGridWidth; public boolean swapAxes; public Color shadowCol; public Color subGridCol; public double shadowAngle; public double shadowSize; public int subGridDots; public int subGridDiv; public String ticks; public String ticksStyle; public double ticksSize; public boolean textItalic; public boolean textBold; public String textEnc; public String textShape; public String textSeries; public String textFamily; public Color textColor; public String textSize; public String textParsed; public double unit; public double xUnit; public double yUnit; public Vector psBox = new Vector(); public Text psBoxText; public boolean fromFramedBox; /** The parsed text which is transfered by psframe commands to the rput PSTParameters. */ public String textForFrame; public PsCustomParameters psCustomP; /** * The constructor by default. */ public PSTParameters() { psCustomP = new PsCustomParameters(); textForFrame = "";//$NON-NLS-1$ fromFramedBox = false; textParsed = "";//$NON-NLS-1$ position = null; textBold = false; textItalic = false; boxSep = PSTricksConstants.DEFAULT_BOX_SEP; frameSep = PSTricksConstants.DEFAULT_FRAME_SEP; gradAngle = PSTricksConstants.DEFAULT_GRADIENT_ANGLE; gradMidPoint = PSTricksConstants.DEFAULT_GRADIENT_MID_POINT; gradLines = PSTricksConstants.DEFAULT_GRADIENT_LINES; gradBegin = PSTricksConstants.DEFAULT_GRADIENT_START_COLOR; gradEnd = PSTricksConstants.DEFAULT_GRADIENT_END_COLOR; gangle = PSTricksConstants.DEFAULT_GANGLE; specialCoor = PSTricksConstants.DEFAULT_SPECIAL_COOR; onRadians = PSTricksConstants.DEFAULT_ON_RADIANS; degrees = PSTricksConstants.DEFAULT_DEGREES; unit = PSTricksConstants.DEFAULT_UNIT; xUnit = PSTricksConstants.DEFAULT_UNIT; yUnit = PSTricksConstants.DEFAULT_UNIT; lineWidth = PSTricksConstants.DEFAULT_LINE_WIDTH; lineColor = PSTricksConstants.DEFAULT_LINE_COLOR; showPoints = PSTricksConstants.DEFAULT_SHOW_POINTS; lineArc = PSTricksConstants.DEFAULT_LINE_ARC; frameArc = PSTricksConstants.DEFAULT_FRAME_ARC; isCornerRel = PSTricksConstants.DEFAULT_CORNER_SIZE_RELATIVE; arcSep = PSTricksConstants.DEFAULT_ARC_SEP; arcSepA = PSTricksConstants.DEFAULT_ARC_SEP_A; arcSepB = PSTricksConstants.DEFAULT_ARC_SEP_B; curvature1 = PSTricksConstants.DEFAULT_CURVATURE_NUM1; curvature2 = PSTricksConstants.DEFAULT_CRUVATURE_NUM2; curvature3 = PSTricksConstants.DEFAULT_CRUVATURE_NUM3; dotStyle = PSTricksConstants.DEFAULT_DOT_STYLE; dotScale1 = PSTricksConstants.DEFAULT_DOT_SCALE1; dotScale2 = PSTricksConstants.DEFAULT_DOT_SCALE2; dotAngle = PSTricksConstants.DEFAULT_DOT_ANGLE; gridWidth = PSTricksConstants.DEFAULT_GRID_WIDTH; gridLabel = PSTricksConstants.DEFAULT_GRID_LABEL/PSTricksConstants.CM_VAL_PT; subGridWidth= PSTricksConstants.DEFAULT_SUB_GRID_WIDTH; subGridCol = PSTricksConstants.DEFAULT_SUB_GRID_COLOR; gridColor = PSTricksConstants.DEFAULT_GRIDCOLOR; labelsGridCol = PSTricksConstants.DEFAULT_LABELGRIDCOLOR; subGridDiv = PSTricksConstants.DEFAULT_SUBGRIDDIV; gridDots = PSTricksConstants.DEFAULT_GRIDDOTS; subGridDots = PSTricksConstants.DEFAULT_SUBGRIDDOTS; swapAxes = PSTricksConstants.DEFAULT_SWAP_AXES; origin = (Point2D.Double)PSTricksConstants.DEFAULT_ORIGIN.clone(); lineStyle = PSTricksConstants.DEFAULT_LINE_STYLE; dotStep = PSTricksConstants.DEFAULT_DOT_STEP; dashBlack = PSTricksConstants.DEFAULT_DASH_BLACK; dashWhite = PSTricksConstants.DEFAULT_DASH_WHITE; borderColor = PSTricksConstants.DEFAULT_BORDER_COLOR; border = PSTricksConstants.DEFAULT_BORDER; dbleLine = PSTricksConstants.DEFAULT_DOUBLE_LINE; dbleSep = PSTricksConstants.DEFAULT_DOUBLE_SEP; dbleColor = PSTricksConstants.DEFAULT_DOUBLE_COLOR; shadowCol = PSTricksConstants.DEFAULT_SHADOW_COLOR; isShadow = PSTricksConstants.DEFAULT_SHADOW; shadowAngle = PSTricksConstants.DEFAULT_SHADOW_ANGLE; shadowSize = PSTricksConstants.DEFAULT_SHADOW_SIZE; borderPos = PSTricksConstants.DEFAULT_BORDERS_POS; fillStyle = PSTricksConstants.DEFAULT_FILL_STYLE; fillColor = PSTricksConstants.DEFAULT_FILL_COLOR; hatchWidth = PSTricksConstants.DEFAULT_HATCH_WIDTH; hatchSep = PSTricksConstants.DEFAULT_HATCH_SEP; hatchCol = PSTricksConstants.DEFAULT_HATCHING_COLOR; hatchAngle = PSTricksConstants.DEFAULT_HATCH_ANGLE; arrowStyle = new String[2]; arrowStyle[0] = PSTricksConstants.DEFAULT_ARROW_STYLE; arrowStyle[1] = PSTricksConstants.DEFAULT_ARROW_STYLE; arrowSizeD = PSTricksConstants.DEFAULT_ARROW_SIZE_DIM; arrowSizeN = PSTricksConstants.DEFAULT_ARROW_SIZE_NUM; arrowLgth = PSTricksConstants.DEFAULT_ARROW_LENGTH; arrowInset = PSTricksConstants.DEFAULT_ARROW_INSET; arrowTBarSD = PSTricksConstants.DEFAULT_ARROW_TBARSIZE_DIM; arrowTBarSN = PSTricksConstants.DEFAULT_ARROW_TBARSIZE_NUM; arrowBrLgth = PSTricksConstants.DEFAULT_ARROW_BRACKET_LGTH; arrowrBrLgth= PSTricksConstants.DEFAULT_ARROW_RBRACKET_LGTH; arrowDotSD = PSTricksConstants.DEFAULT_ARROW_DOTSIZE_DIM; arrowDotSN = PSTricksConstants.DEFAULT_ARROW_DOTSIZE_NUM; arrowScale1 = PSTricksConstants.DEFAULT_ARROW_SCALE1; arrowScale2 = PSTricksConstants.DEFAULT_ARROW_SCALE2; textEnc = null; textShape = null; textSeries = null; textFamily = null; textColor = Color.BLACK; textSize = PSTricksConstants.COMMAND_TEXT_NORMAL; psBoxText = new Text(null, false); psBox = new Vector(); showOrigin = PSTricksConstants.DEFAULT_SHOW_ORIGIN; axesStyle = PSTricksConstants.DEFAULT_AXES_STYLE; ticks = PSTricksConstants.DEFAULT_TICKS_DISPLAYED; ticksSize = PSTricksConstants.DEFAULT_TICKS_SIZE; ticksStyle = PSTricksConstants.DEFAULT_TICKS_STYLE; labels = PSTricksConstants.DEFAULT_LABELS_DISPLAYED; ox = PSTricksConstants.DEFAULT_OX; oy = PSTricksConstants.DEFAULT_OY; dxIncrement = PSTricksConstants.DEFAULT_DX; dyIncrement = PSTricksConstants.DEFAULT_DY; dxLabelDist = PSTricksConstants.DEFAULT_DIST_X_LABEL; dyLabelDist = PSTricksConstants.DEFAULT_DIST_Y_LABEL; } /** * The constructor that copies a PSTParameters from another. */ public PSTParameters(PSTParameters toCopy) { try { psCustomP = (PsCustomParameters)toCopy.psCustomP.clone(); } catch(CloneNotSupportedException e) { psCustomP = new PsCustomParameters(); } textForFrame = "";//$NON-NLS-1$ boxSep = toCopy.boxSep; frameSep = toCopy.frameSep; fromFramedBox = toCopy.fromFramedBox; textParsed = "";//$NON-NLS-1$ position = null; gradAngle = toCopy.gradAngle; gradBegin = toCopy.gradBegin; gradEnd = toCopy.gradEnd; gradLines = toCopy.gradLines; gradMidPoint = toCopy.gradMidPoint; textBold = toCopy.textBold; textItalic = toCopy.textItalic; gangle = toCopy.gangle; specialCoor = toCopy.specialCoor; onRadians = toCopy.onRadians; degrees = toCopy.degrees; xUnit = toCopy.xUnit; yUnit = toCopy.yUnit; unit = toCopy.unit; lineWidth = toCopy.lineWidth; lineColor = toCopy.lineColor; showPoints = toCopy.showPoints; lineArc = toCopy.lineArc; frameArc = toCopy.frameArc; isCornerRel = toCopy.isCornerRel; arcSep = toCopy.arcSep; arcSepA = toCopy.arcSepA; arcSepB = toCopy.arcSepB; curvature1 = toCopy.curvature1; curvature2 = toCopy.curvature2; curvature3 = toCopy.curvature3; dotStyle = toCopy.dotStyle; dotScale1 = toCopy.dotScale1; dotScale2 = toCopy.dotScale2; dotAngle = toCopy.dotAngle; gridWidth = toCopy.gridWidth; gridLabel = toCopy.gridLabel; subGridWidth= toCopy.subGridWidth; subGridCol = toCopy.subGridCol; gridColor = toCopy.gridColor; labelsGridCol = toCopy.labelsGridCol; subGridDiv = toCopy.subGridDiv; gridDots = toCopy.gridDots; subGridDots = toCopy.subGridDots; swapAxes = toCopy.swapAxes; origin = new Point2D.Double(toCopy.origin.x, toCopy.origin.y); lineStyle = toCopy.lineStyle; dotStep = toCopy.dotStep; dashBlack = toCopy.dashBlack; dashWhite = toCopy.dashWhite; borderColor = toCopy.borderColor; border = toCopy.border; dbleLine = toCopy.dbleLine; dbleSep = toCopy.dbleSep; dbleColor = toCopy.dbleColor; shadowCol = toCopy.shadowCol; isShadow = toCopy.isShadow; shadowAngle = toCopy.shadowAngle; shadowSize = toCopy.shadowSize; borderPos = toCopy.borderPos; fillStyle = toCopy.fillStyle; fillColor = toCopy.fillColor; hatchWidth = toCopy.hatchWidth; hatchSep = toCopy.hatchSep; hatchCol = toCopy.hatchCol; hatchAngle = toCopy.hatchAngle; arrowStyle = new String[2]; arrowStyle[0] = toCopy.arrowStyle[0]; arrowStyle[1] = toCopy.arrowStyle[1]; arrowSizeD = toCopy.arrowSizeD; arrowSizeN = toCopy.arrowSizeN; arrowLgth = toCopy.arrowLgth; arrowInset = toCopy.arrowInset; arrowTBarSD = toCopy.arrowTBarSD; arrowTBarSN = toCopy.arrowTBarSN; arrowBrLgth = toCopy.arrowBrLgth; arrowrBrLgth= toCopy.arrowrBrLgth; arrowDotSD = toCopy.arrowDotSD; arrowDotSN = toCopy.arrowDotSN; arrowScale1 = toCopy.arrowScale1; arrowScale2 = toCopy.arrowScale2; textEnc = toCopy.textEnc; textShape = toCopy.textShape; textSeries = toCopy.textSeries; textFamily = toCopy.textFamily; textColor = toCopy.textColor; textSize = toCopy.textSize; psBoxText = new Text(null, false); psBox = new Vector(); showOrigin = toCopy.showOrigin; axesStyle = toCopy.axesStyle; ticks = toCopy.ticks; ticksSize = toCopy.ticksSize; ticksStyle = toCopy.ticksStyle; labels = toCopy.labels; ox = toCopy.ox; oy = toCopy.oy; dxIncrement = toCopy.dxIncrement; dyIncrement = toCopy.dyIncrement; dxLabelDist = toCopy.dxLabelDist; dyLabelDist = toCopy.dyLabelDist; } /** * @return the position. */ public PositionParameters getPosition() { return position; } /** * Sets a new position. */ public void setPosition(double dx, double dy, boolean isSumRot, double rputA, double uputA, int refPt, double labelSep, double refAngle) { position = new PositionParameters(isSumRot, dx, dy, rputA, uputA, labelSep, refPt, refAngle); } /** * @return The whole rotation angle (in degrees). */ public static double getWholeRotationAngle(Vector params) { int i=0, size = params.size(); double sum=0; if(size>0) { PositionParameters pos = params.elementAt(i).getPosition(); if(pos!=null) { if(pos.isSumRotation) sum+=pos.angleRput; else sum = pos.angleRput; } } for(i=1; i *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 11/21/08
    * @author Arnaud BLOUIN
    * @version 2.0.2
    */ public class PSTParametersParser extends CodeParser { /** The current pstricks parameters. */ protected PSTParameters param; /** * Creates and initialises a pstricks parameters parser. * @param code The code to parse. * @param params The current pstricks parameters that will be filled * during the parsing. Can be null. * @throws IllegalArgumentException If the given code is null. */ public PSTParametersParser(String code, PSTParameters params) { super(code); this.param = params; } /** * Skips the useless characters and a possible comma. * @since 2.0.2 */ public void skipWSPComma() { skipWSP(); if(getChar()==',') { nextChar(); skipWSP(); } } private void parse_s() throws IgnoreCommandException { switch(nextChar()) { case 'h' : //sh switch(nextChar()) { case 'a' : // sha if(nextChar()=='d' && nextChar()=='o' && nextChar()=='w') // shadow switch(nextChar()) { case 's' : // shadowsize = Real unit if(nextChar()=='i' && nextChar()=='z' && nextChar()=='e' && (nextChar()=='=' || isWSPComment())) { double val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.shadowSize = val; } else throw new IgnoreCommandException(-1); break; case 'a' : // shadowangle = Real if(nextChar()=='n' && nextChar()=='g' && nextChar()=='l' && nextChar()=='e' && (nextChar()=='=' || isWSPComment())) { double val = readEqualReal(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.shadowAngle = val; } else throw new IgnoreCommandException(-1); break; case 'c' : // shadowcolor = String if(nextChar()=='o' && nextChar()=='l' && nextChar()=='o' && nextChar()=='r' && (nextChar()=='=' || isWSPComment())) { String s2 = readEqualString(true); Color c = DviPsColors.getColour(s2); // We search the colour if(c==null) throw new IgnoreCommandException(-1); param.shadowCol = c; } else throw new IgnoreCommandException(-1); break; default : skipWSPComments(); if((getChar()=='=' || isWSPComment())) {// shadow String s = readEqualString(false); if("true".equals(s)) param.isShadow = true;//$NON-NLS-1$ else if("false".equals(s)) param.isShadow = false;//$NON-NLS-1$ else throw new IgnoreCommandException(-1); } else throw new IgnoreCommandException(-1); } else throw new IgnoreCommandException(-1); break; case 'o' : // sho if(nextChar()=='w')//show switch(nextChar()) { case 'p'://showp if(nextChar()=='o' && nextChar()=='i' && nextChar()=='n' && nextChar()=='t' && nextChar()=='s' && (nextChar()=='=' || isWSPComment())) {//showpoints = true|false String s = readEqualString(false); if("true".equals(s)) param.showPoints = true;//$NON-NLS-1$ else if("false".equals(s)) param.showPoints = false;//$NON-NLS-1$ else throw new IgnoreCommandException(-1); } else throw new IgnoreCommandException(-1); break; case 'o'://showo if(nextChar()=='r' && nextChar()=='i' && nextChar()=='g' && nextChar()=='i' && nextChar()=='n' && (nextChar()=='=' || isWSPComment())) {//showorigin = true|false String s = readEqualString(false); if("true".equals(s)) param.showOrigin = true;//$NON-NLS-1$ else if("false".equals(s)) param.showOrigin = false;//$NON-NLS-1$ else throw new IgnoreCommandException(-1); } else throw new IgnoreCommandException(-1); break; default: throw new IgnoreCommandException(-1); } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } break; case 'u' : // su if(nextChar()=='b' && nextChar()=='g' && nextChar()=='r' && nextChar()=='i' && nextChar()=='d') // subgrid { switch(nextChar()) { case 'd' : // subgridd switch(nextChar()) { case 'o' : // subgriddots = Integer if(nextChar()=='t' && nextChar()=='s' && (nextChar()=='=' || isWSPComment())) { int val = readEqualInteger(); if(val==Integer.MAX_VALUE) throw new IgnoreCommandException(-1); param.subGridDots = val; } else throw new IgnoreCommandException(-1); break; case 'i' : // subgriddiv = Integer if(nextChar()=='v' && (nextChar()=='=' || isWSPComment())) { int val = readEqualInteger(); if(val==Integer.MAX_VALUE) throw new IgnoreCommandException(-1); param.subGridDiv = val; } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } break; case 'w' : // subgridwidth = Real unit if(nextChar()=='i' && nextChar()=='d' && nextChar()=='t' && nextChar()=='h' && (nextChar()=='=' || isWSPComment())) { double val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.subGridWidth = val; } else throw new IgnoreCommandException(-1); break; case 'c': // subgridcolor = String if(nextChar()=='o' && nextChar()=='l' && nextChar()=='o' && nextChar()=='r' && (nextChar()=='=' || isWSPComment())) { String s2 = readEqualString(true); Color c = DviPsColors.getColour(s2); // We search the colour if(c==null) throw new IgnoreCommandException(-1); param.subGridCol = c; } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } }else throw new IgnoreCommandException(-1); break; case 'w' : // swapaxes = true|false if(nextChar()=='a' && nextChar()=='p' && nextChar()=='a' && nextChar()=='x' && nextChar()=='e' && nextChar()=='s' && (nextChar()=='=' || isWSPComment())) { String s = readEqualString(false); if("true".equals(s)) param.swapAxes = true;//$NON-NLS-1$ else if("false".equals(s)) param.swapAxes = false;//$NON-NLS-1$ else throw new IgnoreCommandException(-1); } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } } private void parse_d() throws IgnoreCommandException { switch(nextChar()) { case 'o' : // do switch(nextChar()) { case 't' : // dot switch(nextChar()) { case 's' : // dots switch(nextChar()) { case 'i' : //dotsize = Real unit Real if(nextChar()=='z' && nextChar()=='e' && (nextChar()=='=' || isWSPComment())) { double val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.arrowDotSD = val; skipWSPComments(); if(Character.isDigit(getChar()) || getChar()=='.') { val = readReal();// If there is the x, we read it if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.arrowDotSN = val; } else param.arrowDotSN = 0.; } else throw new IgnoreCommandException(-1); break; case 't' : // dotstyle = String if(nextChar()=='y' && nextChar()=='l' && nextChar()=='e' && (nextChar()=='=' || isWSPComment())) { skipWSPComments(); if(getChar()!='=') throw new IgnoreCommandException(-1); nextChar(); skipWSPComments(); String s; if(getChar()=='|' || getChar()=='+') { s = String.valueOf((char)getChar()); nextChar(); } else { s = readString(false); if(getChar()=='*') { s+=String.valueOf((char)getChar()); nextChar(); } } if(!PSTricksConstants.isValidDotStyle(s)) throw new IgnoreCommandException(-1); param.dotStyle = s; } else throw new IgnoreCommandException(-1); break; case 'c' : // dotscale = Real Real if(nextChar()=='a' && nextChar()=='l' && nextChar()=='e' && (nextChar()=='=' || isWSPComment())) { double val = readEqualReal(); // We read the first parameter if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.dotScale1 = val; if(Character.isDigit(getChar()) || getChar()=='.') { val = readReal();// If there is the x, we read it if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.dotScale2 = val; } else param.dotScale2 = 1.; } else throw new IgnoreCommandException(-1); break; case 'e' : // dotsep = Real unit if(nextChar()=='p' && (nextChar()=='=' || isWSPComment())) { double val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.dotStep = val; } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } break; case 'a' : // dotangle = Real if(nextChar()=='n' && nextChar()=='g' && nextChar()=='l' && nextChar()=='e' && (nextChar()=='=' || isWSPComment())) { double val = readEqualReal(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.dotAngle = val; } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } break; case 'u' : // dou if(nextChar()=='b' && nextChar()=='l' && nextChar()=='e') // double switch(nextChar()) { case 'l' : // doubleline = true/false if(nextChar()=='i' && nextChar()=='n' && nextChar()=='e' && (nextChar()=='=' || isWSPComment())) { String s = readEqualString(false); if(s==null) throw new IgnoreCommandException(-1); if(s.equals("true")) param.dbleLine = true;//$NON-NLS-1$ else if(s.equals("false")) param.dbleLine = false;//$NON-NLS-1$ } else throw new IgnoreCommandException(-1); break; case 's' : // doublesep = Real unit if(nextChar()=='e' && nextChar()=='p' && (nextChar()=='=' || isWSPComment())) { double val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.dbleSep = val; } else throw new IgnoreCommandException(-1); break; case 'c' : // doubleColor = String if(nextChar()=='o' && nextChar()=='l' && nextChar()=='o' && nextChar()=='r' && (nextChar()=='=' || isWSPComment())) { String s2 = readEqualString(true); Color c = DviPsColors.getColour(s2); // We search the colour if(c==null) throw new IgnoreCommandException(-1); param.dbleColor = c; } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } break; case 'i' : // dimen = outer|inner|middle if(nextChar()=='m' && nextChar()=='e' && nextChar()=='n' && (nextChar()=='=' || isWSPComment())) { String s = readEqualString(false); if(PSTricksConstants.BORDERS_INSIDE.equals(s) || PSTricksConstants.BORDERS_MIDDLE.equals(s) || PSTricksConstants.BORDERS_OUTSIDE.equals(s)) param.borderPos = s; else throw new IgnoreCommandException(-1); } else throw new IgnoreCommandException(-1); break; case 'a' : // dash = Real unit Real unit if(nextChar()=='s' && nextChar()=='h' && (nextChar()=='=' || isWSPComment())) { double r1 = readEqualRealUnit(); if(Double.isNaN(r1)) throw new IgnoreCommandException(-1); double r2 = readRealUnit(); // We read the second parameter if(Double.isNaN(r2)) throw new IgnoreCommandException(-1); param.dashBlack = r1; param.dashWhite = r2; } else throw new IgnoreCommandException(-1); break; case 'x'://dx = real unit if((nextChar()=='=' || isWSPComment())) { double val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.dxLabelDist = val; } else throw new IgnoreCommandException(-1); break; case 'y'://dy = real unit if((nextChar()=='=' || isWSPComment())) { double val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.dyLabelDist = val; } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } } private void parse_a() throws IgnoreCommandException { switch(getChar()) { case 'r': switch(nextChar()) { case 'c' : //arc if(nextChar()=='s' && nextChar()=='e' && nextChar()=='p') // arcsep switch(nextChar()) { case 'A' : // arcsepA = Real unit double val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.arcSepA = val; break; case 'B' : // arcSepB = Real unit val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.arcSepB = val; break; default : if(nextChar()=='=' || isWSPComment()) { // arcsep = Real val = readEqualReal(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.arcSep = val; } else throw new IgnoreCommandException(-1); } else throw new IgnoreCommandException(-1); break; case 'r' : //arr if(nextChar()=='o' && nextChar()=='w') // arrow switch(nextChar()) { case 's' : // arrows switch(nextChar()) { case 'i' : // arrowsize= Real unit Real if(nextChar()=='z' && nextChar()=='e' && (nextChar()=='=' || isWSPComment())) { double val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.arrowSizeD = val; skipWSPComments(); if((getChar()>='0' && getChar()<='9') || getChar()=='.') { val = readReal(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.arrowSizeN = val;// If there is the x, we read it } } else throw new IgnoreCommandException(-1); break; case '=': nextChar(); skipWSPComments(); if(getChar()!='-') { param.arrowStyle[0] = String.valueOf((char)getChar()); nextChar(); skipWSPComments(); if(getChar()!='-') throw new IgnoreCommandException(-1); } nextChar(); skipWSPComments(); if(getChar()!=',' || getChar()!=']') param.arrowStyle[1] = String.valueOf((char)getChar()); nextChar(); break; default: throw new IgnoreCommandException(-1); } break; case 'l' : // arrowlength = Real if(nextChar()=='e' && nextChar()=='n' && nextChar()=='g' && nextChar()=='t' && nextChar()=='h' && (nextChar()=='=' || isWSPComment())) { double val = readEqualReal(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.arrowLgth = val; } else throw new IgnoreCommandException(-1); break; case 'i' : // arrowinset = Real if(nextChar()=='n' && nextChar()=='s' && nextChar()=='e' && nextChar()=='t' && (nextChar()=='=' || isWSPComment())) { double val = readEqualReal(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.arrowInset = val; } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } // switch(params.charAt(id[0])) else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } // switch(params.charAt(id[0])) break; case 'x': // ax if(nextChar()=='e' && nextChar()=='s' && nextChar()=='s' && nextChar()=='t' && nextChar()=='y' && nextChar()=='l' && nextChar()=='e' && (nextChar()=='=' || isWSPComment())) {// axestyle String val = readEqualString(true); if(val==null) throw new IgnoreCommandException(-1); param.axesStyle = val; } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } } private void parse_g() throws IgnoreCommandException { switch(nextChar()) { case 'r' : //gr switch(nextChar()) { case 'i': if(nextChar()=='d')// grid switch(nextChar()) { case 'l' ://gridl if(nextChar()=='a' && nextChar()=='b' && nextChar()=='e' && nextChar()=='l')// gridlabel switch(nextChar()) { case 's' : // gridlabels = Real unit double val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.gridLabel = val; break; case 'c' : // gridlabelcolor = string Color c = DviPsColors.getColour(readEqualString(true)); if(c==null) throw new IgnoreCommandException(-1); param.labelsGridCol = c; break; default : throw new IgnoreCommandException(-1); } else throw new IgnoreCommandException(-1); break; case 'w' : //gridwidth = Real unit if(nextChar()=='i' && nextChar()=='d' && nextChar()=='t' && nextChar()=='h' && (nextChar()=='=' || isWSPComment())) { double val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.gridWidth = val; } else throw new IgnoreCommandException(-1); break; case 'c' : // gridcolor = string if(nextChar()=='o' && nextChar()=='l' && nextChar()=='o' && nextChar()=='r' && (nextChar()=='=' || isWSPComment())) { String s = readEqualString(true); Color c = DviPsColors.getColour(s); // We search the colour if(c==null) throw new IgnoreCommandException(-1); param.gridColor = c; } else throw new IgnoreCommandException(-1); break; case 'd' : // griddots = Integer if(nextChar()=='o' && nextChar()=='t' && nextChar()=='s' && (nextChar()=='=' || isWSPComment())) { int val = readEqualInteger(); if(val==Integer.MAX_VALUE) throw new IgnoreCommandException(-1); param.gridDots = val; } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } else throw new IgnoreCommandException(-1); break; case 'a'://gra if(nextChar()=='d')// grad switch(nextChar()) { case 'b' : //gradbegin if(nextChar()=='e' && nextChar()=='g' && nextChar()=='i' && nextChar()=='n' && (nextChar()=='=' || isWSPComment())) { Color c = DviPsColors.getColour(readEqualString(true)); // We search the colour if(c==null) throw new IgnoreCommandException(-1); param.gradBegin = c; } else throw new IgnoreCommandException(-1); break; case 'e' : //gradend if(nextChar()=='n' && nextChar()=='d' && (nextChar()=='=' || isWSPComment())) { Color c = DviPsColors.getColour(readEqualString(true)); // We search the colour if(c==null) throw new IgnoreCommandException(-1); param.gradEnd = c; } else throw new IgnoreCommandException(-1); break; case 'l' : //gradlines if(nextChar()=='i' && nextChar()=='n' && nextChar()=='e' && nextChar()=='s' && (nextChar()=='=' || isWSPComment())) { int val = readEqualInteger(); if(val==Integer.MAX_VALUE) throw new IgnoreCommandException(-1); param.gradLines = val; } else throw new IgnoreCommandException(-1); break; case 'm' : //gradmidpoint if(nextChar()=='i' && nextChar()=='d' && nextChar()=='p' && nextChar()=='o' && nextChar()=='i' && nextChar()=='n' && nextChar()=='t' && (nextChar()=='=' || isWSPComment())) { double midPt = readEqualReal(); if(midPt>=0 && midPt<=1) param.gradMidPoint = midPt; else throw new IgnoreCommandException(-1); } else throw new IgnoreCommandException(-1); break; case 'a' : //gradangle if(nextChar()=='n' && nextChar()=='g' && nextChar()=='l' && nextChar()=='e' && (nextChar()=='=' || isWSPComment())) { double val = readEqualReal(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.gradAngle = val; } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } break; case 'a' : //gangle if(nextChar()=='n' && nextChar()=='g' && nextChar()=='l' && nextChar()=='e' && (nextChar()=='=' || isWSPComment())) { double val = readEqualReal(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.gangle = val; } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } } private void parse_l() throws IgnoreCommandException { switch(nextChar()) { case 'i':// li if(nextChar()=='n' && nextChar()=='e')// line switch(nextChar()) { case 'w' : // linewidth = Real unit if(nextChar()=='i' && nextChar()=='d' && nextChar()=='t' && nextChar()=='h' && (nextChar()=='=' || isWSPComment())) { double val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.lineWidth = val; } else throw new IgnoreCommandException(-1); break; case 'c' : // lineColor = string if(nextChar()=='o' && nextChar()=='l' && nextChar()=='o' && nextChar()=='r' && (nextChar()=='=' || isWSPComment())) { Color c = DviPsColors.getColour(readEqualString(true)); // We search the colour if(c==null) throw new IgnoreCommandException(-1); param.lineColor = c; } else throw new IgnoreCommandException(-1); break; case 'a' : // linearc = Real unit if(nextChar()=='r' && nextChar()=='c' && (nextChar()=='=' || isWSPComment())) { double val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.lineArc = val; } else throw new IgnoreCommandException(-1); break; case 's' : //lines if(nextChar()=='t' && nextChar()=='y' && nextChar()=='l' && nextChar()=='e' && (nextChar()=='=' || isWSPComment()))// linestyle = string { String val = readEqualString(false); if(val==null || val.length()==0) throw new IgnoreCommandException(-1); param.lineStyle = val; } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } else throw new IgnoreCommandException(-1); break; case 'a':// la if(nextChar()=='b' && nextChar()=='e' && nextChar()=='l' && nextChar()=='s'&& (nextChar()=='=' || isWSPComment()))//labels { String val = readEqualString(false); if(val==null) throw new IgnoreCommandException(-1); param.labels = val; } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } } private void parse_f() throws IgnoreCommandException { switch(nextChar()) { case 'i': //fi if(nextChar()=='l' && nextChar()=='l')//fill { if(nextChar()=='c')//fillc { if(nextChar()=='o' && nextChar()=='l' && nextChar()=='o' && nextChar()=='r' && (nextChar()=='=' || isWSPComment())) { // fillColor = string Color c = DviPsColors.getColour(readEqualString(true)); // We search the colour if(c==null) throw new IgnoreCommandException(-1); param.fillColor = c; } else throw new IgnoreCommandException(-1); }else if(getChar()=='s')//fills { if(nextChar()=='t' && nextChar()=='y' && nextChar()=='l' && nextChar()=='e' && (nextChar()=='=' || isWSPComment())) { // fillstyle = string String r = readEqualString(false); if(r==null || r.length()==0) throw new IgnoreCommandException(-1); if(getChar()=='*') // We add the '*' the fillstyle { r+=String.valueOf((char)getChar()); nextChar(); } param.fillStyle = r; }else throw new IgnoreCommandException(-1); }else throw new IgnoreCommandException(-1); }else throw new IgnoreCommandException(-1); break; case 'r': //fr if(nextChar()=='a' && nextChar()=='m' && nextChar()=='e')//frame switch(nextChar()) { case 'a' : // framearc = real if(nextChar()=='r' && nextChar()=='c' && (nextChar()=='=' || isWSPComment())) { double val = readEqualReal(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.frameArc = val; } else throw new IgnoreCommandException(-1); break; case 's' : // framesep = real unit if(nextChar()=='e' && nextChar()=='p' && (nextChar()=='=' || isWSPComment())) { double val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.frameSep = val; } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } } private void parse_b() throws IgnoreCommandException { switch(nextChar()) { case 'o' ://bo switch(nextChar()) { case 'r'://bor if(nextChar()=='d' && nextChar()=='e' && nextChar()=='r')//border if(nextChar()=='c')//borderc { if(nextChar()=='o' && nextChar()=='l' && nextChar()=='o' && nextChar()=='r' && (nextChar()=='=' || isWSPComment())) { // bordercolor = string Color c = DviPsColors.getColour(readEqualString(true)); // We search the colour if(c==null) throw new IgnoreCommandException(-1); param.borderColor = c; } else throw new IgnoreCommandException(-1); }else if(nextChar()=='=' || isWSPComment()) {// border = Real unit double val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.border = val; } else throw new IgnoreCommandException(-1); else throw new IgnoreCommandException(-1); break; case 'x' : if(nextChar()=='s' && nextChar()=='e' && nextChar()=='p' && (nextChar()=='=' || isWSPComment())) {//boxsep = true|false String s = readEqualString(false); if(s==null) throw new IgnoreCommandException(-1); if(s.equals("true")) param.boxSep = true;//$NON-NLS-1$ else if(s.equals("false")) param.boxSep = false;//$NON-NLS-1$ } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } break; case 'r' : if(nextChar()=='a' && nextChar()=='c' && nextChar()=='k' && nextChar()=='e' && nextChar()=='t' && nextChar()=='l' && nextChar()=='e' && nextChar()=='n' && nextChar()=='g' && nextChar()=='t' && nextChar()=='h' && (nextChar()=='=' || isWSPComment())) { double val = readEqualReal(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.arrowBrLgth = val; } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } } private void parse_c() throws IgnoreCommandException { switch(nextChar()) { case 'o' : // cornersize = absolute/relative if(nextChar()=='r' && nextChar()=='n' && nextChar()=='e' && nextChar()=='r' && nextChar()=='s' && nextChar()=='i' && nextChar()=='z' && nextChar()=='e' &&(nextChar()=='=' || isWSPComment())) { String r = readString(false); // We read the parameter if(r==null) throw new IgnoreCommandException(-1); r = r.toLowerCase(); if(r.equals(PSTricksConstants.TOKEN_ABSOLUTE)) param.isCornerRel = false; else if(r.equals(PSTricksConstants.TOKEN_RELATIVE)) param.isCornerRel = true; else throw new IgnoreCommandException(-1); } else throw new IgnoreCommandException(-1); break; case 'u' : // curvate = Real Real Real if(nextChar()=='r' && nextChar()=='v' && nextChar()=='a' && nextChar()=='t' && nextChar()=='e' && (nextChar()=='=' || isWSPComment())) { double val1 = readEqualReal(); if(Double.isNaN(val1)) throw new IgnoreCommandException(-1); double val2 = readReal(); if(Double.isNaN(val2)) throw new IgnoreCommandException(-1); double val3 = readReal(); if(Double.isNaN(val3)) throw new IgnoreCommandException(-1); param.curvature1 = val1; param.curvature2 = val2; param.curvature3 = val3; } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } } private void parse_o() throws IgnoreCommandException { if(nextChar()=='r' && nextChar()=='i' && nextChar()=='g' && nextChar()=='i' && nextChar()=='n' && (nextChar()=='=' || isWSPComment())) {// origin skipWSPComments(); if(getChar()!='=') throw new IgnoreCommandException(-1); nextChar(); skipWSPComments(); double x=Double.NaN, y=Double.NaN; int c = getChar(); if((c>='0' && c<='9') || c=='.' || c=='-') { x = readRealUnit();// If there is the x, we read it if(Double.isNaN(x)) throw new IgnoreCommandException(-1); } skipWSPComments(); if(getChar()!=',') throw new IgnoreCommandException(-1); nextChar(); skipWSPComments(); c = getChar(); if((c>='0' && c<='9') || c=='.' || c=='-') { y = readRealUnit();// If there is the y, we read it if(Double.isNaN(y)) throw new IgnoreCommandException(-1); } skipWSPComments(); if(getChar()!='}') throw new IgnoreCommandException(-1); nextChar(); skipWSPComments(); if(!Double.isNaN(x)) param.origin.x = x; if(!Double.isNaN(y)) param.origin.y = y; } else throw new IgnoreCommandException(-1); } private void parse_h() throws IgnoreCommandException { if(nextChar()=='a' && nextChar()=='t' && nextChar()=='c' && nextChar()=='h') switch(nextChar()) { case 'a' : // hatchangle = Real if(nextChar()=='n' && nextChar()=='g' && nextChar()=='l' && nextChar()=='e' && (nextChar()=='=' || isWSPComment())) { double val = readEqualReal(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.hatchAngle = val; } else throw new IgnoreCommandException(-1); break; case 'w' : // hatchwidth = Real unit if(nextChar()=='i' && nextChar()=='d' && nextChar()=='t' && nextChar()=='h' && (nextChar()=='=' || isWSPComment())) { double val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.hatchWidth = val; } else throw new IgnoreCommandException(-1); break; case 's' : // hatchsep = Real unit if(nextChar()=='e' && nextChar()=='p' && (nextChar()=='=' || isWSPComment())) { double val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.hatchSep = val; } else throw new IgnoreCommandException(-1); break; case 'c' : // hatchcolor = colour if(nextChar()=='o' && nextChar()=='l' && nextChar()=='o' && nextChar()=='r' && (nextChar()=='=' || isWSPComment())) { Color c = DviPsColors.getColour(readEqualString(true)); // We search the colour if(c==null) throw new IgnoreCommandException(-1); param.hatchCol = c; } else throw new IgnoreCommandException(-1); break; default : throw new IgnoreCommandException(-1); } else throw new IgnoreCommandException(-1); } private void parse_r() throws IgnoreCommandException { if(nextChar()=='b' && nextChar()=='r' && nextChar()=='a' && nextChar()=='c' && nextChar()=='k' && nextChar()=='e' && nextChar()=='t' && nextChar()=='l' && nextChar()=='e' && nextChar()=='n' && nextChar()=='g' && nextChar()=='t' && nextChar()=='h' && (nextChar()=='=' || isWSPComment())) { // bracketlength = real double val = readEqualReal(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.arrowrBrLgth = val; } else throw new IgnoreCommandException(-1); } private void parse_t() throws IgnoreCommandException { switch(nextChar()) { case 'b': //tb if(nextChar()=='a' && nextChar()=='r' && nextChar()=='s' && nextChar()=='i' && nextChar()=='z' && nextChar()=='e' && (nextChar()=='=' || isWSPComment())) { // tbarsize = Real unit Real double val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.arrowTBarSD = val; skipWSPComments(); if((getChar()>='0' && getChar()<='9') || getChar()=='.') { val = readReal(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.arrowTBarSN = val; } } else throw new IgnoreCommandException(-1); break; case 'i': //ti if(nextChar()=='c' && nextChar()=='k' && nextChar()=='s')// ticks switch(nextChar()) { case 't'://tickst if(nextChar()=='y' && nextChar()=='l' && nextChar()=='e' && (nextChar()=='=' || isWSPComment())) {//tickstyle = string String val = readString(false); if(val==null) throw new IgnoreCommandException(-1); param.ticksStyle = val; } else throw new IgnoreCommandException(-1); break; case 'i'://ticksi if(nextChar()=='z' && nextChar()=='e' && (nextChar()=='=' || isWSPComment())) {//ticksize = real unit double val = readEqualRealUnit(); if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.ticksSize = val; } else throw new IgnoreCommandException(-1); break; default : if(getChar()=='=' || isWSPComment())//ticks = string { String val = readString(false); if(val==null) throw new IgnoreCommandException(-1); param.ticks = val; } else throw new IgnoreCommandException(-1); } break; } } private void parse_u() throws IgnoreCommandException { if(nextChar()=='n' && nextChar()=='i' && nextChar()=='t' && (nextChar()=='=' || isWSPComment())) { // unit = real double r = readEqualReal(); if(Double.isNaN(r)) throw new IgnoreCommandException(-1); skipWSPComments(); int c = getChar(); if((c>='0' && c<='9') && c!=',') { r = convertInCm(r, readString(false)); if(Double.isNaN(r)) throw new IgnoreCommandException(-1); param.unit = r; } else param.unit *= r; } else throw new IgnoreCommandException(-1); } private void parse_x() throws IgnoreCommandException { if(nextChar()=='u' && nextChar()=='n' && nextChar()=='i' && nextChar()=='t' && (nextChar()=='=' || isWSPComment())) { // xunit = real double r = readEqualReal(); if(Double.isNaN(r)) throw new IgnoreCommandException(-1); skipWSPComments(); int c = getChar(); if((c>='0' && c<='9') && c!=',') { r = convertInCm(r, readString(false)); if(Double.isNaN(r)) throw new IgnoreCommandException(-1); param.xUnit = r; } else param.xUnit *= r; } else throw new IgnoreCommandException(-1); } private void parse_y() throws IgnoreCommandException { if(nextChar()=='u' && nextChar()=='n' && nextChar()=='i' && nextChar()=='t' && (nextChar()=='=' || isWSPComment())) {// yunit = real double r = readEqualReal(); // We read the parameter if(Double.isNaN(r)) throw new IgnoreCommandException(-1); skipWSPComments(); int c = getChar(); if((c>='0' && c<='9') && c!=',') { r = convertInCm(r, readString(false)); if(Double.isNaN(r)) throw new IgnoreCommandException(-1); param.yUnit = r; } else param.yUnit *= r; } else throw new IgnoreCommandException(-1); } private void parse_O() throws IgnoreCommandException { switch(nextChar()) { case 'x': // Ox double val = readEqualReal(); // We read the parameter if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.ox = val; break; case 'y': // Oy val = readEqualReal(); // We read the parameter if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.oy = val; break; default: throw new IgnoreCommandException(-1); } } private void parse_D() throws IgnoreCommandException { switch(nextChar()) { case 'x': // Dx double val = readEqualReal(); // We read the parameter if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.dxIncrement = val; break; case 'y': // Dy val = readEqualReal(); // We read the parameter if(Double.isNaN(val)) throw new IgnoreCommandException(-1); param.dyIncrement = val; break; default: throw new IgnoreCommandException(-1); } } @Override public void parse() throws UnclosedBracketsException { skipWSPComments(); if(getChar()!='[') return ; nextChar(); skipWSPComments(); while(!isEOC() && getChar()!=']') try { switch(getChar()) { case 's' : parse_s(); break; case 'd' : parse_d(); break; case 'a' : parse_a(); break; case 'g' : parse_g(); break; case 'l' : parse_l(); break; case 'f' : parse_f(); break; case 'b' : parse_b(); break; case 'c' : parse_c(); break; case 'o' : // origin = {Real unit, Real unit} parse_o(); break; case 'h' : parse_h(); break; case 'r' :// rbracketlength = Real parse_r(); break; case 't' : parse_t(); break; case 'u' : // unit = Real unit parse_u(); break; case 'x' : // xunit = Real unit parse_x(); break; case 'y' : // yunit = Real unit parse_y(); break; case 'O': parse_O(); break; case 'D': parse_D(); break; case 9 : // '\t' case ',' : case ' ' : nextChar(); skipWSPComments(); break; default : if(isWSPComment()) { if(isEOL()) incLinePosition(); skipWSPComments(); } else throw new IgnoreCommandException(-1); }//switch } catch(IgnoreCommandException e) // We jump to the next parameter {//TODO add something to collect the errors. int cptPar = 0; int cptBrack = 0; int c = getChar(); while((c!=',' || cptPar!=0 || cptBrack!=0) && !isEOC() && c!=']') { if(c=='{') cptBrack++; else if(c=='(') cptPar++; else if(c=='}') cptBrack--; else if(c==')') cptPar--; c = nextChar(); } if(c!=']') nextChar(); } if(getChar()!=']') throw new UnclosedBracketsException(); nextChar(); } @Override public boolean isComment() { return getChar()=='%'; } @Override public String skipComment() { String comment; if(isComment()) { comment = ""; char c; while(!isEOL() && !isEOC()) { c = (char)nextChar(); if(!isEOL() && !isEOC()) comment += c; } nextChar(); incLinePosition(); skipWSP(); } else comment = null; return comment; } @Override public void skipWSP() { while(getChar()==' ' || isEOL() || getChar()=='\t') { if(isEOL()) incLinePosition(); nextChar(); } } @Override public boolean isWSP() { int c = getChar(); return c==' ' || c=='\n' || c=='\r'; } /** * @return True if the current token is a WPS or a comment token. * @since 2.0.2 */ public boolean isWSPComment() { return isWSP() || getChar()=='%' || getChar()=='\t'; } /** * Reads '= Real'. * @return The read value. */ public double readEqualReal() { skipWSPComments(); if(getChar()!='=') return Double.NaN; nextChar(); return readReal(); } /** * Reads the next real. * @return The real. */ public double readReal() { StringBuffer sb = new StringBuffer(); int c; int i = 0; int lgth; double v; boolean positive = true; boolean again = true; skipWSPComments(); c = getChar(); while(c=='-'||c=='+'||c=='.' || (c>='0' && c<='9')) { sb.append((char)c); c = nextChar(); } lgth = sb.length(); while(i0) sb.delete(0, i); try { v = Double.valueOf(sb.toString()); } catch(Exception e) { v = Double.NaN; } v = positive ? v : -1*v; return v; } /** * Reads '= Real unit' * @return The read value in cm or NaN. */ public double readEqualRealUnit() { double v = readEqualReal(); String lgth; skipWSPComments(); lgth = readString(false); return convertInCm(v, lgth); } /** * Reads the next string. * @return The string */ public String readString(boolean withNumber) { StringBuffer sb = new StringBuffer(); int c; skipWSPComments(); c = getChar(); if(withNumber) while((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9')) { sb.append((char)c); c = nextChar(); } else while((c>='a' && c<='z') || (c>='A' && c<='Z')) { sb.append((char)c); c = nextChar(); } return sb.toString(); } /** * Converts a value with a given unit of length (cm, pt, mm, in, or nothing) to centimetre * @param value The value to convert. * @param lgth The unit of length of value. * @return The value in centimetre (may be NaN). */ public static double convertInCm(double value, String lgth) { if(lgth==null || lgth.length()==0) return value; lgth = lgth.toLowerCase(); if(lgth.equals(PSTricksConstants.TOKEN_PS_PT)) value/= PSTricksConstants.CM_VAL_PT; //by default the unit is postscript point else if(lgth.equals(PSTricksConstants.TOKEN_INCH)) value*=PSTricksConstants.INCH_VAL_CM; else if(lgth.equals(PSTricksConstants.TOKEN_MM)) value/=10.; else if(!lgth.equals(PSTricksConstants.TOKEN_CM)) value = Double.NaN; return value; } /** * Reads '= string' * @param withNumber If true The string can contains number like 'color0' * @return The read string or null. */ public String readEqualString(boolean withNumber) { skipWSPComments(); if(getChar()!='=') return null; nextChar(); return readString(withNumber); } /** * Reads '= Integer' * @return The read value or MAX_VALUE. */ public int readEqualInteger() { skipWSPComments(); if(getChar()!='=') return Integer.MAX_VALUE; nextChar(); return readInteger(); } /** * Reads the next integer. * @return The integer or MAX_VALUE. */ public int readInteger() { StringBuffer sb = new StringBuffer(); int c; int value; skipWSPComments(); c = getChar(); while(c=='+' || (c>='0' && c<='9')) { sb.append((char)c); c = nextChar(); } try { value = Integer.valueOf(sb.toString()); } catch(Exception e) { value = Integer.MAX_VALUE; } return value; } /** * Reads 'Real unit' converted in cm. * @return The read value or NaN. */ public double readRealUnit() { double r = readReal(); // We read the parameter String lgth = readString(false); // If there is a unit of length, we read it r = convertInCm(r, lgth); return r; } /** * Reads one coordinate: (x,y). Beware, for missing coordinates like (5,) * this function will return (5,NaN) instead of (5,1); because in several cases, * the missing coordinate is very important. * @return The read coordinate or null. * @throws InvalidFormatCommandException If the format of the command is not respected. */ public Point2D.Double readOneCoordinate(boolean withUnit) throws InvalidFormatCommandException { skipWSPComments(); if(getChar()!='(') throw new InvalidFormatCommandException(getLinePosition()); double x; double y; int c; nextChar(); skipWSPComments(); c = getChar(); if((c>='0' && c<='9') || c=='.' || c=='-' || c=='+') x = withUnit ? readRealUnit() : readReal(); else x = Double.NaN; skipWSPComments(); if(getChar()!=',') throw new InvalidFormatCommandException(getLinePosition()); nextChar(); skipWSPComments(); c = getChar(); if((c>='0' && c<='9') || c=='.' || c=='-' || c=='+') y = withUnit ? readRealUnit() : readReal(); else y = Double.NaN; skipWSPComments(); if(getChar()!=')') throw new InvalidFormatCommandException(getLinePosition()); nextChar(); return new Point2D.Double(x, y); } /** * @return the current pstricks parameters. * @since 2.0.2 */ public PSTParameters getParam() { return param; } /** * @param p the current pstricks parameters to set. * @since 2.0.2 */ public void setParam(PSTParameters p) { this.param = p; } } latexdraw-2.0.8+1.orig/latexDraw/parsers/pst/PSTParser.java0000644000000000000000000003200311347255510020404 0ustar package latexDraw.parsers.pst; import static java.lang.Math.cos; import static java.lang.Math.sin; import static java.lang.Math.toRadians; import java.awt.Color; import java.awt.geom.Point2D; import java.util.Vector; import latexDraw.parsers.*; import latexDraw.parsers.pst.PSTParameters.PositionParameters; import latexDraw.psTricks.DviPsColors; import latexDraw.psTricks.PSTricksConstants; /** * Defines an abstract PSTricks parser that parses PSTricks code.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 11/21/08
    * @author Arnaud BLOUIN
    * @version 2.0.2
    */ public abstract class PSTParser extends CodeParser { /** The PSTricks parameters that are created, removed and set * during the parsing of the pstricks code. */ protected Vector params; /** Defines if the parsing of pstricks shapes has began. It * begins when a tag pspicture or begin{pspicture} is parsed. */ protected boolean started; /** The parser that parses pstricks parameters. */ protected PSTParametersParser paramParser; /** * Creates and initialises an abstract pstricks parser. * @param code The pstricks code to parse. * @throws IllegalArgumentException If the given code is null. */ public PSTParser(String code) { super(code); params = new Vector(); paramParser = new PSTParametersParser(code, null); paramParser.setCodeCore(codeCore); } @Override public boolean isComment() { return getChar()=='%'; } @Override public String skipComment() { String comment; if(isComment()) { comment = ""; char c; while(!isEOL() && !isEOC()) { c = (char)nextChar(); if(!isEOL() && !isEOC()) comment += c; } nextChar(); incLinePosition(); skipWSP(); } else comment = null; return comment; } @Override public void skipWSP() { while(getChar()==' ' || isEOL() || getChar()=='\t') { if(isEOL()) incLinePosition(); nextChar(); } } // protected void parse_ps() // { // switch(getChar()) // { // case 'p': // "\psp" // nextChar(); //// parseps(); // break; // // default: // break; // } // } // // // // protected void parse_p() // { // switch(getChar()) // { // case 's': // "\ps" // nextChar(); // parse_ps(); // break; // // default: // break; // } // } // // // // protected void parseCommand() // { // switch(getChar()) // { // case '\\': // "\\" // break; // // case 'p': // "\p" // nextChar(); // parse_p(); // break; // // default: // break; // } // } /** * Adds the current character to the parsed text attribute of a pstricks parameters set. * @since 2.0.2 */ protected void addParsedText() { PSTParameters p = params.lastElement(); String str = String.valueOf((char)getChar()); p.textForFrame+=str; p.textParsed+=str; if(p.fromFramedBox) { boolean again = true; int k = params.size()-2; while(again && k>=0) { p = params.elementAt(k); p.textForFrame+=str; if(p.getPosition()!=null) again = false; else k--; } } } /** * Parses a math expression ($ ... $). The first letter read by this function must be '$'. */ protected void parseMathText() throws UnexceptedEndOfFileException { if(started) { addParsedText(); while(nextChar()!='$' && !isEOC()) addParsedText(); addParsedText(); } else { nextChar(); while(getChar()!='$' && !isEOC()) nextChar(); } if(isEOC()) throw new UnexceptedEndOfFileException(); nextChar(); } @Override public void parse() {//TODO do not forget to take account of the number of parsed lines when parsing parameters. initialise(); // // while(!isEOC()) // try // { // switch(getChar()) // { // case '\\': // nextChar(); // parseCommand(); // break; // // case '$': // nextChar(); // parseMathText(); // break; // // default: // break; // } // } // catch(UnexceptedEndOfFileException ex) { ex.printStackTrace(); } } @Override public void initialise() { super.initialise(); setPosition(0); started = false; PSTParameters.reinitialize(); } @Override public boolean isWSP() { int c = getChar(); return c==' ' || c=='\n' || c=='\r'; } /** * Actions to do when some text is parsed. * @throws InvalidFormatCommandException If the command is not valid. */ public abstract void actionsOnText() throws InvalidFormatCommandException; /** * Actions to do when a framed box is parsed. * @since 2.0.2 * @param type The kind of the framed box:
    * 0: rectangle
    * 1: circle
    * 2: triangle
    * 3: diamond
    * 4: ellipse
    * 5: double rectangle
    * 6: rectangle with shadow
    * @throws UnclosedBracketsException If a bracket is not closed. */ public abstract void actionsOnFramedBox(int type) throws UnclosedBracketsException; /** * Actions to do when one or several framed boxes are parsed. * @throws InvalidFormatCommandException If the parsed command is not valid. * @since 1.7 */ public abstract void actionsOnTerminatedFramedBoxes() throws InvalidFormatCommandException; /** * Actions to do when a pscustom command is finished. * @since 0.3 */ public abstract void actionsOnterminatedPsCustom() throws NotFullyManagedException; /** * Moves a point according to the PSTricks parameters (Useful for dots, texts).
    */ protected Point2D.Double moveCoordinate(Point2D.Double pt) { if(pt==null) return null; int i, size = params.size(); double lastAngle=0; Point2D.Double newPt = new Point2D.Double(0, 0); PSTParameters p; PositionParameters pos; Vector gcs = new Vector(); boolean began = false; if(size==0) return new Point2D.Double(0,0); gcs.add(new Point2D.Double(0,0)); for(i=1; i1) throw new InvalidFormatCommandException(getLinePosition()); if(type.equals(PSTricksConstants.TOKEN_COLOR_TYPE_GRAY)) // definecolor{name}{gray}{val} DviPsColors.addUserColour(new Color((float)val1, (float)val1, (float)val1), name); else { skipWSPComments(); if(getChar()!=',') throw new InvalidFormatCommandException(getLinePosition()); nextChar(); double val2 = paramParser.readReal(); skipWSPComments(); if(getChar()!=',') throw new InvalidFormatCommandException(getLinePosition()); nextChar(); double val3 = paramParser.readReal(); if(val2<0 || val2>1 || val3<0 || val3>1) throw new InvalidFormatCommandException(getLinePosition()); if(type.equals(PSTricksConstants.TOKEN_COLOR_TYPE_RGB))// definecolor{name}{rgb}{r g b} DviPsColors.addUserColour(new Color((float)val1, (float)val2, (float)val3), name); else if(type.equals(PSTricksConstants.TOKEN_COLOR_TYPE_HSB)) DviPsColors.addUserColour(Color.getHSBColor((float)val1, (float)val2, (float)val3), name); else if(type.compareTo(PSTricksConstants.TOKEN_COLOR_TYPE_CMYK)==0) { skipWSPComments(); if(getChar()!=',') throw new InvalidFormatCommandException(getLinePosition()); nextChar(); double val4 = paramParser.readReal(); if(val4<0 || val4>1) throw new InvalidFormatCommandException(getLinePosition()); DviPsColors.addUserColour(DviPsColors.CMYK2RGB(val1, val2, val3, val4), name); } else throw new InvalidFormatCommandException(getLinePosition()); }//else }//else skipWSPComments(); if(getChar()!='}') throw new InvalidFormatCommandException(getLinePosition()); nextChar(); } /** * Parses a 'put' command. * @throws InvalidFormatCommandException If the format of the command is not valid. * @since 2.0.2 */ public void parse_put() throws InvalidFormatCommandException { skipWSPComments(); if(getChar()=='(') { Point2D.Double coord = paramParser.readOneCoordinate(true); PSTParameters p = new PSTParameters(params.lastElement()); if(coord==null) throw new InvalidFormatCommandException("put", -1);//$NON-NLS-1$ skipWSPComments(); p.setPosition(coord.x, coord.y, true, 0, 0, PositionParameters.REF_POINT_LEFT+PositionParameters.REF_POINT_BASE, 0, PositionParameters.REF_POINT_DEFAULT_CENTER); if(params.size()>0) { PSTParameters p2 = params.lastElement(); p.origin.setLocation(p2.origin.x, p2.origin.y); } params.add(p); } } } latexdraw-2.0.8+1.orig/latexDraw/parsers/pstricks/0000755000000000000000000000000011347255510016754 5ustar latexdraw-2.0.8+1.orig/latexDraw/parsers/pstricks/PSTricksParameters.java0000644000000000000000000004676611347255510023370 0ustar /** * PSTricksParameters.java */ package latexDraw.parsers.pstricks; import java.awt.Color; import java.awt.geom.Point2D; import java.awt.geom.Point2D.Double; import java.util.Vector; import latexDraw.figures.FramedBox; import latexDraw.figures.Text; import latexDraw.psTricks.PSTricksConstants; /** * This class defines the PSTricks parameters. We must create a class with these parameters because * at each new '{' we must create new parameters and at the '}' the former parameters will replace the current parameters.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * * 09/01/06
    * @author Arnaud BLOUIN
    * @version 0.5
    */ public class PSTricksParameters { /** * Defines the parameters of the pscustom parameters. * @author Arnaud BLOUIN
    * @version 0.3
    */ public class PsCustomParameters implements Cloneable { /** Defines if the command pscustom has a star. */ public boolean hasStar; /** Defines if the current PSTricksParameters comes from a pscustom command. */ public boolean fromPsCustom; /** The last position (cf. \moveto pstricks command). */ public Point2D.Double lastPosition; public PsCustomParameters() { hasStar = false; fromPsCustom = false; lastPosition = new Point2D.Double(); } @Override public Object clone() throws CloneNotSupportedException { PsCustomParameters pscp = (PsCustomParameters)super.clone(); pscp.fromPsCustom = fromPsCustom; pscp.hasStar = hasStar; pscp.lastPosition = (Double)lastPosition.clone(); return pscp; } } /** * This class defines the position managed with the rput and uput commands of the figures.
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * * 03/16/06
    * @author Arnaud BLOUIN
    * @version 0.5
    */ public static class PositionParameters implements Cloneable { public static final short REF_POINT_DEFAULT_CENTER= 0; public static final short REF_POINT_LEFT = 10; public static final short REF_POINT_RIGHT = 20; public static final short REF_POINT_TOP = 1; public static final short REF_POINT_BOTTOM = 2; public static final short REF_POINT_BASE = 3; /** True if the current {...} allows to sum all the rotations :
    * rput{30}(0,0){ rput{*40}{...} ... } -> false
    * rput{30}(0,0){ rput{40} {...} ... } -> true
    */ public boolean isSumRotation; /** The x gap */ public double dx; /** The y gap */ public double dy; /** The rput angle in degrees */ public double angleRput; /** The uput angle in degrees. */ public double angleUput; /** The gap of the label */ public double labelSep; /** The point of reference (for rput). */ public int refPoint; /** The angle of reference (for uput in degrees). */ public double refAngle; /** * The constructor by default. */ public PositionParameters() { this(true, 0, 0, 0, 0, 0, REF_POINT_DEFAULT_CENTER, REF_POINT_RIGHT); } /** * The main constructor. * @param isSumRot True if allows to sum all the rotations * @param x The x gap * @param y The y gap * @param rputA The rput angle * @param uputA The uput angle * @param labSep The gap of the label (for uput). * @param refPt The point of reference (for rput). * @param refA The angle of reference (for uput). */ public PositionParameters(boolean isSumRot, double x, double y, double rputA, double uputA, double labSep, int refPt, double refA) { isSumRotation = isSumRot; dx = x; dy = y; angleRput = rputA; angleUput = uputA; labelSep = labSep; if(refPt==REF_POINT_LEFT || refPt==REF_POINT_BOTTOM || refPt== REF_POINT_BOTTOM+REF_POINT_LEFT || refPt==REF_POINT_BOTTOM+REF_POINT_RIGHT || refPt==REF_POINT_DEFAULT_CENTER || refPt==REF_POINT_RIGHT || refPt==REF_POINT_TOP || refPt==REF_POINT_TOP+REF_POINT_LEFT || refPt==REF_POINT_TOP+REF_POINT_RIGHT || refPt==REF_POINT_BASE || refPt==REF_POINT_BASE+REF_POINT_LEFT || refPt==REF_POINT_BASE+REF_POINT_RIGHT) refPoint = refPt; else refPoint = REF_POINT_DEFAULT_CENTER; if(refA==REF_POINT_LEFT || refA==REF_POINT_BOTTOM || refA== REF_POINT_BOTTOM+REF_POINT_LEFT || refA==REF_POINT_BOTTOM+REF_POINT_RIGHT || refA==REF_POINT_DEFAULT_CENTER || refA==REF_POINT_RIGHT || refA==REF_POINT_TOP || refA==REF_POINT_TOP+REF_POINT_LEFT || refA==REF_POINT_TOP+REF_POINT_RIGHT || refA==REF_POINT_BASE || refA==REF_POINT_BASE+REF_POINT_LEFT || refA==REF_POINT_BASE+REF_POINT_RIGHT) refAngle = refA; else refAngle = REF_POINT_RIGHT; } @Override public String toString() { return "PositionParameters : ";//$NON-NLS-1$//$NON-NLS-2$ } @Override public Object clone() throws CloneNotSupportedException { return super.clone(); } } public static boolean isCentered = false; public static Point2D.Double pictureSWPt=null; public static Point2D.Double pictureNEPt=null; public static String tokenPosition = "";//$NON-NLS-1$ private PositionParameters position; public String axesStyle; public String[] arrowStyle; public double arrowSizeD; public double arrowSizeN; public double arrowLgth; public double arrowInset; public double arrowTBarSD; public double arrowTBarSN; public double arrowBrLgth; public double arrowrBrLgth; public double arrowDotSD; public double arrowDotSN; public double arrowScale1; public double arrowScale2; public double arcSep; public double arcSepA; public double arcSepB; public boolean boxSep; public Color borderColor; public String borderPos; public double border; public double curvature1; public double curvature2; public double curvature3; public double dxIncrement; public double dyIncrement; public double dxLabelDist; public double dyLabelDist; public String dotStyle; public double dotScale1; public double dotScale2; public double dotAngle; public double dotStep; public double dashBlack; public double dashWhite; public boolean dbleLine; public double dbleSep; public Color dbleColor; public double degrees; public double frameSep; public double frameArc; public String fillStyle; public Color fillColor; public double gridWidth; public double gridLabel; public int gridDots; public double gradAngle; public Color gridColor; public double gradMidPoint; public Color gradBegin; public Color gradEnd; public int gradLines; public double gangle; public double hatchWidth; public double hatchSep; public Color hatchCol; public double hatchAngle; public boolean isCornerRel; public boolean isShadow; public double lineWidth; public Color lineColor; public Color labelsGridCol; public String labels; public double lineArc; public String lineStyle; public double ox; public double oy; public boolean onRadians; public Point2D.Double origin; public boolean specialCoor; public boolean showPoints; public boolean showOrigin; public double subGridWidth; public boolean swapAxes; public Color shadowCol; public Color subGridCol; public double shadowAngle; public double shadowSize; public int subGridDots; public int subGridDiv; public String ticks; public String ticksStyle; public double ticksSize; public boolean textItalic; public boolean textBold; public String textEnc; public String textShape; public String textSeries; public String textFamily; public Color textColor; public String textSize; public String textParsed; public double unit; public double xUnit; public double yUnit; public Vector psBox = new Vector(); public Text psBoxText; public boolean fromFramedBox; /** The parsed text which is transfered by psframe commands to the rput PSTricksParameters. */ public String textForFrame; public PsCustomParameters psCustomP; /** * The constructor by default. */ public PSTricksParameters() { psCustomP = new PsCustomParameters(); textForFrame = "";//$NON-NLS-1$ fromFramedBox = false; textParsed = "";//$NON-NLS-1$ position = null; textBold = false; textItalic = false; boxSep = PSTricksConstants.DEFAULT_BOX_SEP; frameSep = PSTricksConstants.DEFAULT_FRAME_SEP; gradAngle = PSTricksConstants.DEFAULT_GRADIENT_ANGLE; gradMidPoint = PSTricksConstants.DEFAULT_GRADIENT_MID_POINT; gradLines = PSTricksConstants.DEFAULT_GRADIENT_LINES; gradBegin = PSTricksConstants.DEFAULT_GRADIENT_START_COLOR; gradEnd = PSTricksConstants.DEFAULT_GRADIENT_END_COLOR; gangle = PSTricksConstants.DEFAULT_GANGLE; specialCoor = PSTricksConstants.DEFAULT_SPECIAL_COOR; onRadians = PSTricksConstants.DEFAULT_ON_RADIANS; degrees = PSTricksConstants.DEFAULT_DEGREES; unit = PSTricksConstants.DEFAULT_UNIT; xUnit = PSTricksConstants.DEFAULT_UNIT; yUnit = PSTricksConstants.DEFAULT_UNIT; lineWidth = PSTricksConstants.DEFAULT_LINE_WIDTH; lineColor = PSTricksConstants.DEFAULT_LINE_COLOR; showPoints = PSTricksConstants.DEFAULT_SHOW_POINTS; lineArc = PSTricksConstants.DEFAULT_LINE_ARC; frameArc = PSTricksConstants.DEFAULT_FRAME_ARC; isCornerRel = PSTricksConstants.DEFAULT_CORNER_SIZE_RELATIVE; arcSep = PSTricksConstants.DEFAULT_ARC_SEP; arcSepA = PSTricksConstants.DEFAULT_ARC_SEP_A; arcSepB = PSTricksConstants.DEFAULT_ARC_SEP_B; curvature1 = PSTricksConstants.DEFAULT_CURVATURE_NUM1; curvature2 = PSTricksConstants.DEFAULT_CRUVATURE_NUM2; curvature3 = PSTricksConstants.DEFAULT_CRUVATURE_NUM3; dotStyle = PSTricksConstants.DEFAULT_DOT_STYLE; dotScale1 = PSTricksConstants.DEFAULT_DOT_SCALE1; dotScale2 = PSTricksConstants.DEFAULT_DOT_SCALE2; dotAngle = PSTricksConstants.DEFAULT_DOT_ANGLE; gridWidth = PSTricksConstants.DEFAULT_GRID_WIDTH; gridLabel = PSTricksConstants.DEFAULT_GRID_LABEL/PSTricksConstants.CM_VAL_PT; subGridWidth= PSTricksConstants.DEFAULT_SUB_GRID_WIDTH; subGridCol = PSTricksConstants.DEFAULT_SUB_GRID_COLOR; gridColor = PSTricksConstants.DEFAULT_GRIDCOLOR; labelsGridCol = PSTricksConstants.DEFAULT_LABELGRIDCOLOR; subGridDiv = PSTricksConstants.DEFAULT_SUBGRIDDIV; gridDots = PSTricksConstants.DEFAULT_GRIDDOTS; subGridDots = PSTricksConstants.DEFAULT_SUBGRIDDOTS; swapAxes = PSTricksConstants.DEFAULT_SWAP_AXES; origin = (Point2D.Double)PSTricksConstants.DEFAULT_ORIGIN.clone(); lineStyle = PSTricksConstants.DEFAULT_LINE_STYLE; dotStep = PSTricksConstants.DEFAULT_DOT_STEP; dashBlack = PSTricksConstants.DEFAULT_DASH_BLACK; dashWhite = PSTricksConstants.DEFAULT_DASH_WHITE; borderColor = PSTricksConstants.DEFAULT_BORDER_COLOR; border = PSTricksConstants.DEFAULT_BORDER; dbleLine = PSTricksConstants.DEFAULT_DOUBLE_LINE; dbleSep = PSTricksConstants.DEFAULT_DOUBLE_SEP; dbleColor = PSTricksConstants.DEFAULT_DOUBLE_COLOR; shadowCol = PSTricksConstants.DEFAULT_SHADOW_COLOR; isShadow = PSTricksConstants.DEFAULT_SHADOW; shadowAngle = PSTricksConstants.DEFAULT_SHADOW_ANGLE; shadowSize = PSTricksConstants.DEFAULT_SHADOW_SIZE; borderPos = PSTricksConstants.DEFAULT_BORDERS_POS; fillStyle = PSTricksConstants.DEFAULT_FILL_STYLE; fillColor = PSTricksConstants.DEFAULT_FILL_COLOR; hatchWidth = PSTricksConstants.DEFAULT_HATCH_WIDTH; hatchSep = PSTricksConstants.DEFAULT_HATCH_SEP; hatchCol = PSTricksConstants.DEFAULT_HATCHING_COLOR; hatchAngle = PSTricksConstants.DEFAULT_HATCH_ANGLE; arrowStyle = new String[2]; arrowStyle[0] = PSTricksConstants.DEFAULT_ARROW_STYLE; arrowStyle[1] = PSTricksConstants.DEFAULT_ARROW_STYLE; arrowSizeD = PSTricksConstants.DEFAULT_ARROW_SIZE_DIM; arrowSizeN = PSTricksConstants.DEFAULT_ARROW_SIZE_NUM; arrowLgth = PSTricksConstants.DEFAULT_ARROW_LENGTH; arrowInset = PSTricksConstants.DEFAULT_ARROW_INSET; arrowTBarSD = PSTricksConstants.DEFAULT_ARROW_TBARSIZE_DIM; arrowTBarSN = PSTricksConstants.DEFAULT_ARROW_TBARSIZE_NUM; arrowBrLgth = PSTricksConstants.DEFAULT_ARROW_BRACKET_LGTH; arrowrBrLgth= PSTricksConstants.DEFAULT_ARROW_RBRACKET_LGTH; arrowDotSD = PSTricksConstants.DEFAULT_ARROW_DOTSIZE_DIM; arrowDotSN = PSTricksConstants.DEFAULT_ARROW_DOTSIZE_NUM; arrowScale1 = PSTricksConstants.DEFAULT_ARROW_SCALE1; arrowScale2 = PSTricksConstants.DEFAULT_ARROW_SCALE2; textEnc = null; textShape = null; textSeries = null; textFamily = null; textColor = Color.BLACK; textSize = PSTricksConstants.COMMAND_TEXT_NORMAL; psBoxText = new Text(null, false); psBox = new Vector(); showOrigin = PSTricksConstants.DEFAULT_SHOW_ORIGIN; axesStyle = PSTricksConstants.DEFAULT_AXES_STYLE; ticks = PSTricksConstants.DEFAULT_TICKS_DISPLAYED; ticksSize = PSTricksConstants.DEFAULT_TICKS_SIZE; ticksStyle = PSTricksConstants.DEFAULT_TICKS_STYLE; labels = PSTricksConstants.DEFAULT_LABELS_DISPLAYED; ox = PSTricksConstants.DEFAULT_OX; oy = PSTricksConstants.DEFAULT_OY; dxIncrement = PSTricksConstants.DEFAULT_DX; dyIncrement = PSTricksConstants.DEFAULT_DY; dxLabelDist = PSTricksConstants.DEFAULT_DIST_X_LABEL; dyLabelDist = PSTricksConstants.DEFAULT_DIST_Y_LABEL; } /** * The constructor copying another PSTricksParameters */ public PSTricksParameters(PSTricksParameters toCopy) { try { psCustomP = (PsCustomParameters)toCopy.psCustomP.clone(); } catch(CloneNotSupportedException e) { psCustomP = new PsCustomParameters(); } textForFrame = "";//$NON-NLS-1$ boxSep = toCopy.boxSep; frameSep = toCopy.frameSep; fromFramedBox = toCopy.fromFramedBox; textParsed = "";//$NON-NLS-1$ position = null; gradAngle = toCopy.gradAngle; gradBegin = toCopy.gradBegin; gradEnd = toCopy.gradEnd; gradLines = toCopy.gradLines; gradMidPoint = toCopy.gradMidPoint; textBold = toCopy.textBold; textItalic = toCopy.textItalic; gangle = toCopy.gangle; specialCoor = toCopy.specialCoor; onRadians = toCopy.onRadians; degrees = toCopy.degrees; xUnit = toCopy.xUnit; yUnit = toCopy.yUnit; unit = toCopy.unit; lineWidth = toCopy.lineWidth; lineColor = toCopy.lineColor; showPoints = toCopy.showPoints; lineArc = toCopy.lineArc; frameArc = toCopy.frameArc; isCornerRel = toCopy.isCornerRel; arcSep = toCopy.arcSep; arcSepA = toCopy.arcSepA; arcSepB = toCopy.arcSepB; curvature1 = toCopy.curvature1; curvature2 = toCopy.curvature2; curvature3 = toCopy.curvature3; dotStyle = toCopy.dotStyle; dotScale1 = toCopy.dotScale1; dotScale2 = toCopy.dotScale2; dotAngle = toCopy.dotAngle; gridWidth = toCopy.gridWidth; gridLabel = toCopy.gridLabel; subGridWidth= toCopy.subGridWidth; subGridCol = toCopy.subGridCol; gridColor = toCopy.gridColor; labelsGridCol = toCopy.labelsGridCol; subGridDiv = toCopy.subGridDiv; gridDots = toCopy.gridDots; subGridDots = toCopy.subGridDots; swapAxes = toCopy.swapAxes; origin = new Point2D.Double(toCopy.origin.x, toCopy.origin.y); lineStyle = toCopy.lineStyle; dotStep = toCopy.dotStep; dashBlack = toCopy.dashBlack; dashWhite = toCopy.dashWhite; borderColor = toCopy.borderColor; border = toCopy.border; dbleLine = toCopy.dbleLine; dbleSep = toCopy.dbleSep; dbleColor = toCopy.dbleColor; shadowCol = toCopy.shadowCol; isShadow = toCopy.isShadow; shadowAngle = toCopy.shadowAngle; shadowSize = toCopy.shadowSize; borderPos = toCopy.borderPos; fillStyle = toCopy.fillStyle; fillColor = toCopy.fillColor; hatchWidth = toCopy.hatchWidth; hatchSep = toCopy.hatchSep; hatchCol = toCopy.hatchCol; hatchAngle = toCopy.hatchAngle; arrowStyle = new String[2]; arrowStyle[0] = toCopy.arrowStyle[0]; arrowStyle[1] = toCopy.arrowStyle[1]; arrowSizeD = toCopy.arrowSizeD; arrowSizeN = toCopy.arrowSizeN; arrowLgth = toCopy.arrowLgth; arrowInset = toCopy.arrowInset; arrowTBarSD = toCopy.arrowTBarSD; arrowTBarSN = toCopy.arrowTBarSN; arrowBrLgth = toCopy.arrowBrLgth; arrowrBrLgth= toCopy.arrowrBrLgth; arrowDotSD = toCopy.arrowDotSD; arrowDotSN = toCopy.arrowDotSN; arrowScale1 = toCopy.arrowScale1; arrowScale2 = toCopy.arrowScale2; textEnc = toCopy.textEnc; textShape = toCopy.textShape; textSeries = toCopy.textSeries; textFamily = toCopy.textFamily; textColor = toCopy.textColor; textSize = toCopy.textSize; psBoxText = new Text(null, false); psBox = new Vector(); showOrigin = toCopy.showOrigin; axesStyle = toCopy.axesStyle; ticks = toCopy.ticks; ticksSize = toCopy.ticksSize; ticksStyle = toCopy.ticksStyle; labels = toCopy.labels; ox = toCopy.ox; oy = toCopy.oy; dxIncrement = toCopy.dxIncrement; dyIncrement = toCopy.dyIncrement; dxLabelDist = toCopy.dxLabelDist; dyLabelDist = toCopy.dyLabelDist; } /** * @return the position */ public PositionParameters getPosition() { return position; } /** * Sets a new position */ public void setPosition(double dx, double dy, boolean isSumRot, double rputA, double uputA, int refPt, double labelSep, double refAngle) { position = new PositionParameters(isSumRot, dx, dy, rputA, uputA, labelSep, refPt, refAngle); } /** * Allows to get the whole rotation angle * @return The rotation angle (in degrees) */ public static double getWholeRotationAngle(Vector params) { int i=0, size = params.size(); double sum=0; if(size>0) { PositionParameters pos = params.elementAt(i).getPosition(); if(pos!=null) { if(pos.isSumRotation) sum+=pos.angleRput; else sum = pos.angleRput; } } for(i=1; i *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/06/06
    * @author Arnaud BLOUIN
    * @version 0.5
    */ public abstract class PSTricksParserActionsManager { /** When the parsing of a command goes bad, this value is returned. */ public static final short ERR_END_CMD_INDEX = -1; /** * Action to do when a text is parsed. */ public abstract void actionsOnText(Vector p) throws InvalidFormatCommandException; /** * Action to do when a frame or an ellipse is parsed. */ public abstract int actionsOnFrameEllipse(int line, boolean hasStar, Vector p, String params, boolean isFrame) throws InvalidFormatCommandException; /** * Action to do when a frame is parsed. */ public abstract int actionsOnCircle(int line, boolean hasStar, Vector ps, String params) throws InvalidFormatCommandException; /** * Action to do when a dot is parsed. */ public abstract int actionsOnDot(int line, Vector ps, String params, boolean noCoordinatePossible) throws InvalidFormatCommandException; /** * Action to do when a picture is parsed. */ public abstract int actionsOnPicture(int line, Vector ps, String params) throws InvalidFormatCommandException; /** * Allows to parse the parameters of the commands psdot and psdots * @param line The number of the line * @param params The parameters * @param center Will contains all points read * @param p The parameters to be set * @return The position of the end of the parameters in the string params * @throws InvalidFormatCommandException If the command is invalid */ public int parseParametersDot(int line, String params, Vector center, PSTricksParameters p, boolean noCoordinatePossible) throws InvalidFormatCommandException { int i=0, j; boolean stop = false; while(i=params.length()) throw new InvalidFormatCommandException(line); j=i; // We parse the options [..] if(params.charAt(i)=='[') // Analyse of the options { j = params.indexOf("]", j);//$NON-NLS-1$ if(j==-1) throw new InvalidFormatCommandException(line); parseOptionsFigure(params.substring(i+1, j), p, !p.psCustomP.fromPsCustom); j++; } if(center==null) return ERR_END_CMD_INDEX; int[] tmp = {j}; try { goToNextChar(params, tmp); if(params.charAt(tmp[0])!='(') { if(noCoordinatePossible) { center.addElement(new Point2D.Double(p.origin.x, p.origin.y)); return j; } throw new InvalidFormatCommandException(line); } j = params.indexOf(')', tmp[0]); if(j==-1) throw new InvalidFormatCommandException(line); // The first position must be here Point2D.Double pt = readOneCoordinate(params.substring(tmp[0], j+1), 0, line, true); if(pt==null) throw new InvalidFormatCommandException(line); if(Double.isNaN(pt.x)) pt.x = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; if(Double.isNaN(pt.y)) pt.y = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; pt.setLocation(pt.x+p.origin.x, pt.y+p.origin.y); center.addElement(pt); tmp[0] = j+1; }catch(IgnoreCommandException e1) { throw new InvalidFormatCommandException(line); } stop=false; if(!noCoordinatePossible) while(!stop) { try { goToNextChar(params, tmp); if(params.charAt(tmp[0])!='(') throw new InvalidFormatCommandException(line); j = params.indexOf(')', tmp[0]); if(j==-1) throw new InvalidFormatCommandException(line); Point2D.Double pt = readOneCoordinate(params.substring(tmp[0], j+1), 0, line, true); if(pt==null) throw new InvalidFormatCommandException(line); if(Double.isNaN(pt.x)) pt.x = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; if(Double.isNaN(pt.y)) pt.y = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; pt.setLocation(pt.x+p.origin.x, pt.y+p.origin.y); center.addElement(pt); tmp[0] = j+1; }catch(Exception e){ stop = true; } } // while(!stop) return tmp[0]; } /** * Allows to parse the parameters of a include graphics command.
    * All the parameters will be in cm. */ public int parseParametersPicture(int nLine, String params, String[] path) throws InvalidFormatCommandException { try { int[] i={0}; while(i[0]=params.length()) throw new InvalidFormatCommandException(nLine); goToNextChar(params, i); int j = params.indexOf("}", i[0]), k; //$NON-NLS-1$ if(j==-1) throw new InvalidFormatCommandException(nLine); String path2 = params.substring(i[0], j); k = path2.length()-1; boolean stop = false; while(!stop && k>i[0]) { if(isCharToIgnore(path2.charAt(k))) k--; else stop = true; } if(k<=i[0]) throw new InvalidFormatCommandException(nLine); path2 = path2.substring(0, k+1); path[0] = path2; return j+1; }catch(Exception e) { throw new InvalidFormatCommandException("includegraphics", nLine); } //$NON-NLS-1$ } /** * Allows to parse the parameters of a frame or a ellipse command.
    * All the parameters will be in cm. */ public int parseParametersFrameEllipse(int nLine, String params, Point2D.Double p1, Point2D.Double p2, PSTricksParameters p) throws InvalidFormatCommandException { int i=0, j; while(i=params.length()) throw new InvalidFormatCommandException(nLine); j=i; // We parse the options [..] if(params.charAt(i)=='[') // Analyse of the options { while(j=params.length()) throw new InvalidFormatCommandException(nLine); parseOptionsFigure(params.substring(i+1, j), p, !p.psCustomP.fromPsCustom); j++; } if(p1==null || p2==null || p.origin==null) return j; // We parse the coordinates (..) int[] tmp = {j}; Point2D.Double pt1, pt2; try { goToNextChar(params, tmp); if(params.charAt(tmp[0])!='(') throw new InvalidFormatCommandException(nLine); j = params.indexOf(')', tmp[0]); if(j==-1) throw new InvalidFormatCommandException(nLine); // The first position must be here pt1 = readOneCoordinate(params.substring(tmp[0], j+1), 0, nLine, true); if(pt1==null) throw new InvalidFormatCommandException(nLine); tmp[0] = j+1; }catch(IgnoreCommandException e1) { throw new InvalidFormatCommandException(nLine); } try { goToNextChar(params, tmp); if(params.charAt(tmp[0])!='(') throw new InvalidFormatCommandException(nLine); j = params.indexOf(')', tmp[0]); if(j==-1) throw new InvalidFormatCommandException(nLine); pt2 = readOneCoordinate(params.substring(tmp[0], j+1), 0, nLine, true); tmp[0] = j+1; }catch(Exception e){ pt2 = null; } if(pt2==null) { p1.setLocation((Point2D.Double)p.origin.clone()); p2.setLocation(pt1); } else { p1.setLocation(pt1); p2.setLocation(pt2); } if(Double.isNaN(p1.x)) p1.x = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; if(Double.isNaN(p1.y)) p1.y = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; if(Double.isNaN(p2.x)) p2.x = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; if(Double.isNaN(p2.y)) p2.y = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; return tmp[0]; } /** * Allows to parse the parameters of a frame or a ellipse command.
    * All the parameters will be in cm * @throws InvalidFormatCommandException If the format of the command is invalid. */ public int parseParametersCircle(int line, String params, Point2D.Double center, double[] radius, PSTricksParameters p) throws InvalidFormatCommandException { int i=0, j; while(i=params.length()) throw new InvalidFormatCommandException(line); j=i; // We parse the options [..] if(params.charAt(i)=='[') // Analyse of the options { while(j=params.length()) throw new InvalidFormatCommandException(line); parseOptionsFigure(params.substring(i+1, j), p, !p.psCustomP.fromPsCustom); j++; } if(center==null || p.origin==null) return j; int[] tmp = {j}, temp = {0}; try {// The centre is optional goToNextChar(params, tmp); if(params.charAt(tmp[0])!='(') throw new InvalidFormatCommandException(line); j = params.indexOf(')', tmp[0]); if(j==-1) throw new InvalidFormatCommandException(line); center.setLocation(readOneCoordinate(params.substring(tmp[0], j+1), 0, line, true)); tmp[0] = j+1; }catch(Exception e){ center.setLocation((Point2D.Double)p.origin.clone()); } if(Double.isNaN(center.x)) center.x = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; if(Double.isNaN(center.y)) center.y = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; try { // We parse the radius {Real} goToNextChar(params, tmp); if(params.charAt(tmp[0])!='{') throw new InvalidFormatCommandException(line); j = params.indexOf('}', tmp[0]); if(j==-1) throw new InvalidFormatCommandException(line); radius[0] = readReal(params.substring(tmp[0]+1, j), temp, true); }catch(Exception e){throw new InvalidFormatCommandException(line);} return j+1; } /** * Allows to parse the parameters of a line command.
    * All the parameters will be in cm * @throws InvalidFormatCommandException If the format of the command is invalid */ public int parseParametersLine(int line, String params, Vector pts, PSTricksParameters p) throws InvalidFormatCommandException { int i=0, j; while(i=params.length()) throw new InvalidFormatCommandException(line); j=i; // We parse the options [..] if(params.charAt(i)=='[') // Analyse of the options { while(j=params.length()) throw new InvalidFormatCommandException(line); parseOptionsFigure(params.substring(i+1, j), p, !p.psCustomP.fromPsCustom); j++; } if(pts==null || p.origin==null) return ERR_END_CMD_INDEX; int[] tmp = {j}; try { goToNextChar(params, tmp); if(params.charAt(tmp[0])=='{')// We read the arrows {// {arrow1-arrow2} j = params.indexOf("}", tmp[0]);//$NON-NLS-1$ if(j==-1) throw new InvalidFormatCommandException(line); String arr = params.substring(tmp[0]+1, j); tmp[0] = j+1; if(arr.length()>0) { int k = arr.indexOf("-");//$NON-NLS-1$ if(k==-1)// One arrow { if(PSTricksConstants.isValidArrowStyle(arr)) p.arrowStyle[0] = ArrowHead.invertArrowStyle(arr); } else { if(k!=0) if(PSTricksConstants.isValidArrowStyle(arr.substring(0, k))) p.arrowStyle[0] = arr.substring(0, k); if(k!=arr.length()) if(PSTricksConstants.isValidArrowStyle(arr.substring(k+1))) p.arrowStyle[1] = arr.substring(k+1); } } } if(params.charAt(tmp[0])!='(') throw new InvalidFormatCommandException(line); j = params.indexOf(')', tmp[0]); if(j==-1) throw new InvalidFormatCommandException(line); // The first position must be here Point2D.Double pt = readOneCoordinate(params.substring(tmp[0], j+1), 0, line, true); if(pt==null) throw new InvalidFormatCommandException(line); if(Double.isNaN(pt.x)) pt.x = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; if(Double.isNaN(pt.y)) pt.y = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; pt.setLocation(pt.x+p.origin.x, pt.y+p.origin.y); pts.addElement(pt); tmp[0] = j+1; }catch(IgnoreCommandException e1) { throw new InvalidFormatCommandException(line); } boolean stop=false; while(!stop) { try { goToNextChar(params, tmp); if(params.charAt(tmp[0])!='(') throw new InvalidFormatCommandException(line); j = params.indexOf(')', tmp[0]); if(j==-1) throw new InvalidFormatCommandException(line); Point2D.Double pt = readOneCoordinate(params.substring(tmp[0], j+1), 0, line, true); if(pt==null) throw new InvalidFormatCommandException(line); if(Double.isNaN(pt.x)) pt.x = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; if(Double.isNaN(pt.y)) pt.y = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; pt.setLocation(pt.x+p.origin.x, pt.y+p.origin.y); pts.addElement(pt); tmp[0] = j+1; }catch(Exception e){ stop = true; } } // while(!stop) if(pts.size()==1) pts.add(0,new Point2D.Double(p.origin.x, p.origin.y)); return tmp[0]; } /** * Allows to parse the parameters of a polygon command. * @param line The line of the command. * @param params The parameters. * @param pts The futures points of the polygon. * @param p The current generals parameters. * @return The index of the end of the parameters in params. * @throws InvalidFormatCommandException If the format of the command is invalid. */ public int parseParametersPolygon(int line, String params, Vector pts, PSTricksParameters p) throws InvalidFormatCommandException { int i=0, j; while(i=params.length()) throw new InvalidFormatCommandException(line); j=i; // We parse the options [..] if(params.charAt(i)=='[') // Analyse of the options { while(j=params.length()) throw new InvalidFormatCommandException(line); parseOptionsFigure(params.substring(i+1, j), p, !p.psCustomP.fromPsCustom); j++; } if(pts==null || p.origin==null) return j; boolean stop=false; int[] tmp = {j}; while(!stop) { try { goToNextChar(params, tmp); if(params.charAt(tmp[0])!='(') throw new InvalidFormatCommandException(line); j = params.indexOf(')', tmp[0]); if(j==-1) throw new InvalidFormatCommandException(line); Point2D.Double pt = readOneCoordinate(params.substring(tmp[0], j+1), 0, line, true); if(pt==null) throw new InvalidFormatCommandException(line); if(Double.isNaN(pt.x)) pt.x = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; if(Double.isNaN(pt.y)) pt.y = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; pt.setLocation(pt.x+p.origin.x, pt.y+p.origin.y); pts.addElement(pt); tmp[0] = j+1; }catch(Exception e){ stop = true; } } // while(!stop) if(pts.isEmpty()) throw new InvalidFormatCommandException(line); return tmp[0]; } /** * Allows to parse the parameters of a Bézier curve command. * @param line The line of the command. * @param params The parameters. * @param pts The futures points of the Bézier curve. * @param p The current generals parameters. * @return The index of the end of the parameters in params. * @throws InvalidFormatCommandException If the format of the command is invalid. */ public int parseParametersBezierCurve(int line, String params, Vector pts, PSTricksParameters p) throws InvalidFormatCommandException { int i=0, j; while(i=params.length()) throw new InvalidFormatCommandException(line); j=i; // We parse the options [..] if(params.charAt(i)=='[') // Analyse of the options { while(j=params.length()) throw new InvalidFormatCommandException(line); parseOptionsFigure(params.substring(i+1, j), p, !p.psCustomP.fromPsCustom); j++; } if(pts==null) return ERR_END_CMD_INDEX; int[] tmp = {j}; try { goToNextChar(params, tmp); if(params.charAt(tmp[0])=='{')// We read the arrows {// {arrow1-arrow2} j = params.indexOf("}", tmp[0]);//$NON-NLS-1$ if(j==-1) throw new InvalidFormatCommandException(line); String arr = params.substring(tmp[0]+1, j); tmp[0] = j+1; if(arr.length()>0) { int k = arr.indexOf("-");//$NON-NLS-1$ if(k==-1)// One arrow { if(PSTricksConstants.isValidArrowStyle(arr)) p.arrowStyle[0] = ArrowHead.invertArrowStyle(arr); } else { if(k!=0) if(PSTricksConstants.isValidArrowStyle(arr.substring(0, k))) p.arrowStyle[0] = arr.substring(0, k); if(k!=arr.length()) if(PSTricksConstants.isValidArrowStyle(arr.substring(k+1))) p.arrowStyle[1] = arr.substring(k+1); } } } if(params.charAt(tmp[0])!='(') throw new InvalidFormatCommandException(line); j = params.indexOf(')', tmp[0]); if(j==-1) throw new InvalidFormatCommandException(line); // The first position must be here Point2D.Double pt = readOneCoordinate(params.substring(tmp[0], j+1), 0, line, true); if(pt==null) throw new InvalidFormatCommandException(line); if(Double.isNaN(pt.x)) pt.x = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; if(Double.isNaN(pt.y)) pt.y = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; pt.setLocation(pt.x+p.origin.x, pt.y+p.origin.y); pts.addElement(pt); tmp[0] = j+1; }catch(IgnoreCommandException e1) { throw new InvalidFormatCommandException(line); } boolean stop=false; while(!stop) { try { goToNextChar(params, tmp); if(params.charAt(tmp[0])!='(') throw new InvalidFormatCommandException(line); j = params.indexOf(')', tmp[0]); if(j==-1) throw new InvalidFormatCommandException(line); Point2D.Double pt = readOneCoordinate(params.substring(tmp[0], j+1), 0, line, true); if(pt==null) throw new InvalidFormatCommandException(line); if(Double.isNaN(pt.x)) pt.x = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; if(Double.isNaN(pt.y)) pt.y = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; pt.setLocation(pt.x+p.origin.x, pt.y+p.origin.y); pts.addElement(pt); tmp[0] = j+1; }catch(Exception e){ stop = true; } } // while(!stop) return tmp[0]; } /** * Allows to parse the parameters of a Bézier curve command. * @param line The line of the command. * @param params The parameters. * @param radius The futures radius of the arc. * @param p The current generals parameters. * @param center The future centre of the arc. * @param angle1 The future first angle of the arc. * @param angle2 The future last angle of the arc. * @return The index of the end of the parameters in params. * @throws InvalidFormatCommandException If the format of the command is invalid. */ public int parseParametersArcWedge(int line, String params, double[] radius, Point2D.Double center, double[] angle1, double[] angle2, PSTricksParameters p, boolean isArc) throws InvalidFormatCommandException { int i=0, j; while(i=params.length()) throw new InvalidFormatCommandException(line); j=i; // We parse the options [..] if(params.charAt(i)=='[') // Analyse of the options { while(j=params.length()) throw new InvalidFormatCommandException(line); parseOptionsFigure(params.substring(i+1, j), p, !p.psCustomP.fromPsCustom); j++; } if(center==null || p.origin==null) return ERR_END_CMD_INDEX; int[] tmp = {j}, temp = {0}; try { goToNextChar(params, tmp); if(isArc) if(params.charAt(tmp[0])=='{')// We read the arrows {// {arrow1-arrow2} j = params.indexOf("}", tmp[0]);//$NON-NLS-1$ if(j==-1) throw new InvalidFormatCommandException(line); String arr = params.substring(tmp[0]+1, j); tmp[0] = j+1; if(arr.length()>0) { int k = arr.indexOf("-");//$NON-NLS-1$ if(k==-1)// One arrow { if(PSTricksConstants.isValidArrowStyle(arr)) p.arrowStyle[0] = ArrowHead.invertArrowStyle(arr); } else { if(k!=0) if(PSTricksConstants.isValidArrowStyle(arr.substring(0, k))) p.arrowStyle[0] = arr.substring(0, k); if(k!=arr.length()) if(PSTricksConstants.isValidArrowStyle(arr.substring(k+1))) p.arrowStyle[1] = arr.substring(k+1); } } } try {// The centre is optional goToNextChar(params, tmp); if(params.charAt(tmp[0])!='(') throw new InvalidFormatCommandException(line); j = params.indexOf(')', tmp[0]); if(j==-1) throw new InvalidFormatCommandException(line); Point2D.Double pt = readOneCoordinate(params.substring(tmp[0], j+1), 0, line, true); if(pt==null) throw new InvalidFormatCommandException(line); pt.setLocation(pt.x+p.origin.x, pt.y+p.origin.y); center.setLocation(pt); tmp[0] = j+1; }catch(Exception e){ center.setLocation((Point2D.Double)p.origin.clone()); } // We parse the radius {Real} goToNextChar(params, tmp); if(params.charAt(tmp[0])!='{') throw new InvalidFormatCommandException(line); j = params.indexOf('}', tmp[0]); if(j==-1) throw new InvalidFormatCommandException(line); radius[0] = readRealUnit(temp, params.substring(tmp[0]+1, j), true); tmp[0] = j+1; // We parse the first angle {Real} goToNextChar(params, tmp); if(params.charAt(tmp[0])!='{') throw new InvalidFormatCommandException(line); j = params.indexOf('}', tmp[0]); if(j==-1) throw new InvalidFormatCommandException(line); temp[0] = 0; angle1[0] = readReal(params.substring(tmp[0]+1, j), temp, true); tmp[0] = j+1; // We parse the second angle radius {Real} goToNextChar(params, tmp); if(params.charAt(tmp[0])!='{') throw new InvalidFormatCommandException(line); j = params.indexOf('}', tmp[0]); if(j==-1) throw new InvalidFormatCommandException(line); temp[0] = 0; angle2[0] = readReal(params.substring(tmp[0]+1, j), temp, true); return j+1; }catch(IgnoreCommandException e1) { throw new InvalidFormatCommandException(line); } } /** * Allows to parse the parameters of a Bézier curve command. * @param line The line of the command. * @param params The parameters. * @param p The current generals parameters. * @param pts The future points of the grids. * @return The index of the end of the parameters in params. * @throws InvalidFormatCommandException If the format of the command is invalid. */ public int parseParametersGridAxes(int line, String params, Vector pts, PSTricksParameters p) throws InvalidFormatCommandException { int i=0, j; int[] k={0}; try { goToNextChar(params, k); } catch(IgnoreCommandException e1) { throw new InvalidFormatCommandException(line); } if(params.charAt(k[0])!='[' && params.charAt(k[0])!='(' && params.charAt(k[0])!='{') return k[0]; j=k[0]; // We parse the options [..] if(params.charAt(i)=='[') // Analyse of the options { while(j=params.length()) throw new InvalidFormatCommandException(line); parseOptionsFigure(params.substring(i+1, j), p, !p.psCustomP.fromPsCustom); j++; } if(pts==null) return ERR_END_CMD_INDEX; int[] tmp = {j}; Point2D.Double p1, p2, p3; try {// These parameters are optional goToNextChar(params, tmp); if(params.charAt(tmp[0])=='{')// We read the arrows {// {arrow1-arrow2} j = params.indexOf("}", tmp[0]);//$NON-NLS-1$ if(j==-1) throw new InvalidFormatCommandException(line); String arr = params.substring(tmp[0]+1, j); tmp[0] = j+1; if(arr.length()>0) { int m = arr.indexOf("-");//$NON-NLS-1$ if(m==-1)// One arrow { if(PSTricksConstants.isValidArrowStyle(arr)) p.arrowStyle[0] = ArrowHead.invertArrowStyle(arr); } else { if(m!=0) if(PSTricksConstants.isValidArrowStyle(arr.substring(0, m))) p.arrowStyle[0] = arr.substring(0, m); if(m!=arr.length()) if(PSTricksConstants.isValidArrowStyle(arr.substring(m+1))) p.arrowStyle[1] = arr.substring(m+1); } } } goToNextChar(params, tmp); if(params.charAt(tmp[0])!='(') throw new InvalidFormatCommandException(line); j = params.indexOf(')', tmp[0]); if(j==-1) throw new InvalidFormatCommandException(line); p1 = readOneCoordinate(params.substring(tmp[0], j+1), 0, line, true); if(p1==null) throw new InvalidFormatCommandException(line); if(Double.isNaN(p1.x)) p1.x = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; if(Double.isNaN(p1.y)) p1.y = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; pts.add(p1); tmp[0] = j+1; }catch(Exception e) { return tmp[0]; } try {// These parameters are optional goToNextChar(params, tmp); if(params.charAt(tmp[0])!='(') throw new InvalidFormatCommandException(line); j = params.indexOf(')', tmp[0]); if(j==-1) throw new InvalidFormatCommandException(line); p2 = readOneCoordinate(params.substring(tmp[0], j+1), 0, line, true); if(p2==null) throw new InvalidFormatCommandException(line); if(Double.isNaN(p2.x)) p2.x = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; if(Double.isNaN(p2.y)) p2.y = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; pts.add(p2); tmp[0] = j+1; }catch(Exception e) { return tmp[0]; } try {// These parameters are optional goToNextChar(params, tmp); if(params.charAt(tmp[0])!='(') throw new InvalidFormatCommandException(line); j = params.indexOf(')', tmp[0]); if(j==-1) throw new InvalidFormatCommandException(line); p3 = readOneCoordinate(params.substring(tmp[0], j+1), 0, line, true); if(p3==null) throw new InvalidFormatCommandException(line); if(Double.isNaN(p3.x)) p3.x = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; if(Double.isNaN(p3.y)) p3.y = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; pts.add(p3); tmp[0] = j+1; return tmp[0]; }catch(Exception e) { return tmp[0]; } } /** * Allows to parse the options of any PSTricks figure (excepts psplot).
    * All the parameters will be in cm. * @param params The code to parse. * @param pstp The pstricks parameters. * @param applyParams If true the parsed parameters will be applied to the pstp, * else the parameters will be parsed but ignored. */ public static void parseOptionsFigure(String params, PSTricksParameters pstp, boolean applyParams) { int size = params.length(); int id[] = {0}; PSTricksParameters p = applyParams ? pstp : new PSTricksParameters(pstp); while(id[0]size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'h' : //sh if(++id[0]>size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'a' : // sha if(id[0]+3>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='d' && params.charAt(++id[0])=='o' && params.charAt(++id[0])=='w') // shadow { if(++id[0]>size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 's' : // shadowsize = Real unit if(id[0]+4>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='i' && params.charAt(++id[0])=='z' && params.charAt(++id[0])=='e' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.shadowSize = readEqualRealUnit(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='n' && params.charAt(++id[0])=='g' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='e' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.shadowAngle = readEqualReal(id, params); goToNextChar(params, id); // We go to the next token : ',' }else throw new IgnoreCommandException(-1); break; case 'c' : // shadowcolor = String if(id[0]+5>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='o' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='o' && params.charAt(++id[0])=='r' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { String s2 = readEqualString(id, params, true); Color c = DviPsColors.getColour(s2); // We search the colour if(c!=null) p.shadowCol = c; if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='w')//show { if(id[0]+1>size) throw new IgnoreCommandException(-1); switch(params.charAt(++id[0])) { case 'p'://showp if(id[0]+6>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='o' && params.charAt(++id[0])=='i' && params.charAt(++id[0])=='n' && params.charAt(++id[0])=='t' && params.charAt(++id[0])=='s' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) {//showpoints = true|false String s = readEqualString(id, params, false); if(s.equals("true")) p.showPoints = true;//$NON-NLS-1$ else if(s.equals("false")) p.showPoints = false;//$NON-NLS-1$ if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='r' && params.charAt(++id[0])=='i' && params.charAt(++id[0])=='g' && params.charAt(++id[0])=='i' && params.charAt(++id[0])=='n' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) {//showorigin = true|false String s = readEqualString(id, params, false); if(s.equals("true")) p.showOrigin = true;//$NON-NLS-1$ else if(s.equals("false")) p.showOrigin = false;//$NON-NLS-1$ if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='b' && params.charAt(++id[0])=='g' && params.charAt(++id[0])=='r' && params.charAt(++id[0])=='i' && params.charAt(++id[0])=='d') // subgrid { if(++id[0]>size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'd' : // subgridd if(++id[0]>size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'o' : // subgriddots = Integer if(id[0]+3>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='t' && params.charAt(++id[0])=='s' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.subGridDots = readEqualInteger(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='v' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.subGridDiv = readEqualInteger(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='i' && params.charAt(++id[0])=='d' && params.charAt(++id[0])=='t' && params.charAt(++id[0])=='h' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.subGridWidth = readEqualRealUnit(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='o' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='o' && params.charAt(++id[0])=='r' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { String s2 = readEqualString(id, params, true); Color c = DviPsColors.getColour(s2); // We search the colour if(c!=null) p.subGridCol = c; if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='a' && params.charAt(++id[0])=='p' && params.charAt(++id[0])=='a' && params.charAt(++id[0])=='x' && params.charAt(++id[0])=='e' && params.charAt(++id[0])=='s' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { String s = readEqualString(id, params, false); if(s.equals("true")) p.swapAxes = true;//$NON-NLS-1$ else if(s.equals("false")) p.swapAxes = false;//$NON-NLS-1$ if(id[0]size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'o' : // do if(++id[0]>size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 't' : // dot if(++id[0]>size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 's' : // dots if(++id[0]>size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'i' : //dotsize = Real unit Real if(id[0]+3>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='z' && params.charAt(++id[0])=='e' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.arrowDotSD = readEqualRealUnit(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='y' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='e' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { while(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='a' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='e' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.dotScale1 = readEqualReal(id, params); // We read the first parameter goToNextChar(params, id); // We go to the next token if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='p' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.dotStep = readEqualRealUnit(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='n' && params.charAt(++id[0])=='g' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='e' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.dotAngle = readEqualReal(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='b' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='e') // double { if(++id[0]>size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'l' : // doubleline = true/false if(id[0]+4>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='i' && params.charAt(++id[0])=='n' && params.charAt(++id[0])=='e' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { String s = readEqualString(id, params, false); if(s.equals("true")) p.dbleLine = true;//$NON-NLS-1$ else if(s.equals("false")) p.dbleLine = false;//$NON-NLS-1$ if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='e' && params.charAt(++id[0])=='p' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.dbleSep = readEqualRealUnit(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='o' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='o' && params.charAt(++id[0])=='r' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { String s2 = readEqualString(id, params, true); Color c = DviPsColors.getColour(s2); // We search the colour if(c!=null) p.dbleColor = c; if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='m' && params.charAt(++id[0])=='e' && params.charAt(++id[0])=='n' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { String s = readEqualString(id, params, false); if(s.equals(PSTricksConstants.BORDERS_INSIDE) || s.equals(PSTricksConstants.BORDERS_MIDDLE) || s.equals(PSTricksConstants.BORDERS_OUTSIDE)) { p.borderPos = s; if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='s' && params.charAt(++id[0])=='h' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { double r1 = readEqualRealUnit(id, params); double r2 = readRealUnit(id, params, true); // We read the second parameter p.dashBlack = r1; p.dashWhite = r2; if(id[0]size) throw new IgnoreCommandException(-1); if((params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.dxLabelDist = readEqualRealUnit(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if((params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.dyLabelDist = readEqualRealUnit(id, params); if(id[0]size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'r': if(++id[0]>size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'c' : //arc if(id[0]+3>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='s' && params.charAt(++id[0])=='e' && params.charAt(++id[0])=='p') // arcsep { if(++id[0]>size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'A' : // arcsepA = Real unit p.arcSepA = readEqualRealUnit(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='o' && params.charAt(++id[0])=='w') { // arrow if(++id[0]>size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 's' : // arrows if(++id[0]>size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'i' : // arrowsize= Real unit Real if(id[0]+3>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='z' && params.charAt(++id[0])=='e' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.arrowSizeD = readEqualRealUnit(id, params); goToNextChar(params, id); // We go to the next token if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='e' && params.charAt(++id[0])=='n' && params.charAt(++id[0])=='g' && params.charAt(++id[0])=='t' && params.charAt(++id[0])=='h' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.arrowLgth = readEqualReal(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='n' && params.charAt(++id[0])=='s' && params.charAt(++id[0])=='e' && params.charAt(++id[0])=='t' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.arrowInset = readEqualReal(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='e' && params.charAt(++id[0])=='s' && params.charAt(++id[0])=='s' && params.charAt(++id[0])=='t' && params.charAt(++id[0])=='y' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='e' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) {// axestyle p.axesStyle = readEqualString(id, params, true); if(id[0]size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'r' : //gr if(++id[0]>size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'i': if(id[0]+1>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='d')// grid { if(++id[0]>size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'l' ://gridl if(id[0]+4>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='a' && params.charAt(++id[0])=='b' && params.charAt(++id[0])=='e' && params.charAt(++id[0])=='l')// gridlabel { if(++id[0]>size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 's' : // gridlabels = Real unit p.gridLabel = readEqualRealUnit(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='i' && params.charAt(++id[0])=='d' && params.charAt(++id[0])=='t' && params.charAt(++id[0])=='h' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.gridWidth = readEqualRealUnit(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='o' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='o' && params.charAt(++id[0])=='r' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { String s = readEqualString(id, params, true); Color c = DviPsColors.getColour(s); // We search the colour if(c!=null) p.gridColor = c; if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='o' && params.charAt(++id[0])=='t' && params.charAt(++id[0])=='s' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.gridDots = readEqualInteger(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(id[0])=='d')// grad { if(++id[0]>size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'b' : //gradbegin if(id[0]+5>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='e' && params.charAt(++id[0])=='g' && params.charAt(++id[0])=='i' && params.charAt(++id[0])=='n' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { String r = readEqualString(id, params, true); Color c = DviPsColors.getColour(r); // We search the colour if(c!=null) p.gradBegin = c; if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='n' && params.charAt(++id[0])=='d' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { String r = readEqualString(id, params, true); Color c = DviPsColors.getColour(r); // We search the colour if(c!=null) p.gradEnd = c; if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='i' && params.charAt(++id[0])=='n' && params.charAt(++id[0])=='e' && params.charAt(++id[0])=='s' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.gradLines = readEqualInteger(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='i' && params.charAt(++id[0])=='d' && params.charAt(++id[0])=='p' && params.charAt(++id[0])=='o' && params.charAt(++id[0])=='i' && params.charAt(++id[0])=='n' && params.charAt(++id[0])=='t' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { double midPt = readEqualReal(id, params); if(midPt>=0 && midPt<=1) p.gradMidPoint = midPt; if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='n' && params.charAt(++id[0])=='g' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='e' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.gradAngle = readEqualReal(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='n' && params.charAt(++id[0])=='g' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='e' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.gangle = readEqualReal(id, params); if(id[0]size) throw new IgnoreCommandException(-1); switch(params.charAt(++id[0])) { case 'i':// li if(id[0]+2>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='n' && params.charAt(++id[0])=='e')// line { if(++id[0]>size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'w' : // linewidth = Real unit if(id[0]+5>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='i' && params.charAt(++id[0])=='d' && params.charAt(++id[0])=='t' && params.charAt(++id[0])=='h' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.lineWidth = readEqualRealUnit(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='o' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='o' && params.charAt(++id[0])=='r' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { String r = readEqualString(id, params, true); Color c = DviPsColors.getColour(r); // We search the colour if(c!=null) p.lineColor = c; if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='r' && params.charAt(++id[0])=='c' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.lineArc = readEqualRealUnit(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='t' && params.charAt(++id[0])=='y' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='e' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.lineStyle = readEqualString(id, params, false); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='b' && params.charAt(++id[0])=='e' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='s'&& (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.labels = readEqualString(id, params, false); if(id[0]size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'i': //fi if(id[0]+2>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='l' && params.charAt(++id[0])=='l')//fill { if(++id[0]>size) throw new IgnoreCommandException(-1); if(params.charAt(id[0])=='c')//fillc { if(id[0]+5>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='o' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='o' && params.charAt(++id[0])=='r' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { // fillColor = string String r = readEqualString(id, params, true); Color c = DviPsColors.getColour(r); // We search the colour if(c!=null) p.fillColor = c; if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='t' && params.charAt(++id[0])=='y' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='e' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { // fillstyle = string String r = readEqualString(id, params, false); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='a' && params.charAt(++id[0])=='m' && params.charAt(++id[0])=='e') {//frame if(id[0]+1>size) throw new IgnoreCommandException(-1); switch(params.charAt(++id[0])) { case 'a' : // framearc if(id[0]+3>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='r' && params.charAt(++id[0])=='c' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.frameArc = readEqualReal(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='e' && params.charAt(++id[0])=='p' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.frameSep = readEqualRealUnit(id, params); if(id[0]size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'o' ://bo if(id[0]+1>size) throw new IgnoreCommandException(-1); switch(params.charAt(++id[0])) { case 'r'://bor if(id[0]+3>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='d' && params.charAt(++id[0])=='e' && params.charAt(++id[0])=='r')//border { if(++id[0]>size) throw new IgnoreCommandException(-1); if(params.charAt(id[0])=='c')//borderc { if(id[0]+5>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='o' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='o' && params.charAt(++id[0])=='r' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { // bordercolor = string String r = readEqualString(id, params, true); Color c = DviPsColors.getColour(r); // We search the colour if(c!=null) p.borderColor = c; if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='s' && params.charAt(++id[0])=='e' && params.charAt(++id[0])=='p' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0]))))//boxsep { String s = readEqualString(id, params, false); if(s.equals("true")) p.boxSep = true;//$NON-NLS-1$ else if(s.equals("false")) p.boxSep = false;//$NON-NLS-1$ if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='a' && params.charAt(++id[0])=='c' && params.charAt(++id[0])=='k' && params.charAt(++id[0])=='e' && params.charAt(++id[0])=='t' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='e' && params.charAt(++id[0])=='n' && params.charAt(++id[0])=='g' && params.charAt(++id[0])=='t' && params.charAt(++id[0])=='h' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.arrowBrLgth = readEqualReal(id, params); if(id[0]size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'o' : // cornersize = absolute/relative if(id[0]+9>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='r' && params.charAt(++id[0])=='n' && params.charAt(++id[0])=='e' && params.charAt(++id[0])=='r' && params.charAt(++id[0])=='s' && params.charAt(++id[0])=='i' && params.charAt(++id[0])=='z' && params.charAt(++id[0])=='e' &&(params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { String r = readString(params, id, false); // We read the parameter r = r.toLowerCase(); if(r.equals(PSTricksConstants.TOKEN_ABSOLUTE)) p.isCornerRel = false; else if(r.equals(PSTricksConstants.TOKEN_RELATIVE)) p.isCornerRel = true; if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='r' && params.charAt(++id[0])=='v' && params.charAt(++id[0])=='a' && params.charAt(++id[0])=='t' && params.charAt(++id[0])=='e' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.curvature1 = readEqualReal(id, params); // We read the first parameter p.curvature2 = readReal(params, id, true); // We read the second parameter p.curvature3 = readReal(params, id, true); // We read the third parameter if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='r' && params.charAt(++id[0])=='i' && params.charAt(++id[0])=='g' && params.charAt(++id[0])=='i' && params.charAt(++id[0])=='n' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { readChar(params, '=', id); readChar(params, '{', id); double x=Double.NaN, y=Double.NaN; goToNextChar(params, id); // We go to the next token if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='a' && params.charAt(++id[0])=='t' && params.charAt(++id[0])=='c' && params.charAt(++id[0])=='h') { if(++id[0]>size) throw new IgnoreCommandException(-1); switch(params.charAt(id[0])) { case 'a' : // hatchangle = Real if(id[0]+5>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='n' && params.charAt(++id[0])=='g' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='e' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.hatchAngle = readEqualReal(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='i' && params.charAt(++id[0])=='d' && params.charAt(++id[0])=='t' && params.charAt(++id[0])=='h' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.hatchWidth = readEqualRealUnit(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='e' && params.charAt(++id[0])=='p' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.hatchSep = readEqualRealUnit(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='o' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='o' && params.charAt(++id[0])=='r' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { String r = readEqualString(id, params, true); Color c = DviPsColors.getColour(r); // We search the colour if(c!=null) p.hatchCol = c; if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='b' && params.charAt(++id[0])=='r' && params.charAt(++id[0])=='a' && params.charAt(++id[0])=='c' && params.charAt(++id[0])=='k' && params.charAt(++id[0])=='e' && params.charAt(++id[0])=='t' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='e' && params.charAt(++id[0])=='n' && params.charAt(++id[0])=='g' && params.charAt(++id[0])=='t' && params.charAt(++id[0])=='h' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { p.arrowrBrLgth = readEqualReal(id, params); if(id[0]size) throw new IgnoreCommandException(-1); switch(params.charAt(++id[0])) { case 'b': //tb if(params.charAt(++id[0])=='a' && params.charAt(++id[0])=='r' && params.charAt(++id[0])=='s' && params.charAt(++id[0])=='i' && params.charAt(++id[0])=='z' && params.charAt(++id[0])=='e' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { // tbarsize = Real unit Real p.arrowTBarSD = readEqualRealUnit(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='c' && params.charAt(++id[0])=='k' && params.charAt(++id[0])=='s') { // ticks if(id[0]+1>size) throw new IgnoreCommandException(-1); switch(params.charAt(++id[0])) { case 't'://tickst if(id[0]+4>size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='y' && params.charAt(++id[0])=='l' && params.charAt(++id[0])=='e' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) {//tickstyle = string p.ticksStyle = readString(params, id, false); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='z' && params.charAt(++id[0])=='e' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) {//ticksize = real unit p.ticksSize = readEqualRealUnit(id, params); if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='n' && params.charAt(++id[0])=='i' && params.charAt(++id[0])=='t' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { double r = readEqualReal(id, params); // We read the parameter goToNextChar(params, id); // We go to the next token if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='u' && params.charAt(++id[0])=='n' && params.charAt(++id[0])=='i' && params.charAt(++id[0])=='t' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { double r = readEqualReal(id, params); // We read the parameter goToNextChar(params, id); // We go to the next token if(id[0]size) throw new IgnoreCommandException(-1); if(params.charAt(++id[0])=='u' && params.charAt(++id[0])=='n' && params.charAt(++id[0])=='i' && params.charAt(++id[0])=='t' && (params.charAt(++id[0])=='=' || isCharToIgnore(params.charAt(id[0])))) { double r = readEqualReal(id, params); // We read the parameter goToNextChar(params, id); // We go to the next token if(id[0]size) throw new IgnoreCommandException(-1); switch(params.charAt(++id[0])) { case 'x': // Ox p.ox = readEqualReal(id, params); if(id[0]size) throw new IgnoreCommandException(-1); switch(params.charAt(++id[0])) { case 'x': // Dx p.dxIncrement = readEqualReal(id, params); if(id[0]'9')) { if(errorOnCharBefore && str.charAt(i)!='\t' && str.charAt(i)!='\n' && str.charAt(i)!=' ' && str.charAt(i)!='\r') throw new IgnoreCommandException(-1); i++; } if(i>=size) throw new IgnoreCommandException(-1); if(str.charAt(i)=='.') { point = true; realS='.'+realS; } else if(str.charAt(i)=='-') { negative = true; isNegatif = true; } else if(str.charAt(i)=='+') positive = true; else realS+=String.valueOf(str.charAt(i)); i++; boolean again = true; while(again) { again = false; while(i='0' && str.charAt(i)<='9'))) { if(str.charAt(i)=='.' && point) throw new IgnoreCommandException(-1); else if(str.charAt(i)=='-' && negative) throw new IgnoreCommandException(-1); else if(str.charAt(i)=='+' && positive) throw new IgnoreCommandException(-1); realS+=String.valueOf(str.charAt(i)); i++; } id[0] = i; if(isNegatif) realS='-'+realS; return Double.valueOf(realS); }catch(Exception e) { e.printStackTrace(); throw new IgnoreCommandException(-1); } } /** * Allows to read the next string in the source str (the separator is ' ') * @param str The source * @param id The position to start the research (we use a pointer to return the position * at the end of the research * @return The string * @throws IgnoreCommandException If the next string is unreachable */ public static String readString(String str, int[] id, boolean withNumber) throws IgnoreCommandException { try { if(id==null || id.length<1) throw new IgnoreCommandException(-1); int size = str.length(), i = id[0]; String string = "";//$NON-NLS-1$ if(withNumber) { while(i'z') && (str.charAt(i)<'A' || str.charAt(i)>'Z') && (str.charAt(i)<'0' || str.charAt(i)>'9')) i++; if(i>=size) throw new IgnoreCommandException(-1); while(i='a' && str.charAt(i)<='z') || (str.charAt(i)>='A' && str.charAt(i)<='Z')|| (str.charAt(i)>='0' && str.charAt(i)<='9'))) { string+=String.valueOf(str.charAt(i)); i++; } } else { while(i'z') && (str.charAt(i)<'A' || str.charAt(i)>'Z')) i++; if(i>=size) throw new IgnoreCommandException(-1); while(i='a' && str.charAt(i)<='z') || (str.charAt(i)>='A' && str.charAt(i)<='Z'))) { string+=String.valueOf(str.charAt(i)); i++; } } id[0] = i; return string; }catch(Exception e) { throw new IgnoreCommandException(-1); } } /** * Allows to read the next integer in the string * @param str The source * @param id The position to start the research (we use a pointer to return the position * at the end of the research * @return The integer * @throws IgnoreCommandException If the next integer is unreachable */ public static int readInteger(String str, int[] id) throws IgnoreCommandException { try { if(id==null || id.length<1) throw new IgnoreCommandException(-1); int size = str.length(), i = id[0]; String realS = "";//$NON-NLS-1$ while(i'9') && str.charAt(id[0])!='+')) i++; if(i>=size) throw new IgnoreCommandException(-1); boolean positif = str.charAt(id[0])=='+'; if(positif) i++; while(str.charAt(i)=='+') i++; while(i='0' && str.charAt(i)<='9') || str.charAt(i)=='+')) { if(str.charAt(i)=='+') { if(positif) throw new IgnoreCommandException(-1); positif = true; } else { realS+=String.valueOf(str.charAt(i)); i++; } } id[0] = i; return Integer.valueOf(realS); }catch(Exception e) { e.printStackTrace(); throw new IgnoreCommandException(-1); } } /** * Allows to go to the next char (not ' ', '\t', '\n', '\r') * @param str The source * @param id The position of start * @throws IgnoreCommandException If there is no char */ public static void goToNextChar(String str, int[] id) throws IgnoreCommandException { try { if(str==null || id[0]<0) throw new IgnoreCommandException(-1); int size = str.length(), i = id[0]; while(i'9') && params.charAt(id[0])!='.' && params.charAt(id[0])!='-') throw new IgnoreCommandException(-1); double r = readReal(params, id, true); // We read the parameter goToNextChar(params, id); // We go to the next token String lgth = null; if(id[0]='a' && params.charAt(id[0])<='z') || (params.charAt(id[0])>='A' && params.charAt(id[0])<='Z'))) try { if(id[0]='9') && params.charAt(id[0])!='.' && params.charAt(id[0])!='-' && params.charAt(id[0])!='+') throw new IgnoreCommandException(-1); return readReal(params, id, true); // We read the parameter } /** * Allows to read '= Integer' * @param id The position of the start of the research (a pointer : use id[0]) * @param params The string to parse * @return The read value * @throws IgnoreCommandException */ public static int readEqualInteger(int[] id, String params) throws IgnoreCommandException { int size = params.length(); while(id[0]='9') && params.charAt(id[0])!='+') throw new IgnoreCommandException(-1); return readInteger(params, id); // We read the parameter } /** * Allows to read one coordinate: (x,y). Beware, for missing coordinates like (5,) * this function will return (5,NaN) instead of (5,1); because in several cases, * the missing coordinate is very important. * @param s The string to parse. * @param i The position of the start. * @param nLine The number of the line where the code is. * @return The read coordinate. * @throws InvalidFormatCommandException If a problem occurred. */ public static Point2D.Double readOneCoordinate(String s, int i, int nLine, boolean withUnit) throws InvalidFormatCommandException { try { int size = s.length(); int[] id = {i}; while(i=size) throw new InvalidFormatCommandException(nLine); id[0]++; double x; goToNextChar(s, id); // We go to the next token if(id[0]=size) throw new InvalidFormatCommandException(nLine); id[0]++; double y; goToNextChar(s, id); // We go to the next token if(id[0]=size) throw new InvalidFormatCommandException(nLine); id[0]++; return new Point2D.Double(x, y); }catch(Exception e){throw new InvalidFormatCommandException(nLine);} } /** * Actions to do when a line must be parsed */ public abstract int actionsOnLine(int line, boolean hasStar, Vector ps, String params) throws InvalidFormatCommandException; /** * Actions to do when a polygon must be parsed */ public abstract int actionsOnPolygon(int line, boolean hasStar, Vector ps, String string) throws InvalidFormatCommandException; /** * Actions to do when a diamond or a triangle must be parsed */ public abstract int actionsOnDiamondTriangle(int line, boolean hasStar, Vector ps, String string, boolean isDiamondNotTriangle) throws InvalidFormatCommandException; /** * Actions to do when a Bézier curve must be parsed */ public abstract int actionsOnBezierCurve(int line, boolean hasStar, Vector ps, String string) throws InvalidFormatCommandException; /** * Actions to do when an arc or a wedge must be parsed. */ public abstract int actionsOnArcWedge(int line, boolean hasStar, Vector ps, String params, boolean isArc) throws InvalidFormatCommandException; /** * Actions to do when a grid must be parsed. */ public abstract int actionsOnGridAxes(int line, Vector ps, Point2D.Double pictureSWPt, Point2D.Double pictureNEPt, String string, boolean isGrid) throws InvalidFormatCommandException; /** * Allows to parse a psset command. * @param str The string to parse. * @param p The parameters to set. */ public static void parsepssetCommand(String str, PSTricksParameters p) { try { if(str==null || p==null) return; int lgth = str.length(); int[] i = {0}; while(i[0]=lgth) throw new IgnoreCommandException(-1); i[0]++; goToNextChar(str, i); parseOptionsFigure(str.substring(i[0]), p, !p.psCustomP.fromPsCustom); }catch(Exception e){e.printStackTrace();} } /* public static void parseuputCommand(String str, @SuppressWarnings("unused")boolean hasStar, Vector params) throws Exception { if(str==null || str.length()==0 || params==null) throw new InvalidFormatCommandException("uput", -1); int[] i = {0}; int size = str.length(); double labelSep=PSTricksConstants.DEFAULT_LABEL_SEP, rotation=0, refA=0; Point2D.Double coord = (Point2D.Double)params.lastElement().origin.clone(); String refAngle=null; // boolean isSum = false; goToNextChar(str, i); if(i[0]=size) throw new IgnoreCommandException(-1); i[0]++; if(i[0]0) { PSTricksParameters p2 = params.lastElement(); p.origin.setLocation(p2.origin.x, p2.origin.y); } params.add(p); } else throw new InvalidFormatCommandException("uput", -1); } */ /** * Allows to parse a rput command * @param str The string to parse. * @param hasStar If it is rput* * @param params The PsTricks parameters * @throws Exception If the command is invalid */ public static void parserputCommand(String str, boolean hasStar, Vector params) throws Exception { if(str==null || str.length()==0 || params==null) throw new InvalidFormatCommandException("rput", -1);//$NON-NLS-1$ int[] i = {0}; int size = str.length(); boolean isValidFormat = false; boolean isSumRot=true; String refPt = null; double rotation = 0; Point2D.Double coord = (Point2D.Double)params.lastElement().origin.clone(); goToNextChar(str, i); if(i[0]=size) throw new IgnoreCommandException(-1); i[0]++; if(i[0]1) { c = refPt.charAt(1); if(c==PSTricksConstants.TOKEN_RPUT_BASE) xRefPoint = PositionParameters.REF_POINT_BASE; else if(c==PSTricksConstants.TOKEN_RPUT_BOTTOM) xRefPoint = PositionParameters.REF_POINT_BOTTOM; else if(c==PSTricksConstants.TOKEN_RPUT_TOP) xRefPoint = PositionParameters.REF_POINT_TOP; else if(c==PSTricksConstants.TOKEN_RPUT_LEFT) yRefPoint = PositionParameters.REF_POINT_LEFT; else if(c==PSTricksConstants.TOKEN_RPUT_RIGHT) yRefPoint = PositionParameters.REF_POINT_RIGHT; } } p.setPosition(coord.x, coord.y, isSumRot, rotation, 0, xRefPoint+yRefPoint, 0., 0); if(params.size()>0) { PSTricksParameters p2 = params.lastElement(); p.origin.setLocation(p2.origin.x, p2.origin.y); } params.add(p); }else throw new InvalidFormatCommandException("rput", -1);//$NON-NLS-1$ if(!isValidFormat) throw new InvalidFormatCommandException("rput", -1);//$NON-NLS-1$ } /** * Allow to move a point according to the parameters (Useful for dots, texts).
    */ public static Point2D.Double moveCoordinate(Vector params, Point2D.Double pt) { if(params==null) throw new IllegalArgumentException(); int i, size = params.size(); double lastAngle=0; Point2D.Double newPt = new Point2D.Double(0, 0); PSTricksParameters p; PositionParameters pos; Vector gcs = new Vector(); boolean started = false; if(size==0) return new Point2D.Double(0,0); gcs.add(new Point2D.Double(0,0)); for(i=1; i=cmd.length()) throw new InvalidFormatCommandException(nLine); double degrees; if(end) degrees = 360; else degrees = readReal(cmd, i, true); p.onRadians = false; p.degrees = degrees; if(end) return 0; return i[0]+1; }catch(Exception e) { throw new InvalidFormatCommandException("degrees", nLine); //$NON-NLS-1$ } } /** * Action to do when a framed box is parsed. * @since 1.7 * @param type The kind of box :
    * 0: rectangle
    * 1: circle
    * 2: triangle
    * 3: diamond
    * 4: ellipse
    * 5: double rectangle
    * 6: rectangle with shadow
    * @throws InvalidFormatCommandException When the format of the command is invalid. */ public abstract int actionsOnFramedBox(int nLine, boolean hasStar, Vector ps, String cmd, String params, int type) throws InvalidFormatCommandException; /** * Action to do when one or several framed boxes have been parsed. * @since 1.7 * @throws InvalidFormatCommandException When the format of the command is invalid. */ public abstract void actionsOnTerminatedFramedBoxes(Vector params) throws InvalidFormatCommandException; /** * Parse the \begin{figure} command. * @param f The code to parse. * @param nLine The number of the current line. * @throws InvalidFormatCommandException * @since 0.3 */ public static int parseBeginFigureCmd(String f, int nLine) throws InvalidFormatCommandException { int[] i = {0}; try { goToNextChar(f, i); if(f.charAt(i[0])=='[') { i[0]++; goToNextChar(f, i); String code = readString(f, i, false); goToNextChar(f, i); if(f.charAt(i[0])!=']') throw new InvalidFormatCommandException("\\begin{figure}", nLine); //$NON-NLS-1$ PSTricksParameters.tokenPosition = code; return i[0]+1; } throw new InvalidFormatCommandException("\\begin{figure}", nLine); //$NON-NLS-1$ }catch(IgnoreCommandException e) { throw new InvalidFormatCommandException("\\begin{figure}", nLine); //$NON-NLS-1$ } } /** * Parses the command pscustom. * @param line The current line. * @param hasStar True if the command pscustom has a star. * @param params The pstricks parameters. * @param txt The text to parse. * @return The index of the last parsed token. * @throws InvalidFormatCommandException If the command is invalid. * @since 0.3 */ public int parsePsCustomCommand(int line, boolean hasStar, Vector params, String txt) throws InvalidFormatCommandException { int i[] = {0}; PSTricksParameters pstp = new PSTricksParameters(params.lastElement()); params.add(pstp); pstp.psCustomP.hasStar = hasStar; pstp.psCustomP.fromPsCustom = true; try { goToNextChar(txt, i); if(txt.charAt(i[0])=='[') // Analysis of the options { int j = txt.indexOf("]", i[0]+1);//$NON-NLS-1$ if(j==-1) throw new InvalidFormatCommandException("pscustom", line); //$NON-NLS-1$ parseOptionsFigure(txt.substring(i[0]+1, j), pstp, true); i[0] = j+1; goToNextChar(txt, i); } if(txt.charAt(i[0])=='{') i[0]++; else throw new InvalidFormatCommandException("pscustom", line); //$NON-NLS-1$ pstp.isShadow = false; //shadow, double line must be activated be \openshadow. pstp.dbleLine = false; return i[0]; } catch(IgnoreCommandException e) { throw new InvalidFormatCommandException("pscustom", line); //$NON-NLS-1$ } } /** * Actions to do when a pscustom command is finished. * @param param The pstricks parameters. * @since 0.3 */ public abstract void actionsOnterminatedPsCustom(PSTricksParameters param) throws NotFullyManagedException; /** * Parses to parameters of the pstricks command \openshadow. * @param param The pstricks parameters. * @param line The number of the current line. * @param txt The code to parse. * @return The position of the last parsed token. * @throws InvalidFormatCommandException If the command is invalid. * @since 0.3 */ public int parseOpenShadowCommand(PSTricksParameters param, int line, String txt) throws InvalidFormatCommandException { int i[] = {0}; try { goToNextChar(txt, i); if(txt.charAt(i[0])=='[') // Analysis of the options { PSTricksParameters pstp = new PSTricksParameters(param); int j = txt.indexOf("]", i[0]+1);//$NON-NLS-1$ if(j==-1) throw new InvalidFormatCommandException("openshadow", line); //$NON-NLS-1$ parseOptionsFigure(txt.substring(i[0]+1, j), pstp, true); i[0] = j+1; param.shadowAngle = pstp.shadowAngle; param.shadowCol = pstp.shadowCol; param.shadowSize = pstp.shadowSize; } param.isShadow = true; return i[0]; } catch(IgnoreCommandException e) { throw new InvalidFormatCommandException("openshadow", line); //$NON-NLS-1$ } } /** * Actions to do when a command \newpath is parsed. * @param line The number of the current line. * @since 0.3 */ public abstract void actionsOnNewPath(int line); /** * Actions to do when the command \lineto params, String txt) throws InvalidFormatCommandException; /** * Actions to do when the command \curveto params, String txt) throws InvalidFormatCommandException; /** * Actions to do when the command \moveto params, String txt) throws InvalidFormatCommandException; /** * Define actions to do when the pstricks command \closepath is parsed. * @param line The number of the current line. * @since 0.3 */ public abstract void actionsOnClosePathCommand(int line); /** * Parses the pstricks commands \lineto and \moveto. * @param nLine The number of the line. * @param txt The code to parse. * @param p1 The point to parse. * @return The position of the last parsed token. * @throws InvalidFormatCommandException If the command is not valid. * @throws IllegalArgumentException If txt or p1 is null. * @since 0.3 */ public int parseParametersLineMoveTo(int nLine, String txt, Point2D.Double p1) throws InvalidFormatCommandException { if(p1==null || txt==null) throw new IllegalArgumentException(); p1.setLocation(readOneCoordinate(txt, 0, nLine, true)); if(Double.isNaN(p1.x)) p1.x = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; if(Double.isNaN(p1.y)) p1.y = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; return txt.indexOf(')', 1); } /** * Parses the pstricks command \curveto. * @param nLine The number of the line. * @param txt The code to parse. * @param p1 The first point to parse. * @param p2 The second point to parse. * @param p3 The third point to parse. * @return The position of the last parsed token. * @throws InvalidFormatCommandException If the command is not valid. * @throws IllegalArgumentException If txt or p1 is null. * @since 0.3 */ public int parseParametersCurveTo(int nLine, String txt, Point2D.Double p1, Point2D.Double p2, Point2D.Double p3) throws InvalidFormatCommandException { int i = 0; p1.setLocation(readOneCoordinate(txt, 0, nLine, true)); if(Double.isNaN(p1.x)) p1.x = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; if(Double.isNaN(p1.y)) p1.y = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; i = txt.indexOf(')', 1); p2.setLocation(readOneCoordinate(txt, i+1, nLine, true)); if(Double.isNaN(p2.x)) p2.x = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; if(Double.isNaN(p2.y)) p2.y = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; i = txt.indexOf(')', i+1); p3.setLocation(readOneCoordinate(txt, i+1, nLine, true)); if(Double.isNaN(p3.x)) p3.x = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; if(Double.isNaN(p3.y)) p3.y = PSTricksConstants.DEFAULT_VALUE_MISSING_COORDINATE; return txt.indexOf(')', i+1); } /** * Parses the parameters of the rgbcolor command (the name of the command is supposed parsed; for instance the parameters * to parse can be {rgbColourName}{0.1 0.3 0.1}. The parsed colour is added to the DviPsColors container. * @param p The code to parse. * @throws InvalidFormatCommandException If the format of the command is not valid. * @since 2.0.0 */ public static void parseNewrgbcolorParameters(String p) throws InvalidFormatCommandException { String cmdName = "newrgbcolor";//$NON-NLS-1$ try { if(p == null || p.length() < 10) throw new IllegalArgumentException(p); String colourName; double r; double g; double b; int[] i = {0}; if(p.charAt(i[0]) != '{') throw new InvalidFormatCommandException(cmdName, -1); i[0]++; colourName = readString(p, i, true); goToNextChar(p, i); if(p.charAt(i[0]) != '}') throw new InvalidFormatCommandException(cmdName, -1); i[0]++; goToNextChar(p, i); if(p.charAt(i[0]) != '{') throw new InvalidFormatCommandException(cmdName, -1); i[0]++; r = readReal(p, i, true); g = readReal(p, i, true); b = readReal(p, i, true); goToNextChar(p, i); if(p.charAt(i[0]) != '}') throw new InvalidFormatCommandException(cmdName, -1); if(r < 0 || r > 1 || g < 0 || g > 1 || b < 0 || b > 1) throw new InvalidFormatCommandException(cmdName, -1); DviPsColors.addUserColour(new Color((int)(r*255), (int)(g*255), (int)(b*255)), colourName); }catch(IgnoreCommandException ex) { throw new InvalidFormatCommandException(cmdName, -1); } } /** * Parses the parameters of the hsbcolor command (the name of the command is supposed parsed; for instance the parameters * to parse can be {hsbColourName}{0.1 0.3 0.1}. The parsed colour is added to the DviPsColors container. * @param p The code to parse. * @throws InvalidFormatCommandException If the format of the command is not valid. * @since 2.0.0 */ public static void parseNewhsbcolorParameters(String p) throws InvalidFormatCommandException { String cmdName = "newhsbcolor";//$NON-NLS-1$ try { if(p == null || p.length() < 10) throw new IllegalArgumentException(p); String colourName; double h; double s; double b; int[] i = {0}; if(p.charAt(i[0]) != '{') throw new InvalidFormatCommandException(cmdName, -1); i[0]++; colourName = readString(p, i, true); goToNextChar(p, i); if(p.charAt(i[0]) != '}') throw new InvalidFormatCommandException(cmdName, -1); i[0]++; goToNextChar(p, i); if(p.charAt(i[0]) != '{') throw new InvalidFormatCommandException(cmdName, -1); i[0]++; h = readReal(p, i, true); s = readReal(p, i, true); b = readReal(p, i, true); goToNextChar(p, i); if(p.charAt(i[0]) != '}') throw new InvalidFormatCommandException(cmdName, -1); if(h < 0 || h > 1 || s < 0 || s > 1 || b < 0 || b > 1) throw new InvalidFormatCommandException(cmdName, -1); DviPsColors.addUserColour(Color.getHSBColor((float)h, (float)s, (float)b), colourName); }catch(IgnoreCommandException ex) { throw new InvalidFormatCommandException(cmdName, -1); } } /** * Parses the parameters of the cmykcolor command (the name of the command is supposed parsed; for instance the parameters * to parse can be {cmykColourName}{0.1 0.3 0.1 0.8}. * The parsed colour is added to the DviPsColors container. * @param p The code to parse. * @throws InvalidFormatCommandException If the format of the command is not valid. * @since 2.0.0 */ public static void parseNewcmykcolorParameters(String p) throws InvalidFormatCommandException { String cmdName = "newcmykcolor";//$NON-NLS-1$ try { if(p == null || p.length() < 12) throw new IllegalArgumentException(p); String colourName; double c; double m; double y; double k; int[] i = {0}; if(p.charAt(i[0]) != '{') throw new InvalidFormatCommandException(cmdName, -1); i[0]++; colourName = readString(p, i, true); goToNextChar(p, i); if(p.charAt(i[0]) != '}') throw new InvalidFormatCommandException(cmdName, -1); i[0]++; goToNextChar(p, i); if(p.charAt(i[0]) != '{') throw new InvalidFormatCommandException(cmdName, -1); i[0]++; c = readReal(p, i, true); m = readReal(p, i, true); y = readReal(p, i, true); k = readReal(p, i, true); goToNextChar(p, i); if(p.charAt(i[0]) != '}') throw new InvalidFormatCommandException(cmdName, -1); if(c < 0 || c > 1 || m < 0 || m > 1 || y < 0 || y > 1 || k < 0 || k > 1) throw new InvalidFormatCommandException(cmdName, -1); DviPsColors.addUserColour(DviPsColors.CMYK2RGB(c, m, y, k), colourName); }catch(IgnoreCommandException ex) { throw new InvalidFormatCommandException(cmdName, -1); } } /** * Parses the parameters of the newgray command (the name of the command is supposed parsed; for instance the parameters * to parse can be {grayColourName}{0.1} * @param p The code to parse. * @throws InvalidFormatCommandException If the format of the command is not valid. * @since 2.0.0 */ public static void parseNewgrayParameters(String p) throws InvalidFormatCommandException { String cmdName = "newgray";//$NON-NLS-1$ try { if(p == null || p.length() < 6) throw new IllegalArgumentException(p); String colourName; double g; int[] i = {0}; if(p.charAt(i[0]) != '{') throw new InvalidFormatCommandException(cmdName, -1); i[0]++; colourName = readString(p, i, true); goToNextChar(p, i); if(p.charAt(i[0]) != '}') throw new InvalidFormatCommandException(cmdName, -1); i[0]++; goToNextChar(p, i); if(p.charAt(i[0]) != '{') throw new InvalidFormatCommandException(cmdName, -1); i[0]++; g = readReal(p, i, true); goToNextChar(p, i); if(p.charAt(i[0]) != '}') throw new InvalidFormatCommandException(cmdName, -1); if(g < 0 || g > 1) throw new InvalidFormatCommandException(cmdName, -1); DviPsColors.addUserColour(DviPsColors.gray2RBG(g), colourName); }catch(IgnoreCommandException ex) { throw new InvalidFormatCommandException(cmdName, -1); } } /** * Checks if the given character is a character to ignore (' ', '\t', '\n', '\r'). * @param c The character to check. * @return True if the given character must be ignored. * @since 2.0.0 */ public static boolean isCharToIgnore(char c) { return c==' ' || c==9 || c==10 || c==13; } /** * Parses the command rotateBox{angle}{..}. In fact it parses only {angle}{, the name of the command is supposed parsed and the * first character of cmd must be {. * @param cmd The command to parse. * @param params The PSTricks stack of parameters. * @throws InvalidFormatCommandException If the command is not valid. * @since 2.0.0 */ public static void parseRotateBoxCommand(String cmd, Vector params) throws InvalidFormatCommandException { String cmdName = "rotateBox";//$NON-NLS-1$ int i[] = {0}; if(cmd==null || cmd.length()==0) throw new InvalidFormatCommandException(cmdName, -1); if(params==null) throw new IllegalArgumentException(); if(cmd.charAt(i[0])!='{') throw new InvalidFormatCommandException(cmdName, -1); i[0]++; try { double angle = readReal(cmd, i, true); goToNextChar(cmd, i); if(cmd.charAt(i[0])!='}') throw new InvalidFormatCommandException(cmdName, -1); i[0]++; goToNextChar(cmd, i); if(cmd.charAt(i[0])!='{') throw new InvalidFormatCommandException(cmdName, -1); if(params.isEmpty()) params.add(new PSTricksParameters()); else params.add(new PSTricksParameters(params.lastElement())); params.lastElement().setPosition(0, 0, true, angle, 0., 0, 0., 0.); } catch(IgnoreCommandException e) { throw new InvalidFormatCommandException(cmdName, -1); } } /** * Goes to the next occurrence of the given character and jumps it. * @param str The code to parse. * @param id input: the position of the first character to analyse. Output: the position of the character just after the found character. * @throws IgnoreCommandException If the given character is unreachable or if a character (not a ignorable character) is * reached before a comma. */ public static void readChar(String str, char c, int[] id) throws IgnoreCommandException { try { if(isCharToIgnore(c)) throw new IllegalArgumentException(); if(id==null || id.length<1) throw new IgnoreCommandException(-1); int size = str.length(); while(id[0]=size || str.charAt(id[0])!=c) throw new IgnoreCommandException(-1); id[0]++; }catch(Exception e) { e.printStackTrace(); throw new IgnoreCommandException(-1); } } public static void parseputCommand(String str, Vector params) throws InvalidFormatCommandException, IgnoreCommandException { if(str==null || str.length()==0 || params==null) throw new InvalidFormatCommandException("put", -1);//$NON-NLS-1$ int i[] = {0}; int size = str.length(); if(i[0]=size) throw new IgnoreCommandException(-1); i[0]++; if(i[0]0) { PSTricksParameters p2 = params.lastElement(); p.origin.setLocation(p2.origin.x, p2.origin.y); } params.add(p); } } } latexdraw-2.0.8+1.orig/latexDraw/parsers/pstricks/LaTeXDrawPSTricksParserActions.java0000644000000000000000000014263111347255510025542 0ustar /* * LaTeXDrawPSTricksParserActions.java */ package latexDraw.parsers.pstricks; import java.awt.geom.Arc2D; import java.awt.geom.Point2D; import java.util.Vector; import latexDraw.figures.*; import latexDraw.figures.properties.Arrowable; import latexDraw.parsers.InvalidFormatCommandException; import latexDraw.parsers.NotFullyManagedException; import latexDraw.parsers.pstricks.PSTricksParameters.PositionParameters; import latexDraw.psTricks.PSTricksConstants; import latexDraw.util.LaTeXDrawPoint2D; /** * This class defines actions to do on a given command for the LaTeXDraw project.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * * 09/06/06
    * @author Arnaud BLOUIN
    * @version 0.5
    */ public class LaTeXDrawPSTricksParserActions extends PSTricksParserActionsManager { /** The parsed figures. */ protected Vector
    figures; /** The figures contained in the pscustom command. Cleared at the end of each pscustom command.*/ public Vector
    psCustFigures; /** * The constructor by default. */ public LaTeXDrawPSTricksParserActions() { super(); psCustFigures = new Vector
    (); figures = new Vector
    (); } @Override public void actionsOnText(Vector params) throws InvalidFormatCommandException { if(params.isEmpty()) return; if(params.lastElement().textParsed.length()!=0) { PSTricksParameters last = params.lastElement(); PositionParameters pp = null; int i = params.size()-1; while(pp==null && i>=0) { pp = params.elementAt(i).getPosition(); i--; } if(pp==null) pp = new PositionParameters(); Text t = new Text(true); Point2D.Double position = moveCoordinate(params, new Point2D.Double(0,0)); double angle = Math.toRadians(PSTricksParameters.getWholeRotationAngle(params)); if(position==null) throw new InvalidFormatCommandException("text", -1); //$NON-NLS-1$ if(last.textSize!=null && last.textSize.length()!=0) t.setSizeByCommand(last.textSize); if((last.textSeries!=null && last.textSeries.equals("b")) || last.textBold) //$NON-NLS-1$ t.setIsBold(true); else t.setIsBold(false); if((last.textShape!=null && (last.textShape.equals("sl") || //$NON-NLS-1$ last.textShape.equals("it")) || last.textItalic)) //$NON-NLS-1$ t.setIsItalic(true); else t.setIsItalic(false); t.setRotationAngle(-angle); t.setText(last.textParsed); t.setLinesColor(last.textColor); if(last.textFamily!=null && last.textFamily.length()!=0) t.setTextFontByFamily(last.textFamily); t.updateFontsBorders(); LaTeXDrawPoint2D pos = new LaTeXDrawPoint2D(position.x*Figure.PPC-t.getWidth()/2., (position.y*Figure.PPC-t.getFontMetrics().getHeight()/4.)*-1); if(pp.refPoint!=PositionParameters.REF_POINT_DEFAULT_CENTER) { double addX=0, addY=0; Point2D.Double gc = new Point2D.Double((pos.x+t.getWidth())/2.,(pos.y+t.getHeight())/2.); if(pp.refPoint==PositionParameters.REF_POINT_BASE) addY=-t.getFontMetrics().getDescent(); else if(pp.refPoint==PositionParameters.REF_POINT_TOP) addY=t.getFontMetrics().getAscent()/2.; else if(pp.refPoint==PositionParameters.REF_POINT_BOTTOM) addY=-t.getFontMetrics().getDescent()*2; else if(pp.refPoint==PositionParameters.REF_POINT_LEFT) addX=t.getWidth()/2.; else if(pp.refPoint==PositionParameters.REF_POINT_RIGHT) addX=-t.getWidth()/2.; else if(pp.refPoint==PositionParameters.REF_POINT_RIGHT+PositionParameters.REF_POINT_BASE) { addY=-t.getFontMetrics().getDescent(); addX=-t.getWidth()/2.; }else if(pp.refPoint==PositionParameters.REF_POINT_RIGHT+PositionParameters.REF_POINT_BOTTOM) { addY=-t.getFontMetrics().getDescent()*2; addX=-t.getWidth()/2.; }else if(pp.refPoint==PositionParameters.REF_POINT_RIGHT+PositionParameters.REF_POINT_TOP) { addY=t.getFontMetrics().getAscent()/2.; addX=-t.getWidth()/2.; }else if(pp.refPoint==PositionParameters.REF_POINT_LEFT+PositionParameters.REF_POINT_BASE) { addY=-t.getFontMetrics().getDescent(); addX=t.getWidth()/2.; }else if(pp.refPoint==PositionParameters.REF_POINT_LEFT+PositionParameters.REF_POINT_BOTTOM) { addY=-t.getFontMetrics().getDescent()*2; addX=t.getWidth()/2.; }else if(pp.refPoint==PositionParameters.REF_POINT_LEFT+PositionParameters.REF_POINT_TOP) { addY=t.getFontMetrics().getAscent()/2.; addX=t.getWidth()/2.; } addX+=pp.labelSep*Figure.PPC; Point2D.Double pt = rotatePoint(new Point2D.Double(gc.x+addX, gc.y-addY), gc, angle); pos.setLocation(pos.x+(pt.x-gc.x), pos.y-(pt.y-gc.y)); } t.setPosition(pos); t.updateFontsBorders(); if(last.psCustomP.fromPsCustom) psCustFigures.add(t); else figures.add(t); } } /** * @return the figures */ public Vector
    getFigures() { return figures; } /** * Allows to set the parameters of a figure f. */ public void setFigureParameters(PSTricksParameters p, Figure f, boolean hasStar) { if(f==null) return ; if(f.canHaveShadow()) { f.setHasShadow(p.isShadow); f.setShadowAngle(Math.toRadians(p.shadowAngle)); f.setShadowSize(Math.abs(p.shadowSize)*Figure.PPC); f.setShadowColor(p.shadowCol); } if(f.canBeHatched()) { f.setHatchingSep(p.hatchSep*Figure.PPC); f.setGradientAngle(Math.toRadians(p.gradAngle)); f.setGradientEndColor(p.gradEnd); f.setGradientMidPoint(p.gradMidPoint); f.setGradientStartColor(p.gradBegin); } f.setLinesColor(p.lineColor); f.setBordersPosition(p.borderPos); f.setDoubleColor(p.dbleColor); f.setDoubleSep(Math.abs(p.dbleSep*Figure.PPC)); f.setHasDoubleBoundary(p.dbleLine); f.setHatchingColor(p.hatchCol); if(p.fillStyle.equals(PSTricksConstants.TOKEN_FILL_SOLID)) f.setHatchingStyle(PSTricksConstants.TOKEN_FILL_NONE); else f.setHatchingStyle( p.fillStyle.endsWith("*") ? p.fillStyle.substring(0, p.fillStyle.length()-1) : p.fillStyle);//$NON-NLS-1$ f.setHatchingWidth((float)Math.abs(p.hatchWidth*Figure.PPC)); f.setDotSep((float) p.dotStep*Figure.PPC); f.setHatchingAngle(Math.toRadians(p.hatchAngle)); f.setBlackDashLength((float)p.dashBlack*Figure.PPC); f.setWhiteDashLength((float)p.dashWhite*Figure.PPC); f.setInteriorColor(p.fillColor); f.setIsFilled(p.fillStyle.equals(PSTricksConstants.TOKEN_FILL_SOLID) || p.fillStyle.equals(PSTricksConstants.TOKEN_FILL_CROSSHATCH_F) || p.fillStyle.equals(PSTricksConstants.TOKEN_FILL_HLINES_F) || p.fillStyle.equals(PSTricksConstants.TOKEN_FILL_VLINES_F)); f.setLineStyle(p.lineStyle); f.setThickness((float)(Math.abs(p.lineWidth*Figure.PPC))); if(hasStar) { f.setIsFilled(true); f.setInteriorColor(f.getLinesColor()); f.setHasDoubleBoundary(false); f.setLineStyle(PSTricksConstants.LINE_NONE_STYLE); f.setHatchingStyle(PSTricksConstants.TOKEN_FILL_NONE); f.setBordersPosition(PSTricksConstants.BORDERS_INSIDE); } } @Override public int actionsOnFrameEllipse(int line, boolean hasStar, Vector ps, String params, boolean isFrame) throws InvalidFormatCommandException { try { if(ps.isEmpty()) return ERR_END_CMD_INDEX; Point2D.Double p3; PSTricksParameters p = ps.lastElement(); Point2D.Double p1 = new Point2D.Double(p.origin.x, p.origin.y); Point2D.Double p2 = new Point2D.Double(); PSTricksParameters newP = new PSTricksParameters(p); double angle = Math.toRadians(-PSTricksParameters.getWholeRotationAngle(ps)); int end = parseParametersFrameEllipse(line, params, p1, p2, newP); double xunit = newP.unit==PSTricksConstants.DEFAULT_UNIT? newP.xUnit : newP.unit; double yunit = newP.unit==PSTricksConstants.DEFAULT_UNIT? newP.yUnit : newP.unit ; Figure f; p1.setLocation(p1.x+p.origin.x, p1.y+p.origin.y); if(isFrame) { p2.setLocation(p2.x+p.origin.x, p2.y+p.origin.y); if(ps.size()>1) { p1 = moveCoordinate(ps, p1); p2 = moveCoordinate(ps, p2); p3 = new Point2D.Double((p1.x+p2.x)/2.,(p1.y+p2.y)/2.); p1 = rotatePoint(p1, p3, angle); p2 = rotatePoint(p2, p3, angle); } p1.setLocation(p1.x*Figure.PPC*xunit, p1.y*Figure.PPC*-1*yunit); p2.setLocation(p2.x*Figure.PPC*xunit, p2.y*Figure.PPC*-1*yunit); LaTeXDrawPoint2D pt1 = new LaTeXDrawPoint2D(p1.x, p2.y); LaTeXDrawPoint2D pt2 = new LaTeXDrawPoint2D(p2.x, p2.y); LaTeXDrawPoint2D pt3 = new LaTeXDrawPoint2D(p1.x, p1.y); LaTeXDrawPoint2D pt4 = new LaTeXDrawPoint2D(p2.x, p1.y); f = new LaTeXDrawRectangle(pt1, pt2, pt3, pt4, true); ((LaTeXDrawRectangle)f).setIsRound(newP.frameArc>0); if(newP.frameArc>0) ((LaTeXDrawRectangle)f).setFrameArc(newP.frameArc); } else { p1 = moveCoordinate(ps, p1); p1.setLocation(p1.x*Figure.PPC*xunit, p1.y*Figure.PPC*-1*yunit); p2.setLocation(p2.x*Figure.PPC*xunit, p2.y*Figure.PPC*-1*yunit); LaTeXDrawPoint2D pt1 = new LaTeXDrawPoint2D(p1.x-p2.x, p1.y+p2.y); LaTeXDrawPoint2D pt2 = new LaTeXDrawPoint2D(p1.x+p2.x, p1.y+p2.y); LaTeXDrawPoint2D pt3 = new LaTeXDrawPoint2D(p1.x-p2.x, p1.y-p2.y); LaTeXDrawPoint2D pt4 = new LaTeXDrawPoint2D(p1.x+p2.x, p1.y-p2.y); f = new Ellipse(pt1, pt2, pt3, pt4, true); } setFigureParameters(newP, f, hasStar); f.setRotationAngle(angle); if(p.psCustomP.fromPsCustom) psCustFigures.add(f); else figures.add(f); return end; }catch(Exception e) { if(isFrame) throw new InvalidFormatCommandException("psframe", line); //$NON-NLS-1$ throw new InvalidFormatCommandException("psellipse", line); //$NON-NLS-1$ } } @Override public int actionsOnCircle(int line, boolean hasStar, Vector ps, String params) throws InvalidFormatCommandException { try { PSTricksParameters p = ps.lastElement(); Point2D.Double center = new Point2D.Double(p.origin.x, p.origin.y); double[] radius = {1}; PSTricksParameters newP = new PSTricksParameters(p); Figure c; double angle = Math.toRadians(-PSTricksParameters.getWholeRotationAngle(ps)); int end = parseParametersCircle(line, params, center, radius, newP); LaTeXDrawPoint2D pt1, pt2, pt3, pt4; center = moveCoordinate(ps, center); pt1 = new LaTeXDrawPoint2D((p.origin.x+center.x-radius[0])*Figure.PPC*newP.unit, (p.origin.y+center.y+radius[0])*Figure.PPC*-1*newP.unit); pt2 = new LaTeXDrawPoint2D((p.origin.x+center.x+radius[0])*Figure.PPC*newP.unit, (p.origin.y+center.y+radius[0])*Figure.PPC*-1*newP.unit); pt3 = new LaTeXDrawPoint2D((p.origin.x+center.x-radius[0])*Figure.PPC*newP.unit, (p.origin.y+center.y-radius[0])*Figure.PPC*-1*newP.unit); pt4 = new LaTeXDrawPoint2D((p.origin.x+center.x+radius[0])*Figure.PPC*newP.unit, (p.origin.y+center.y-radius[0])*Figure.PPC*-1*newP.unit); c = new Circle(pt1, pt2, pt3, pt4, true); setFigureParameters(newP, c, hasStar); c.setRotationAngle(angle); if(p.psCustomP.fromPsCustom) psCustFigures.add(c); else figures.add(c); return end; }catch(Exception e) { throw new InvalidFormatCommandException("pscircle", line); } //$NON-NLS-1$ } @Override public int actionsOnDot(int line, Vector ps, String params, boolean noCoordinatePossible) throws InvalidFormatCommandException { try { if(ps==null || ps.isEmpty()) return ERR_END_CMD_INDEX; // It can have several points defined Vector center = new Vector(); PSTricksParameters last = ps.lastElement(); PSTricksParameters newP = new PSTricksParameters(last); double angle = Math.toRadians(-PSTricksParameters.getWholeRotationAngle(ps)); int end = parseParametersDot(line, params, center, newP, noCoordinatePossible); double xunit = newP.unit==PSTricksConstants.DEFAULT_UNIT? newP.xUnit : newP.unit; double yunit = newP.unit==PSTricksConstants.DEFAULT_UNIT? newP.yUnit : newP.unit ; newP.arrowDotSD = newP.arrowDotSD+newP.arrowDotSN<0 ? Math.abs(newP.arrowDotSD) : newP.arrowDotSD; newP.arrowDotSN = newP.arrowDotSD+newP.arrowDotSN<0 ? Math.abs(newP.arrowDotSN) : newP.arrowDotSN; newP.dotScale1 = Math.abs(newP.dotScale1); for(Point2D.Double pt: center) { pt = moveCoordinate(ps, pt); Dot d = new Dot(new LaTeXDrawPoint2D(pt.x*Figure.PPC*xunit, pt.y*Figure.PPC*-1*yunit), true); setFigureParameters(newP, d, false); d.setCurrentStyle(newP.dotStyle); d.setWidth((float)((newP.arrowDotSD+newP.arrowDotSN*newP.lineWidth)*newP.dotScale1)*Figure.PPC); d.setRotationAngle(Math.toRadians(-newP.dotAngle)+angle); d.setInteriorColor(newP.fillColor); if(!last.psCustomP.fromPsCustom) figures.add(d); } return end; }catch(Exception e) { throw new InvalidFormatCommandException("psdot", line); }//$NON-NLS-1$ } @Override public int actionsOnLine(int line, boolean hasStar, Vector ps, String params) throws InvalidFormatCommandException { try { if(ps==null || ps.isEmpty()) return ERR_END_CMD_INDEX; Vector pts = new Vector(); PSTricksParameters last = ps.lastElement(); PSTricksParameters newP = new PSTricksParameters(last); Figure f; int end = parseParametersLine(line, params, pts, newP); double xunit = newP.unit==PSTricksConstants.DEFAULT_UNIT? newP.xUnit : newP.unit; double yunit = newP.unit==PSTricksConstants.DEFAULT_UNIT? newP.yUnit : newP.unit ; if(pts.isEmpty()) return end; if(ps.size()>1) for(Point2D.Double pt : pts) pt.setLocation(moveCoordinate(ps, pt)); if(pts.size()>2)//joined lines f = new JoinedLines(new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), true); else f = new Line(new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), true); Point2D.Double ptOld= null; for(Point2D.Double pt : pts) if(!pt.equals(ptOld)) { ((LaTeXDrawPolygon)f).addPoint(new LaTeXDrawPoint2D(pt.x*Figure.PPC*xunit, pt.y*Figure.PPC*-1*yunit)); ptOld = pt; } if(pts.size()>2)//joined lines { ((JoinedLines)f).removePointAt(0); ((JoinedLines)f).removePointAt(0); ((JoinedLines)f).setArrow2Style(ArrowHead.invertArrowStyle(newP.arrowStyle[1])); if(((JoinedLines)f).getNbPoints()<2) return end; } else { ((Line)f).removePointAt(0); ((Line)f).removePointAt(0); ((Line)f).setArrow2Style(newP.arrowStyle[1]); } ((Arrowable)f).setArrow1Style(newP.arrowStyle[0]); setArrowParameters(((Arrowable)f).getArrowHead1(), newP); setArrowParameters(((Arrowable)f).getArrowHead2(), newP); setFigureParameters(newP, f, hasStar); if(last.psCustomP.fromPsCustom) psCustFigures.add(f); else figures.add(f); return end; }catch(Exception e) { e.printStackTrace(); throw new InvalidFormatCommandException("psline", line); }//$NON-NLS-1$ } /** * Sets the parameters of an arrowhead. * @param ah The arrowhead. * @param param The parameters. * @since 0.2.1 */ protected void setArrowParameters(ArrowHead ah, PSTricksParameters param) { ah.setArrowInset(param.arrowInset); ah.setArrowLength(param.arrowLgth); ah.setArrowSizeDim(param.arrowSizeD*Figure.PPC); ah.setArrowSizeNum(param.arrowSizeN); ah.setBracketNum(param.arrowBrLgth); ah.setDotSizeDim((param.arrowDotSD+param.arrowDotSN<0 ? Math.abs(param.arrowDotSD) : param.arrowDotSD)*Figure.PPC); ah.setDotSizeNum(param.arrowDotSD+param.arrowDotSN<0 ? Math.abs(param.arrowDotSN) : param.arrowDotSN); ah.setRBracketNum(param.arrowrBrLgth); ah.setTBarSizeDim(param.arrowTBarSD+param.arrowTBarSD<0 ? Math.abs(param.arrowTBarSD) : param.arrowTBarSD*Figure.PPC); ah.setTBarSizeNum(param.arrowTBarSD+param.arrowTBarSD<0 ? Math.abs(param.arrowTBarSN) : param.arrowTBarSN); } @Override public int actionsOnPolygon(int line, boolean hasStar, Vector ps, String params) throws InvalidFormatCommandException { try { if(ps==null || ps.isEmpty()) return ERR_END_CMD_INDEX; Vector pts = new Vector(); PSTricksParameters last = ps.lastElement(); PSTricksParameters newP = new PSTricksParameters(last); int end = parseParametersPolygon(line, params, pts, newP); double xunit = newP.unit!=PSTricksConstants.DEFAULT_UNIT? newP.unit : newP.xUnit; double yunit = newP.unit!=PSTricksConstants.DEFAULT_UNIT? newP.unit : newP.yUnit; if(pts.size()<2) return end; LaTeXDrawPolygon pol = new LaTeXDrawPolygon(new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), true); Point2D.Double ptOld= null; if(pts.size()==2) pts.add(new Point2D.Double(newP.origin.x, newP.origin.y)); for(Point2D.Double pt : pts) { pt.setLocation(moveCoordinate(ps, pt)); if(!pt.equals(ptOld)) { pol.addPoint(new LaTeXDrawPoint2D(pt.x*Figure.PPC*xunit, pt.y*Figure.PPC*-1*yunit)); ptOld = pt; } } pol.removePointAt(0); pol.removePointAt(0); if(pol.getNbPoints()<3) return end; setFigureParameters(newP, pol, hasStar); pol.updateBorders(); pol.updateGravityCenter(); if(last.psCustomP.fromPsCustom) psCustFigures.add(pol); else figures.add(pol); return end; }catch(Exception e) { throw new InvalidFormatCommandException("pspolygon", line); }//$NON-NLS-1$ } @Override public int actionsOnDiamondTriangle(int line, boolean hasStar, Vector ps, String params, boolean isDiamondNotTriangle) throws InvalidFormatCommandException { try { if(ps==null || ps.isEmpty()) return ERR_END_CMD_INDEX; PSTricksParameters p = ps.lastElement(); Point2D.Double p1 = new Point2D.Double(p.origin.x, p.origin.y); Point2D.Double p2 = new Point2D.Double(); PSTricksParameters newP = new PSTricksParameters(p); Figure f; double angle = Math.toRadians(-PSTricksParameters.getWholeRotationAngle(ps)); int end = parseParametersFrameEllipse(line, params, p1, p2, newP); double xunit = newP.unit!=PSTricksConstants.DEFAULT_UNIT? newP.unit : newP.xUnit; double yunit = newP.unit!=PSTricksConstants.DEFAULT_UNIT? newP.unit : newP.yUnit; p1.setLocation(p1.x+p.origin.x, p1.y+p.origin.y); double moduloA; if(ps.size()>1) moduloA = ps.elementAt(ps.size()-2).degrees; else moduloA = 360; if(isDiamondNotTriangle) { if(ps.size()>1) p1 = moveCoordinate(ps, p1); LaTeXDrawPoint2D pt1 = new LaTeXDrawPoint2D((p1.x-p2.x)*Figure.PPC*xunit, (p1.y-p2.y)*Figure.PPC*-1*yunit); LaTeXDrawPoint2D pt2 = new LaTeXDrawPoint2D((p1.x+p2.x)*Figure.PPC*xunit, (p1.y-p2.y)*Figure.PPC*-1*yunit); LaTeXDrawPoint2D pt3 = new LaTeXDrawPoint2D((p1.x-p2.x)*Figure.PPC*xunit, (p1.y+p2.y)*Figure.PPC*-1*yunit); LaTeXDrawPoint2D pt4 = new LaTeXDrawPoint2D((p1.x+p2.x)*Figure.PPC*xunit, (p1.y+p2.y)*Figure.PPC*-1*yunit); f = new Rhombus(pt1, pt2, pt3, pt4, true); } else { Point2D.Double p3 = new Point2D.Double(); if(ps.size()>1) { p1 = moveCoordinate(ps, p1); p3 = new Point2D.Double(p1.x,p1.y-p2.y/2.); p1 = rotatePoint(p1, p3, -angle); } LaTeXDrawPoint2D pt1 = new LaTeXDrawPoint2D((p1.x-p2.x/2.)*Figure.PPC*xunit, (p1.y+p2.y)*Figure.PPC*-1*yunit); LaTeXDrawPoint2D pt2 = new LaTeXDrawPoint2D((p1.x+p2.x/2.)*Figure.PPC*xunit, (p1.y+p2.y)*Figure.PPC*-1*yunit); LaTeXDrawPoint2D pt3 = new LaTeXDrawPoint2D((p1.x-p2.x/2.)*Figure.PPC*xunit, (p1.y)*Figure.PPC*-1*yunit); LaTeXDrawPoint2D pt4 = new LaTeXDrawPoint2D((p1.x+p2.x/2.)*Figure.PPC*xunit, (p1.y)*Figure.PPC*-1*yunit); f = new Triangle(pt1, pt2, pt3, pt4, true); if((newP.gangle%moduloA)!=0) { LaTeXDrawPoint2D gc = f.getGravityCenter(); LaTeXDrawPoint2D base = new LaTeXDrawPoint2D((pt1.x+pt2.x)/2., pt3.y); LaTeXDrawPoint2D newGc = Figure.rotatePoint(gc, base, Math.toRadians(-(360/moduloA)*newP.gangle)); f.shift(gc, newGc); } } setFigureParameters(newP, f, hasStar); if(isDiamondNotTriangle) { Rhombus r = ((Rhombus)f); r.setShadowAngle(r.getShadowAngle()-Math.toRadians(newP.gangle%moduloA)); r.setHatchingAngle(r.getHatchingAngle()-Math.toRadians(newP.gangle%moduloA)); r.setGradientAngle(r.getGradientAngle()-Math.toRadians(newP.gangle%moduloA)); if((newP.gangle%moduloA)!=0) r.setRotationAngle(Math.toRadians(-(360/moduloA)*newP.gangle)+angle); else r.setRotationAngle(angle); } else { Triangle t = ((Triangle)f); boolean reverse = t.getPoint(0).y>t.getPoint(2).y; t.setRotationAngle(angle); // fixes #1556340 if(reverse) { t.setShadowAngle(t.getShadowAngle()+Math.PI); t.setGradientAngle(t.getGradientAngle()+Math.PI); } } if(p.psCustomP.fromPsCustom) psCustFigures.add(f); else figures.add(f); return end; }catch(Exception e) { if(isDiamondNotTriangle) throw new InvalidFormatCommandException("psdiamond", line); //$NON-NLS-1$ throw new InvalidFormatCommandException("triangle", line); //$NON-NLS-1$ } } @Override public int actionsOnBezierCurve(int line, boolean hasStar, Vector ps, String params) throws InvalidFormatCommandException { try { if(ps==null || ps.isEmpty()) return ERR_END_CMD_INDEX; Vector pts = new Vector(); PSTricksParameters last = ps.lastElement(); PSTricksParameters newP = new PSTricksParameters(last); LaTeXDrawPoint2D p1; int ended = parseParametersBezierCurve(line, params, pts, newP), i, size, j; double xunit = newP.unit!=PSTricksConstants.DEFAULT_UNIT? newP.unit : newP.xUnit; double yunit = newP.unit!=PSTricksConstants.DEFAULT_UNIT? newP.unit : newP.yUnit; if(pts.size()<3) return ended; for(Point2D.Double pt : pts) pt.setLocation(moveCoordinate(ps, pt)); if(pts.size()%3==0) p1 = new LaTeXDrawPoint2D(newP.origin.x*Figure.PPC*xunit, newP.origin.y*-1*Figure.PPC*yunit); else { p1 = new LaTeXDrawPoint2D(pts.firstElement().x*Figure.PPC*xunit, pts.firstElement().y*-1*Figure.PPC*yunit); pts.removeElementAt(0); } Point2D.Double pt2; BezierCurve f = new BezierCurve(p1, new LaTeXDrawPoint2D(pts.elementAt(2).x*Figure.PPC*xunit, pts.elementAt(2).y*-1*Figure.PPC*yunit), true); f.setXCoordFirstCtrl(pts.firstElement().x*Figure.PPC*xunit, 0); f.setYCoordFirstCtrl(pts.firstElement().y*-1*Figure.PPC*yunit, 0); f.setXCoordFirstCtrl(pts.elementAt(1).x*Figure.PPC*xunit, 1); f.setYCoordFirstCtrl(pts.elementAt(1).y*-1*Figure.PPC*yunit, 1); i = 4; j = 2; size = pts.size(); while(i1) if(last.psCustomP.fromPsCustom) psCustFigures.add(f); else figures.add(f); return ended; }catch(Exception e) { throw new InvalidFormatCommandException("psbezier", line); } //$NON-NLS-1$ } @Override public int actionsOnArcWedge(int line, boolean hasStar, Vector ps, String params, boolean isArc) throws InvalidFormatCommandException { try { PSTricksParameters p = ps.lastElement(); Point2D.Double center = (Point2D.Double)p.origin.clone(); PSTricksParameters newP = new PSTricksParameters(p); double[] angle1 = {0}, angle2 = {0}, radius = {0}; double angle = Math.toRadians(-PSTricksParameters.getWholeRotationAngle(ps)); int end = parseParametersArcWedge(line, params, radius, center, angle1, angle2, newP, isArc); center = moveCoordinate(ps, center); Arc f = new Arc(new LaTeXDrawPoint2D((center.x-radius[0])*Figure.PPC*newP.xUnit, (center.y+radius[0])*Figure.PPC*-1*newP.xUnit), new LaTeXDrawPoint2D((center.x+radius[0])*Figure.PPC*newP.xUnit, (center.y-radius[0])*Figure.PPC*-1*newP.xUnit), isArc ? Arc2D.OPEN : Arc2D.PIE, true); f.setStartAngle(Math.toRadians(angle1[0])); f.setEndAngle(Math.toRadians(angle2[0])); f.setShowPoints(newP.showPoints); f.setArrow1Style(newP.arrowStyle[0]); String currentArrowRStyle = newP.arrowStyle[1]; if(currentArrowRStyle.equals(PSTricksConstants.DLARROW_STYLE)) currentArrowRStyle = PSTricksConstants.DRARROW_STYLE; else if(currentArrowRStyle.equals(PSTricksConstants.DRARROW_STYLE)) currentArrowRStyle = PSTricksConstants.DLARROW_STYLE; else if(currentArrowRStyle.equals(PSTricksConstants.RARROW_STYLE)) currentArrowRStyle = PSTricksConstants.LARROW_STYLE; else if(currentArrowRStyle.equals(PSTricksConstants.LARROW_STYLE)) currentArrowRStyle = PSTricksConstants.RARROW_STYLE; else if(currentArrowRStyle.equals(PSTricksConstants.DLARROW_STYLE)) currentArrowRStyle = PSTricksConstants.DRARROW_STYLE; else if(currentArrowRStyle.equals(PSTricksConstants.LRBRACKET_STYLE)) currentArrowRStyle = PSTricksConstants.RRBRACKET_STYLE; else if(currentArrowRStyle.equals(PSTricksConstants.RRBRACKET_STYLE)) currentArrowRStyle = PSTricksConstants.LRBRACKET_STYLE; else if(currentArrowRStyle.equals(PSTricksConstants.RSBRACKET_STYLE)) currentArrowRStyle = PSTricksConstants.LSBRACKET_STYLE; else if(currentArrowRStyle.equals(PSTricksConstants.LSBRACKET_STYLE)) currentArrowRStyle = PSTricksConstants.RSBRACKET_STYLE; f.setArrow2Style(currentArrowRStyle); setArrowParameters(f.getArrowHead1(), newP); setArrowParameters(f.getArrowHead2(), newP); setFigureParameters(newP, f, hasStar); f.setRotationAngle(angle); if(p.psCustomP.fromPsCustom) psCustFigures.add(f); else figures.add(f); return end; }catch(Exception e) { if(isArc) throw new InvalidFormatCommandException("psarc", line); //$NON-NLS-1$ throw new InvalidFormatCommandException("pswedge", line); //$NON-NLS-1$ } } @Override public int actionsOnGridAxes(int line, Vector ps, Point2D.Double pictureSWPt, Point2D.Double pictureNEPt, String params, boolean isGrid) throws InvalidFormatCommandException { try { if(ps==null || ps.isEmpty()) return ERR_END_CMD_INDEX; Vector pts = new Vector(); PSTricksParameters last = ps.lastElement(); PSTricksParameters newP = new PSTricksParameters(last); int gridEndX, gridEndY, gridStartX, gridStartY, originX, originY; double angle = Math.toRadians(-PSTricksParameters.getWholeRotationAngle(ps)); int end = parseParametersGridAxes(line, params, pts, newP); double xunit = newP.unit!=PSTricksConstants.DEFAULT_UNIT? newP.unit : newP.xUnit; double yunit = newP.unit!=PSTricksConstants.DEFAULT_UNIT? newP.unit : newP.yUnit; newP.origin.setLocation(moveCoordinate(ps, newP.origin)); boolean isGridXLabelReverse = false; boolean isGridYLabelReverse = false; if(pts.isEmpty()) { if(pictureNEPt.x>=0) gridEndX = (pictureNEPt.x-((int)pictureNEPt.x))>0.5 ? (int)pictureNEPt.x+1 : (int)pictureNEPt.x; else gridEndX = (((int)pictureNEPt.x)-pictureNEPt.x)>0.5 ? (int)pictureNEPt.x-1 : (int)pictureNEPt.x; if(pictureNEPt.y>=0) gridEndY = (pictureNEPt.y-((int)pictureNEPt.y))>0.5 ? (int)pictureNEPt.y+1 : (int)pictureNEPt.y; else gridEndY = (((int)pictureNEPt.y)-pictureNEPt.y)>0.5 ? (int)pictureNEPt.y-1 : (int)pictureNEPt.y; if(pictureSWPt.x>=0) gridStartX = originX = (pictureSWPt.x-((int)pictureSWPt.x))>0.5 ? (int)pictureSWPt.x+1 : (int)pictureSWPt.x; else gridStartX = originX = (((int)pictureSWPt.x)-pictureSWPt.x)>0.5 ? (int)pictureSWPt.x-1 : (int)pictureSWPt.x; if(pictureSWPt.y>=0) gridStartY = originY = (pictureSWPt.y-((int)pictureSWPt.y))>0.5 ? (int)pictureSWPt.y+1 : (int)pictureSWPt.y; else gridStartY = originY = (((int)pictureSWPt.y)-pictureSWPt.y)>0.5 ? (int)pictureSWPt.y-1 : (int)pictureSWPt.y; } else if(pts.size()==1) { gridStartX = gridStartY = originX = originY = 0; gridEndX = (int)pts.firstElement().x; gridEndY = (int)pts.firstElement().y; } else if(pts.size()==2) { originX = gridStartX = (int)pts.firstElement().x; originY = gridStartY = (int)pts.firstElement().y; gridEndX = (int)pts.elementAt(1).x; gridEndY = (int)pts.elementAt(1).y; } else { originX = (int)pts.firstElement().x; originY = (int)pts.firstElement().y; gridStartX = (int)pts.elementAt(1).x; gridStartY = (int)pts.elementAt(1).y; gridEndX = (int)pts.elementAt(2).x; gridEndY = (int)pts.elementAt(2).y; } if(gridStartX>=gridEndX) { int tmp = gridEndX; gridEndX = gridStartX; gridStartX = tmp; isGridXLabelReverse = true; } if(gridStartY>=gridEndY) { int tmp = gridEndY; gridEndY = gridStartY; gridStartY = tmp; isGridYLabelReverse = true; } LaTeXDrawPoint2D position = new LaTeXDrawPoint2D(newP.origin.x*Figure.PPC,newP.origin.y*Figure.PPC*-1); GridShape f=null; if(angle!=0) { Point2D.Double tmp1 = new Point2D.Double( position.x+((gridEndX+gridStartX)/2.)*Figure.PPC*xunit, position.y-((gridEndY+gridStartY)/2.)*Figure.PPC*yunit); Point2D.Double tmp = rotatePoint(tmp1, position, angle); position.setLocation(position.x+(tmp.x-tmp1.x), position.y+(tmp.y-tmp1.y)); } if(isGrid) { f = new Grid(position, true); Grid g = (Grid)f; g.setUnit(xunit); g.setGridDots(newP.gridDots); g.setGridLabelsColor(newP.labelsGridCol); g.setGridLabelsSize((int)((newP.gridLabel*PSTricksConstants.CM_VAL_PT)/0.6)); g.setGridWidth((float)Math.abs(newP.gridWidth*Figure.PPC)); g.setSubGridColor(newP.subGridCol); g.setSubGridDiv(newP.subGridDiv); g.setSubGridDots(newP.subGridDots); g.setSubGridWidth((float)Math.abs(newP.subGridWidth*Figure.PPC)); g.setOriginX(originX); g.setOriginY(originY); g.setLinesColor(newP.gridColor); } else { f = new Axe(position, true); Axe a = (Axe)f; a.setOriginX((int)newP.ox); a.setOriginY((int)newP.oy); a.setLabelsDisplayedToken(newP.labels); a.setTicksDisplayedToken(newP.ticks); a.setTicksStyleToken(newP.ticksStyle); a.setTicksSize(newP.ticksSize*Figure.PPC); a.setIncrementX(newP.dxIncrement); a.setIncrementY(newP.dyIncrement); a.setDistLabelsX(newP.dxLabelDist); a.setDistLabelsY(newP.dyLabelDist); a.setShowOrigin(newP.showOrigin); a.setAxesStyleToken(newP.axesStyle); setFigureParameters(newP, a, false); String arrowHead2Style = newP.arrowStyle[1]; if(arrowHead2Style.equals(PSTricksConstants.DLARROW_STYLE)) arrowHead2Style = PSTricksConstants.DRARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.DRARROW_STYLE)) arrowHead2Style = PSTricksConstants.DLARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.RARROW_STYLE)) arrowHead2Style = PSTricksConstants.LARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.LARROW_STYLE)) arrowHead2Style = PSTricksConstants.RARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.DLARROW_STYLE)) arrowHead2Style = PSTricksConstants.DRARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.LRBRACKET_STYLE)) arrowHead2Style = PSTricksConstants.RRBRACKET_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.RRBRACKET_STYLE)) arrowHead2Style = PSTricksConstants.LRBRACKET_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.RSBRACKET_STYLE)) arrowHead2Style = PSTricksConstants.LSBRACKET_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.LSBRACKET_STYLE)) arrowHead2Style = PSTricksConstants.RSBRACKET_STYLE; ((Arrowable)a).setArrow1Style(newP.arrowStyle[0]); ((Arrowable)a).setArrow2Style(arrowHead2Style); setArrowParameters(((Arrowable)a).getArrowHead1(), newP); setArrowParameters(((Arrowable)a).getArrowHead2(), newP); } f.setGridEndX(gridEndX); f.setGridEndY(gridEndY); f.setGridStartX(gridStartX); f.setGridStartY(gridStartY); f.updateFonts(); f.updateBorders(null); f.updateBorders(); f.setRotationAngle(angle); f.setXLabelSouth(!isGridYLabelReverse); f.setYLabelWest(!isGridXLabelReverse); if(!last.psCustomP.fromPsCustom) figures.add(f); return end; }catch(Exception e) { throw new InvalidFormatCommandException("psgrid or psaxes", line); } //$NON-NLS-1$ } @Override public int actionsOnPicture(int line, Vector ps, String params) throws InvalidFormatCommandException { try { String[] path = {""};//$NON-NLS-1$ int end = parseParametersPicture(line, params, path); // LaTeXDrawPoint2D position = new LaTeXDrawPoint2D(); // BatchConvertFrame bcf = new BatchConvertFrame(); // Image image = bcf.getImage(new File(path[0])); // BufferedImage bufferedI = new BufferedImage(image.getWidth(null), // image.getHeight(null), BufferedImage.TYPE_INT_RGB ); // Graphics g = bufferedI.createGraphics(); // g.drawImage(image,0,0,null); // g.dispose(); // // Picture p = new Picture(true, position, bufferedI, path[0]); // // figures.add(p); return end; }catch(Exception e) { e.printStackTrace(); throw new InvalidFormatCommandException("includegraphics", line); //$NON-NLS-1$ } } @Override public int actionsOnFramedBox(int nLine, boolean hasStar, Vector ps, String cmd, String params, int type) throws InvalidFormatCommandException { int i = ps.size()-1; PSTricksParameters pp = null; while(pp==null && i>=0) if(ps.elementAt(i).getPosition()!=null) pp = ps.elementAt(i); else i--; if(pp==null) pp = ps.firstElement(); FramedBox fb = new FramedBox(pp.psBoxText); fb.setStart(pp.textForFrame.length()); pp.psBox.add(fb); PSTricksParameters newP = new PSTricksParameters(ps.lastElement()); int end = -1; int[] j = {0}; try { goToNextChar(params, j); if(params.charAt(j[0])=='*') { j[0]++; goToNextChar(params, j); } } catch(Exception e1) { throw new InvalidFormatCommandException(nLine); } if(params.charAt(j[0])=='[') { switch(type) { case 0: fb.setBoxType(FramedBox.BOX_RECTANGLE); end = parseParametersFrameEllipse(nLine, params, null, null, newP); if(newP.frameArc>0) { ((LaTeXDrawRectangle)fb.getBox()).setFrameArc(newP.frameArc); ((LaTeXDrawRectangle)fb.getBox()).setIsRound(true); } break; case 1: fb.setBoxType(FramedBox.BOX_CIRCLE); end = parseParametersCircle(nLine, params, null, null, newP); break; case 2: fb.setBoxType(FramedBox.BOX_TRIANGLE); end = parseParametersPolygon(nLine, params, null, newP); break; case 3: fb.setBoxType(FramedBox.BOX_DIAMOND); end = parseParametersPolygon(nLine, params, null, newP); break; case 4: fb.setBoxType(FramedBox.BOX_ELLIPSE); end = parseParametersFrameEllipse(nLine, params, null, null, newP); break; case 5: fb.setBoxType(FramedBox.BOX_RECTANGLE); end = parseParametersFrameEllipse(nLine, params, null, null, newP); if(newP.frameArc>0) { ((LaTeXDrawRectangle)fb.getBox()).setFrameArc(newP.frameArc); ((LaTeXDrawRectangle)fb.getBox()).setIsRound(true); } break; case 6: fb.setBoxType(FramedBox.BOX_RECTANGLE); end = parseParametersFrameEllipse(nLine, params, null, null, newP); if(newP.frameArc>0) { ((LaTeXDrawRectangle)fb.getBox()).setFrameArc(newP.frameArc); ((LaTeXDrawRectangle)fb.getBox()).setIsRound(true); } break; } j[0] = end; } try { goToNextChar(params, j); } catch(Exception e1) { throw new InvalidFormatCommandException(nLine); } switch(type) { case 0: fb.setBoxType(FramedBox.BOX_RECTANGLE); break; case 1: fb.setBoxType(FramedBox.BOX_CIRCLE); break; case 2: fb.setBoxType(FramedBox.BOX_TRIANGLE); break; case 3: fb.setBoxType(FramedBox.BOX_DIAMOND); break; case 4: fb.setBoxType(FramedBox.BOX_ELLIPSE); break; case 5: fb.setBoxType(FramedBox.BOX_RECTANGLE); break; case 6: fb.setBoxType(FramedBox.BOX_RECTANGLE); break; } if(params.charAt(j[0])!='{')//psframebox3, psframebox[framesep=0.3]3 for instance. { PSTricksParameters p; boolean again = true; int k = ps.size()-1; while(again && k>=0) { p = ps.elementAt(k); if(p.getPosition()!=null) { again = false; p.textForFrame+=params.charAt(j[0]); } else { p.textForFrame+=params.charAt(j[0]); k--; } } k = ps.size()-1; p=null; while(p==null && k>=0) if(ps.elementAt(k).getPosition()!=null) p = ps.elementAt(k); else k--; if(p==null) p = ps.firstElement(); p.psBox.lastElement().setEnd(p.textForFrame.length()); p.psBox.add(0, p.psBox.remove(p.psBox.size()-1)); end=j[0]+1; } fb.setFrameSep(newP.frameSep*Figure.PPC); fb.setBoxSep(newP.boxSep); setFigureParameters(newP, fb.getBox(), hasStar); if(hasStar) { fb.getBox().setIsFilled(true); fb.getBox().setInteriorColor(newP.fillColor); fb.getBox().setLinesColor(newP.fillColor); } switch(type) { case 5: fb.getBox().setHasDoubleBoundary(true); break; case 6: fb.getBox().setHasShadow(true); break; } if(end==-1) end = j[0]; return end; } @Override public void actionsOnTerminatedFramedBoxes(Vector params) throws InvalidFormatCommandException { PSTricksParameters pp = params.lastElement(); String str = pp.psBoxText.getText(); if(str.length()==0) str = " ";//$NON-NLS-1$ pp.textParsed = pp.textForFrame; actionsOnText(params); if(pp.psBox.isEmpty()) return; Text txt = (Text)figures.remove(figures.size()-1); boolean simpleBox = pp.psBox.size()==1 && pp.psBox.firstElement().getBoxedText().equals(txt.getText()); if(simpleBox) { FramedBox fb = pp.psBox.firstElement(); fb.setText(txt); fb.setStart(-1); fb.setEnd(-1); fb.getBox().setBordersPosition(PSTricksConstants.BORDERS_OUTSIDE); txt.setSimpleBox(fb); } else for(FramedBox fb : pp.psBox) { fb.setText(txt); txt.addBox(fb); fb.getBox().setBordersPosition(PSTricksConstants.BORDERS_OUTSIDE); } txt.setHasFramedBox(!pp.psBox.isEmpty()); txt.setHasSimpleFramedBox(simpleBox); txt.updateFramedBoxes(); txt.updateFontsBorders(); if(!pp.psCustomP.fromPsCustom) figures.add(txt); if(simpleBox) { if(txt.getSimpleBox().getBoxType()==FramedBox.BOX_TRIANGLE) { double height = (txt.getSimpleBox().getBox().getTheSEBoundPoint().y- txt.getSimpleBox().getBox().getTheNWBoundPoint().y)/4.; LaTeXDrawPoint2D pos = txt.getPosition(); txt.setPosition(new LaTeXDrawPoint2D(pos.x, pos.y+height)); txt.getSimpleBox().getBox().updateShape(); } } else { FramedBox fb, max=null; double xMin=Double.MAX_VALUE; int i=0, size = txt.getMultipleBox().size(); while(i vFigures) { Vector vArcs = new Vector(); Vector vLines = new Vector(); Vector vCurves = new Vector(); int sizevl, i, size, j; for(Figure f : vFigures) if(f instanceof Line) vLines.add((Line)f); else if(f instanceof Arc) vArcs.add((Arc)f); else if(f instanceof BezierCurve) vCurves.add((BezierCurve)f); sizevl = vLines.size(); for(Arc a : vArcs)// We check if we can convert arc+line in chord. if(a.getType()==Arc2D.OPEN) { boolean again = true; i=0; LaTeXDrawPoint2D startP, endP, p1, p2; Line l=null; while(again && i1)// We try to concat the Bézier curves. { if(vCurves.size()<200)// We must set a limit otherwise it may have a freeze. { BezierCurve b1, b2; for(j=0; j1) { if(f instanceof AkinPoints && ((AkinPoints)f).getType()==AkinPoints.TYPE_CURVES) {// We must transform the read points. AkinPoints ak = (AkinPoints)f; int j, size = ak.getNbPoints(); LaTeXDrawPoint2D prev, curr = ak.getPoint(0); for(j=1; j0 && psCustFigures.lastElement() instanceof AkinPoints) { double xunit = param.unit!=PSTricksConstants.DEFAULT_UNIT? param.unit : param.xUnit; double yunit = param.unit!=PSTricksConstants.DEFAULT_UNIT? param.unit : param.yUnit; AkinPoints ak = new AkinPoints(new LaTeXDrawPoint2D( param.psCustomP.lastPosition.x*Figure.PPC*xunit, param.psCustomP.lastPosition.y*Figure.PPC*yunit*-1), true); ak.setInterval(1); ak.setType(AkinPoints.TYPE_LINES); psCustFigures.add(ak); } return end; } @Override public int actionsOnCurveTo(int line, Vector params, String txt) throws InvalidFormatCommandException { Point2D.Double p1 = new Point2D.Double(); Point2D.Double p2 = new Point2D.Double(); Point2D.Double p3 = new Point2D.Double(); int end = parseParametersCurveTo(line, txt, p1, p2, p3); PSTricksParameters last = params.lastElement(); AkinPoints ak ; double xunit = last.unit!=PSTricksConstants.DEFAULT_UNIT? last.unit : last.xUnit; double yunit = last.unit!=PSTricksConstants.DEFAULT_UNIT? last.unit : last.yUnit; if(psCustFigures.isEmpty() || !(psCustFigures.lastElement() instanceof AkinPoints)) { ak = new AkinPoints(new LaTeXDrawPoint2D(last.psCustomP.lastPosition.x*Figure.PPC*xunit, last.psCustomP.lastPosition.y*Figure.PPC*-1*yunit), true); setFigureParameters(params.lastElement(), ak, false); ak.setInterval(1); psCustFigures.add(ak); } else ak = (AkinPoints)psCustFigures.lastElement(); ak.setType(AkinPoints.TYPE_CURVES); ak.addPoint(new LaTeXDrawPoint2D(p3.x*Figure.PPC*xunit, p3.y*Figure.PPC*-1*yunit)); last.psCustomP.lastPosition.setLocation(p3); return end; } @Override public int actionsOnLineTo(int line, Vector params, String txt) throws InvalidFormatCommandException { Point2D.Double p1 = new Point2D.Double(); int end = parseParametersLineMoveTo(line, txt, p1); PSTricksParameters last = params.lastElement(); AkinPoints ak ; double xunit = last.unit!=PSTricksConstants.DEFAULT_UNIT? last.unit : last.xUnit; double yunit = last.unit!=PSTricksConstants.DEFAULT_UNIT? last.unit : last.yUnit; if(psCustFigures.isEmpty() || !(psCustFigures.lastElement() instanceof AkinPoints)) { ak = new AkinPoints(new LaTeXDrawPoint2D(last.psCustomP.lastPosition.x*Figure.PPC*xunit, last.psCustomP.lastPosition.y*Figure.PPC*-1*yunit), true); setFigureParameters(params.lastElement(), ak, false); ak.setInterval(1); ak.setType(AkinPoints.TYPE_LINES); psCustFigures.add(ak); } else ak = (AkinPoints)psCustFigures.lastElement(); ak.addPoint(new LaTeXDrawPoint2D(p1.x*Figure.PPC*xunit, p1.y*Figure.PPC*-1*yunit)); last.psCustomP.lastPosition.setLocation(p1); return end; } @Override public int actionsOnMoveTo(int line, Vector params, String txt) throws InvalidFormatCommandException { Point2D.Double p1 = new Point2D.Double(); int end = parseParametersLineMoveTo(line, txt, p1); PSTricksParameters last = params.lastElement(); last.psCustomP.lastPosition.setLocation(p1); return end; } @Override public void actionsOnClosePathCommand(int line) { if(!psCustFigures.isEmpty()) { Figure f = psCustFigures.lastElement(); if(f instanceof AkinPoints) ((AkinPoints)f).setOpen(false); } } } latexdraw-2.0.8+1.orig/latexDraw/parsers/pstricks/PSTricksParser.java0000644000000000000000000043540711347255510022513 0ustar package latexDraw.parsers.pstricks; import java.awt.Color; import java.awt.geom.Point2D; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.Hashtable; import java.util.Vector; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JProgressBar; import javax.swing.SwingUtilities; import latexDraw.figures.FramedBox; import latexDraw.lang.LaTeXDrawLang; import latexDraw.parsers.*; import latexDraw.psTricks.DviPsColors; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.dialog.ExceptionFrameDialog; /** * This class defines a PSTricks parser.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * * 09/06/06
    * @author Arnaud BLOUIN
    * @version 0.5
    */ public class PSTricksParser extends Parser { /** Manages the actions to do when a command is parsed. */ PSTricksParserActionsManager texParserActions; /** The progress bar */ private JProgressBar progressB; /** Allows to stop the thread (if there is a one) */ private boolean stopThread; private static final Hashtable latexCommandsWithBrackets; private static final Hashtable latexCommandsWithoutBrack; static { latexCommandsWithBrackets = new Hashtable(); latexCommandsWithBrackets.put("textit", "textit");//$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("textbf", "textbf");//$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("address", "address");//$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("acute", "acute");//$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("\"", "\""); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("’", "’"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put(".", "."); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("=", "="); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithBrackets.put("b", "b"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("‘", "‘"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("newtie", "newtie"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("^", "^"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithBrackets.put("c", "c"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("d", "d"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("G", "G"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("H", "H"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithBrackets.put("U", "U"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("t", "t"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("r", "r"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("k", "k"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithBrackets.put("u", "u"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("v", "v"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("~", "~"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("vdots", "vdots"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithBrackets.put("author", "author"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("arabic", "arabic"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("alph", "alph"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithBrackets.put("overbrace", "overbrace"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithBrackets.put("widetilde", "widetilde"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("overline", "overline"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("overleftarrow", "overleftarrow"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("underbrace", "underbrace"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithBrackets.put("widehat", "widehat"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("underline", "underline"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("overriglatexCommandsWithBracketsarrow", "overriglatexCommandsWithBracketsarrow"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("bigcap", "bigcap"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithBrackets.put("bigcup", "bigcup"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithBrackets.put("bigodot", "bigodot"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("bigoplus", "vdash"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithBrackets.put("bigotimes", "bigotimes"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("coprod", "coprod"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithBrackets.put("bigwedge", "bigwedge"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithBrackets.put("bigsqcup", "bigsqcup"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("biguplus", "biguplus"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("bigvee", "bigvee"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("int", "int"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithBrackets.put("prod", "prod"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithBrackets.put("sum", "sum"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack = new Hashtable(); latexCommandsWithoutBrack.put("ldots", "ldots"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("ldotp", "ldotp"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("vdash", "vdash"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("vdots", "vdots"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("aa", "aa"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("accent", "accent"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("ae", "ae"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("aleph", "aleph"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("alpha", "alpha"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("angle", "angle"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("approx", "approx"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("arccos", "arccos"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("arcsin", "arcsin"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("arctan", "arctan"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("arg", "arg"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("arrowvert", "arrowvert"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("asymp", "asymp"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("atop", "atop"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("atopwithdelims", "atopwithdelims"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("AA", "AA"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("AE", "AE"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("DH", "DH"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("l", "l"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("L", "L"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("dj", "dj"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("DJ", "DJ"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("dh", "dh"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("NG", "NG"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("ng", "ng"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("o", "o"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("O", "O"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("OE", "OE"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("gamma", "gamma"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("beta", "beta"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("delta", "delta"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("epsilon", "epsilon"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("Gamma", "Gamma"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("Delta", "Delta"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("Lambda", "Lambda"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("Theta", "Theta"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("vartheta", "vartheta"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("theta", "theta"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("eta", "eta"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("zeta", "zeta"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("varepsilon", "varepsilon"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("iota", "iota"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("kappa", "kappa"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("lambda", "lambda"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("mu", "mu"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("nu", "nu"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("Xi", "Xi"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("Pi", "Pi"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("Upsilon", "Upsilon"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("Sigma", "Sigma"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("rho", "rho"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("varpi", "varpi"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("pio", "pio"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("xi", "xi"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("varrho", "varrho"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("sigma", "sigma"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("varsigma", "varsigma"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("tau", "tau"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("upsilon", "upsilon"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("Phi", "Phi"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("Psi", "Psi"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("Omega", "Omega"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("omega", "omega"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("psi", "psi"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("chi", "chi"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("varphi", "varphi"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("phi", "phi"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("bowtie", "bowtie"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("cong", "cong"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("dashv", "dashv"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("doteq", "doteq"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("equiv", "equiv"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("frown", "frown"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("models", "models"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("mid", "mid"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("ll", "ll"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("leq", "leq"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("Join", "Join"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("in", "in"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("gg", "gg"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("geq", "geq"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("neq", "neq"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("ni", "ni"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("parallel", "parallel"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("perp", "perp"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("prec", "prec"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("preceq", "preceq"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("propto", "propto"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("sim", "sim"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("subseteq", "subseteq"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("subset", "subset"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("smile", "smile"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("simeq", "simeq"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("succ", "succ"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("succeq", "succeq"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("supset", "supset"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("supseteq", "supseteq"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("vdash", "vdash"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("rmoustache", "rmoustache"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("lmoustache", "lmoustache"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("rgroup", "rgroup"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("lgroup", "lgroup"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("arrowvert", "arrowvert"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("bracevert", "bracevert"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("Arrowvert", "Arrowvert"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("bot", "bot"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("top", "top"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("forall", "forall"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("exists", "exists"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("Im", "Im"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("nabla", "nabla"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("Re", "simeq"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("infty", "infty"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("ell", "ell"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("neg", "neg"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("prime", "prime"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("wp", "wp"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("hbar", "hbar"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("backslash", "backslash"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("cos", "cos"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("cosh", "cosh"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("cot", "cot"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("inf", "inf"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("hom", "hom"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("gcd", "gcd"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("exp", "exp"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("dim", "dim"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("det", "det"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("deg", "deg"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("csc", "csc"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("coth", "coth"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("ker", "ker"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("lg", "lg"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("lim", "lim"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("liminf", "liminf"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("limsup", "limsup"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("ln", "ln"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("log", "csc"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("max", "max"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("min", "min"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("Pr", "Pr"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("sec", "sec"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("sin", "sin"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("sinh", "sinh"); //$NON-NLS-1$//$NON-NLS-2$ latexCommandsWithoutBrack.put("sup", "sup"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("tan", "tan"); //$NON-NLS-1$ //$NON-NLS-2$ latexCommandsWithoutBrack.put("tanh", "tanh"); //$NON-NLS-1$//$NON-NLS-2$ } /** * The constructor. * @param texParserAc The actions manager. */ public PSTricksParser(PSTricksParserActionsManager texParserAc) { texParserActions = texParserAc; stopThread = true; } public synchronized void setStopThread(boolean state) { stopThread = state; } /** * Allows to parse a TeX file. * @param f The TeX file to parse. * @param parent The main frame: Useful to display message dialog (can be equal to null: no message). */ public int parse(File f, JFrame parent, JProgressBar pg) { if(f==null) throw new IllegalArgumentException(); try { setStopThread(false); if(!f.exists() || !f.isFile() || !f.canRead() || !f.exists()) throw new IOException(); FileReader fr = new FileReader(f); BufferedReader br = new BufferedReader(fr); String eol = System.getProperty("line.separator");//$NON-NLS-1$ String s = "";//$NON-NLS-1$ String line; while( (line=br.readLine())!=null) s+=line+eol; br.close(); fr.close(); return parse(s, parent, pg); }catch(IOException e) { String msg = LaTeXDrawLang.getString1_6("PSTricksParser.0"); //$NON-NLS-1$ if(parent==null) System.out.println(msg); else JOptionPane.showMessageDialog(parent, msg, LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.86"), //$NON-NLS-1$ JOptionPane.ERROR_MESSAGE); return ERROR_PARSING; } } /** * Allows to update the progress bar. * @param newValue its new value. */ public synchronized void updateBar(int newValue) { if(progressB!=null) progressB.setValue(newValue); } /** * Allows to parse a TeX file. * @param file The TeX code to parse. * @param parent The main frame: useful to display message dialog (can be equal to null: no message). * @param progressBar The progress bar of the parser. If null, it will not be used. */ public int parse(String file, JFrame parent, JProgressBar progressBar) { try { PSTricksParameters.reinitialize(); stopThread = false; progressB = progressBar; /* *********************************************************************** */ /* We remove big spaces and comments */ char eol = System.getProperty("line.separator").charAt(0);//$NON-NLS-1$ char[] f2 = new char[file.length()]; int i=0, lgth = file.length(), cpt=0; boolean zero = false; while(i0) if(file.charAt(i-1)=='\\') { f2[cpt++] = file.charAt(i); zero = false; } else { while(i params = new Vector(); boolean started = false; i = 0; int i2; lgth = f.length(); int nLine = 1; Vector parserMsgs = new Vector(); boolean parsingFinished = false; boolean lastTokenIsEOL = false, isFramedBox = false; int iOld = i; boolean startedWithBeginPs = true; while(i=lgth) throw new UnexceptedEndOfFileException(); i++; break; case '\\' : // ********************** // /* Parsing of the command */ i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); switch(f.charAt(i)) { case 'p' : i2 = i; if(i+1>=lgth) { if(started) throw new UnexceptedEndOfFileException(); throw new IgnoreCommandException(nLine); } i++; switch(f.charAt(i)) { case 's' ://ps if(i+1>=lgth) throw new UnexceptedEndOfFileException(); i++; switch(f.charAt(i)) { case 'c' : // psc if(!started) throw new IgnoreCommandException(nLine); if(i+1>=lgth) throw new UnexceptedEndOfFileException(); i++; switch(f.charAt(i)) { case 'o' :// pscoil if(i+3>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='i' && f.charAt(++i)=='l' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("pscoil", nLine);//$NON-NLS-1$ i=i2; throw new UnknownCommandException(nLine); case 'i' : // psci if(i+4>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='r' && f.charAt(++i)=='c' && f.charAt(++i)=='l' && f.charAt(++i)=='e') // pscircle { if(++i>=lgth) throw new UnexceptedEndOfFileException(); if((f.charAt(i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))//pscircle { int end = texParserActions.actionsOnCircle(nLine, f.charAt(i)=='*', params, f.substring(i, f.length())); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; } else { if(i+3>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(i)=='b' && f.charAt(++i)=='o' && f.charAt(++i)=='x' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) // pscriclebox { PSTricksParameters tp = params.lastElement(); if(tp.psBox.isEmpty()) tp.psBoxText.setText("");//$NON-NLS-1$ int end = texParserActions.actionsOnFramedBox(nLine, f.charAt(i)=='*', params, f.substring(i, f.length()), f.substring(i, f.length()), 1); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; isFramedBox = true; } else { i=i2; throw new UnknownCommandException(nLine); } } } else { i=i2; throw new UnexceptedEndOfFileException(); } break; case 'c' : // psccurve if(i+10>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='c' && f.charAt(++i)=='u' && f.charAt(++i)=='r' && f.charAt(++i)=='v' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("psccurve", nLine);//$NON-NLS-1$ i=i2; throw new UnknownCommandException(nLine); case 'u' : // pscu if(i+1>=lgth) throw new UnexceptedEndOfFileException(); switch(f.charAt(++i)) { case 's'://pscus if(i+4>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='t' && f.charAt(++i)=='o' && f.charAt(++i)=='m' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))//pscustom { int end = texParserActions.parsePsCustomCommand( nLine, f.charAt(i)=='*', params, f.substring((f.charAt(i)=='*'?i+1:i), f.length())); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; } else { i=i2; throw new UnknownCommandException(nLine); } break; case 'r'://pscur if(i+3>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='v' &&f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))// pscurve throw new NotYetManagedException("pscurve", nLine);//$NON-NLS-1$ i=i2; throw new UnknownCommandException(nLine); default: i=i2; throw new UnknownCommandException(nLine); } break; } break; case 'a' : // psa if(!started) throw new IgnoreCommandException(nLine); if(i+1>=lgth)throw new UnexceptedEndOfFileException(); i++; switch(f.charAt(i)) { case 'x' :// psaxes if(i+3>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='e' && f.charAt(++i)=='s' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { if(f.charAt(i)=='*') i++; int end = texParserActions.actionsOnGridAxes(nLine, params, PSTricksParameters.pictureSWPt, PSTricksParameters.pictureNEPt, f.substring(i, f.length()), false); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; } else { i=i2; throw new UnknownCommandException(nLine); } break; case 'd' : // psaddtolength if(i+10>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='d' && f.charAt(++i)=='t' && f.charAt(++i)=='o' && f.charAt(++i)=='l' && f.charAt(++i)=='e' && f.charAt(++i)=='n' && f.charAt(++i)=='g' && f.charAt(++i)=='t' && f.charAt(++i)=='t' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("psaddtolength", nLine);//$NON-NLS-1$ i=i2; throw new UnknownCommandException(nLine); case 'r' : // psar if(i+1>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='c') { if(i+1>=lgth) throw new UnexceptedEndOfFileException(); if((f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))//psarc { int end = texParserActions.actionsOnArcWedge(nLine, f.charAt(i)=='*', params, f.substring(i, f.length()),true); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; } else { if(f.charAt(i)=='n' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))// psarcn throw new NotYetManagedException("psarcn", nLine);//$NON-NLS-1$ } } else { i=i2; throw new UnknownCommandException(nLine); } break; default : i=i2; throw new UnknownCommandException(nLine); } break; case 'p' : // psp if(i+1>=lgth) { if(started) throw new UnexceptedEndOfFileException(); throw new IgnoreCommandException(nLine); } i++; switch(f.charAt(i)) { case 'o' :// pspolygon if(!started) throw new IgnoreCommandException(nLine); if(i+6>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='l' && f.charAt(++i)=='y' && f.charAt(++i)=='g' && f.charAt(++i)=='o' && f.charAt(++i)=='n' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { int end = texParserActions.actionsOnPolygon(nLine, f.charAt(i)=='*', params, f.substring(i, f.length())); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; } else { i=i2; throw new UnknownCommandException(nLine); } break; case 'i' : // pspicture if(i+6>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='c' && f.charAt(++i)=='t' && f.charAt(++i)=='u' && f.charAt(++i)=='r' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { if(started) throw new FatalErrorParsingException( LaTeXDrawLang.getString1_6("PSTricksParser.1")+ //$NON-NLS-1$ LaTeXDrawLang.getString1_6("PSTricksParser.2")); //$NON-NLS-1$ started = true; startedWithBeginPs = false; Point2D.Double pt1, pt2; String sub = f.substring(i); try { pt1 = PSTricksParserActionsManager.readOneCoordinate(sub, 0, nLine, true); i += sub.indexOf(")", 0);//$NON-NLS-1$ }catch(Exception e) { throw new FatalErrorParsingException("Invalid command \\begin{pspicture}");//$NON-NLS-1$ } int j, k = ++i; try { // optional while(k=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='r' && f.charAt(++i)=='a' && f.charAt(++i)=='b' && f.charAt(++i)=='o' && f.charAt(++i)=='l' && f.charAt(++i)=='a' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("psparabola", nLine);//$NON-NLS-1$ i=i2; throw new UnknownCommandException(nLine); default : i=i2; throw new UnknownCommandException(nLine); } break; case 's' : // pss if(!started) throw new IgnoreCommandException(nLine); if(i+1>=lgth)throw new UnexceptedEndOfFileException(); i++; switch(f.charAt(i)) { case 'e' :// psset if(i+1>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='t') { if(i+1>=lgth) throw new UnexceptedEndOfFileException(); if((f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))//psset { int j = i; int cptBrack=0; while(j0)) { if(f.charAt(j)=='{') cptBrack++; else if(f.charAt(j)=='}' && cptBrack>0) cptBrack--; j++; // We search the '}' } if(j>=lgth) throw new UnexceptedEndOfFileException(); j++; String str = f.substring(i, j); PSTricksParserActionsManager.parsepssetCommand(str, params.lastElement()); i = j; } else { if(i+3>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(i)=='b' && f.charAt(++i)=='o' && f.charAt(++i)=='x' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))//pssetbox throw new NotYetManagedException("pssetbox", nLine);//$NON-NLS-1$ } } // if(f.charAt(++i)=='t') else { i=i2; throw new UnknownCommandException(nLine); } break; case 'h' : // psshadowbox if(i+8>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='a' && f.charAt(++i)=='d' && f.charAt(++i)=='o' && f.charAt(++i)=='w' && f.charAt(++i)=='b' && f.charAt(++i)=='o' && f.charAt(++i)=='x' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { PSTricksParameters tp = params.lastElement(); if(tp.psBox.isEmpty()) tp.psBoxText.setText("");//$NON-NLS-1$ int end = texParserActions.actionsOnFramedBox(nLine, f.charAt(i)=='*', params, f.substring(i, f.length()), f.substring(i, f.length()), 6); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; isFramedBox = true; } else { i=i2; throw new UnknownCommandException(nLine); } break; default : i=i2; throw new UnknownCommandException(nLine); } break; case 'f' : // psf if(!started) throw new IgnoreCommandException(nLine); if(i+4>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='r' && f.charAt(++i)=='a' && f.charAt(++i)=='m' && f.charAt(++i)=='e')//psframe { if(i+1>=lgth) throw new UnexceptedEndOfFileException(); i++; if((f.charAt(i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))//psframe { int end = texParserActions.actionsOnFrameEllipse(nLine, f.charAt(i)=='*', params, f.substring(i, f.length()), true); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; } else { if(i+3>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(i)=='b' && f.charAt(++i)=='o' && f.charAt(++i)=='x' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))//psframebox { PSTricksParameters tp = params.lastElement(); if(tp.psBox.isEmpty()) tp.psBoxText.setText("");//$NON-NLS-1$ int end = texParserActions.actionsOnFramedBox(nLine, f.charAt(i)=='*', params, f.substring(i, f.length()), f.substring(i, f.length()), 0); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) { i+=end; isFramedBox = true; } } else { i=i2; throw new UnknownCommandException(nLine); } } } else { i=i2; throw new UnknownCommandException(nLine); } break; case 'l' : // psl if(!started) throw new IgnoreCommandException(nLine); if(i+1>=lgth) throw new UnexceptedEndOfFileException(); i++; switch(f.charAt(i)) { case 'i' :// psline if(i+3>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='n' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { int end = texParserActions.actionsOnLine(nLine, f.charAt(i)=='*', params, f.substring(i, f.length())); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; } else { i=i2; throw new UnknownCommandException(nLine); } break; case 'o' : // pslongbox if(i+10>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='n' && f.charAt(++i)=='g' && f.charAt(++i)=='b' && f.charAt(++i)=='o' && f.charAt(++i)=='x' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("pslongbox", nLine);//$NON-NLS-1$ i=i2; throw new UnknownCommandException(nLine); default : i=i2; throw new UnknownCommandException(nLine); } break; case 'd' : //psd if(!started) throw new IgnoreCommandException(nLine); if(i+1>=lgth) throw new UnexceptedEndOfFileException(); i++; switch(f.charAt(i)) { case 'o' :// psdots if(++i>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(i)=='t') // psdot { if(++i>=lgth) throw new UnexceptedEndOfFileException(); if((f.charAt(i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) //psdot command { int end = texParserActions.actionsOnDot(nLine, params, f.substring(i, f.length()),true); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; }else { if(i+1>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(i)=='s' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { // psdots int end = texParserActions.actionsOnDot(nLine, params, f.substring(i, f.length()),false); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; }else { i=i2; throw new UnknownCommandException(nLine); } } }else { i=i2; throw new UnknownCommandException(nLine); } break; case 'b' : // psdblframebox if(i+10>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='l' && f.charAt(++i)=='f' && f.charAt(++i)=='r' && f.charAt(++i)=='a' && f.charAt(++i)=='m' && f.charAt(++i)=='e' && f.charAt(++i)=='b' && f.charAt(++i)=='o' && f.charAt(++i)=='x' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { PSTricksParameters tp = params.lastElement(); if(tp.psBox.isEmpty()) tp.psBoxText.setText("");//$NON-NLS-1$ int end = texParserActions.actionsOnFramedBox(nLine, f.charAt(i)=='*', params, f.substring(i, f.length()), f.substring(i, f.length()), 5); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; isFramedBox = true; } else { i=i2; throw new UnknownCommandException(nLine); } break; case 'i' : // psdi if(i+1>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='a')//psdia { if(i+5>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='m' && f.charAt(++i)=='o' && f.charAt(++i)=='n' && f.charAt(++i)=='d' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) {// psdiamond int end = texParserActions.actionsOnDiamondTriangle(nLine, f.charAt(i)=='*', params, f.substring(i, f.length()), true); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; } else { if(i+3>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(i)=='b' && f.charAt(++i)=='o' && f.charAt(++i)=='x' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) {//psdiabox PSTricksParameters tp = params.lastElement(); if(tp.psBox.isEmpty()) tp.psBoxText.setText("");//$NON-NLS-1$ int end = texParserActions.actionsOnFramedBox(nLine, f.charAt(i)=='*', params, f.substring(i, f.length()), f.substring(i, f.length()), 3); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; isFramedBox = true; } else { i=i2; throw new UnknownCommandException(nLine); } } } else { i=i2; throw new UnknownCommandException(nLine); } break; default : i=i2; throw new UnknownCommandException(nLine); } break; case 'e' : // pse if(!started) throw new IgnoreCommandException(nLine); if(i+1>=lgth) throw new UnexceptedEndOfFileException(); i++; switch(f.charAt(i)) { case 'l' :// psellipse if(i+6>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='l' && f.charAt(++i)=='i' && f.charAt(++i)=='p' && f.charAt(++i)=='s' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { int end = texParserActions.actionsOnFrameEllipse(nLine, f.charAt(i)=='*', params, f.substring(i, f.length()), false); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; } else { i=i2; throw new UnknownCommandException(nLine); } break; case 'c' : // psecurve if(i+5>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='u' && f.charAt(++i)=='r' && f.charAt(++i)=='v' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("psecurve", nLine);//$NON-NLS-1$ i=i2; throw new UnknownCommandException(nLine); default : i=i2; throw new UnknownCommandException(nLine); } break; case 't' : // pst if(!started) throw new IgnoreCommandException(nLine); if(i+2>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='r' && f.charAt(++i)=='i') {//pstri if(i+6>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='a' && f.charAt(++i)=='n' && f.charAt(++i)=='g' && f.charAt(++i)=='l' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) {//pstriangle int end = texParserActions.actionsOnDiamondTriangle(nLine, f.charAt(i)=='*', params, f.substring(i, f.length()), false); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; } else { if(i+3>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(i)=='b' && f.charAt(++i)=='o' && f.charAt(++i)=='x' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) {//pstribox PSTricksParameters tp = params.lastElement(); if(tp.psBox.isEmpty()) tp.psBoxText.setText("");//$NON-NLS-1$ int end = texParserActions.actionsOnFramedBox(nLine, f.charAt(i)=='*', params, f.substring(i, f.length()), f.substring(i, f.length()), 2); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; isFramedBox = true; } else { i=i2; throw new UnknownCommandException(nLine); } } } else { i=i2; throw new UnknownCommandException(nLine); } break; case 'C' ://psCoil if(!started) throw new IgnoreCommandException(nLine); if(i+4>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='o' && f.charAt(++i)=='i' && f.charAt(++i)=='l' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("psCoil", nLine);//$NON-NLS-1$ i=i2; throw new UnknownCommandException(nLine); case 'b' : // psbezier if(!started) throw new IgnoreCommandException(nLine); if(i+6>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='e' && f.charAt(++i)=='z' && f.charAt(++i)=='i' && f.charAt(++i)=='e' && f.charAt(++i)=='r' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { int end = texParserActions.actionsOnBezierCurve(nLine, f.charAt(i)=='*', params, f.substring(i, f.length())); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; } else { i=i2; throw new UnknownCommandException(nLine); } break; case 'w' : // pswedge if(!started) throw new IgnoreCommandException(nLine); if(i+5>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='e' && f.charAt(++i)=='d' && f.charAt(++i)=='g' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { int end = texParserActions.actionsOnArcWedge(nLine, f.charAt(i)=='*', params, f.substring(i, f.length()),false); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; } else { i=i2; throw new UnknownCommandException(nLine); } break; case 'g' : // psgrid if(!started) throw new IgnoreCommandException(nLine); if(i+4>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='r' && f.charAt(++i)=='i' && f.charAt(++i)=='d' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { int end = texParserActions.actionsOnGridAxes(nLine, params, PSTricksParameters.pictureSWPt, PSTricksParameters.pictureNEPt, f.substring(i, f.length()), true); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; } else { i=i2; throw new UnknownCommandException(nLine); } break; case 'o' : // psovalbox if(!started) throw new IgnoreCommandException(nLine); if(i+7>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='v' && f.charAt(++i)=='a' && f.charAt(++i)=='l' && f.charAt(++i)=='b' && f.charAt(++i)=='o' && f.charAt(++i)=='x' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { PSTricksParameters tp = params.lastElement(); if(tp.psBox.isEmpty()) tp.psBoxText.setText("");//$NON-NLS-1$ int end = texParserActions.actionsOnFramedBox(nLine, f.charAt(i)=='*', params, f.substring(i, f.length()), f.substring(i, f.length()), 4); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; isFramedBox = true; } else { i=i2; throw new UnknownCommandException(nLine); } break; case 'z' : // pszigzag if(!started) throw new IgnoreCommandException(nLine); if(i+6>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='i' && f.charAt(++i)=='g' && f.charAt(++i)=='z' && f.charAt(++i)=='a' && f.charAt(++i)=='g' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("pszigzag", nLine);//$NON-NLS-1$ i=i2; throw new UnknownCommandException(nLine); default : i=i2; throw new UnknownCommandException(nLine); } // switch(f.charAt(i)) break; case 'u':// pu if(i+1>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='t' && //put (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { int j = i; while(j=lgth) throw new UnexceptedEndOfFileException(); String putS = f.substring(i, j); try{PSTricksParserActionsManager.parseputCommand(putS, params);} catch(Exception e){ e.printStackTrace(); throw new InvalidFormatCommandException("put", nLine); }//$NON-NLS-1$ i = j; } else { i=i2; throw new UnknownCommandException(nLine); } break; case 'o' : //polar if(i+4>=lgth)throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='l' && f.charAt(++i)=='a' && f.charAt(++i)=='r' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new WillNeverBeManagedException("polar", nLine);//$NON-NLS-1$ break; default : i=i2; throw new UnknownCommandException(nLine); } // switch(f.charAt(i)) break; case 'n' : i2 = i; if(i+1>=lgth) { if(!started) throw new IgnoreCommandException(nLine); throw new UnexceptedEndOfFileException(); } i++; switch(f.charAt(i)) { case 'e' ://ne if(i+1>=lgth) { i=i2; if(!started) throw new IgnoreCommandException(nLine); throw new UnexceptedEndOfFileException(); } i++; if(f.charAt(i)=='w')//new { if(i+1>=lgth) { i=i2; if(!started) throw new IgnoreCommandException(nLine); throw new UnexceptedEndOfFileException(); } i++; switch(f.charAt(i)) { case 'p' : //newp if(i+1>=lgth) { i=i2; if(!started) throw new IgnoreCommandException(nLine); throw new UnexceptedEndOfFileException(); } i++; switch(f.charAt(i)) { case 's'://newps if(i+1>=lgth) { i=i2; if(!started) throw new IgnoreCommandException(nLine); throw new UnexceptedEndOfFileException(); } i++; switch(f.charAt(i)) { case 's' ://newpsstyle if(i+5>=lgth) { if(!started) throw new IgnoreCommandException(nLine); throw new UnexceptedEndOfFileException(); } if(f.charAt(++i)=='t' && f.charAt(++i)=='y' && f.charAt(++i)=='l' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("newpsstyle", nLine);//$NON-NLS-1$ i=i2; if(started) throw new UnknownCommandException(nLine); throw new IgnoreCommandException(nLine); case 'o' : //newpsobject if(i+1>=lgth) { if(!started) throw new IgnoreCommandException(nLine); throw new UnexceptedEndOfFileException(); } i++; if(f.charAt(++i)=='b' && f.charAt(++i)=='j' && f.charAt(++i)=='e' && f.charAt(++i)=='c' && f.charAt(++i)=='t' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("newpsobject", nLine);//$NON-NLS-1$ i=i2; if(started) throw new UnknownCommandException(nLine); throw new IgnoreCommandException(nLine); default : i=i2; if(started) throw new UnknownCommandException(nLine); throw new IgnoreCommandException(nLine); } // switch(f.charAt(i)) case 'a'://newpa if(!started) throw new IgnoreCommandException(nLine); if(i+3>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='t' && f.charAt(++i)=='h'&& (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) {//newpath texParserActions.actionsOnNewPath(nLine); } else { i=i2; throw new UnknownCommandException(nLine); } break; default: i=i2; if(started) throw new UnknownCommandException(nLine); throw new IgnoreCommandException(nLine); } break; case 'c':// newcmykcolor if(i + 8 >= lgth) { if(!started) throw new IgnoreCommandException(nLine); throw new UnexceptedEndOfFileException(); } if(f.charAt(++i) == 'm' && f.charAt(++i) == 'y' && f.charAt(++i) == 'k' && f.charAt(++i) == 'c' && f.charAt(++i) == 'o' && f.charAt(++i) == 'l' && f.charAt(++i) == 'o' && f.charAt(++i) == 'r' && (f.charAt(++i) < 'a' || f.charAt(i) > 'z') && (f.charAt(i) < 'A' || f.charAt(i) > 'Z')) { int j = i, cptBracket = 0; while(cptBracket < 2 && j < f.length()) { if(f.charAt(j) == '}') cptBracket++; j++; } if(cptBracket < 2) throw new InvalidFormatCommandException("newcmykcolor", nLine);//$NON-NLS-1$ String p = f.substring(i, j); try { PSTricksParserActionsManager.parseNewcmykcolorParameters(p); } catch(Exception e) { e.printStackTrace(); throw new InvalidFormatCommandException("newcmykcolor", nLine);//$NON-NLS-1$ } i = j; } else { i = i2; if(started) throw new UnknownCommandException(nLine); throw new IgnoreCommandException(nLine); } break; case 'h':// newhsbcolor if(i + 8 >= lgth) { if(!started) throw new IgnoreCommandException(nLine); throw new UnexceptedEndOfFileException(); } if(f.charAt(++i) == 's' && f.charAt(++i) == 'b' && f.charAt(++i) == 'c' && f.charAt(++i) == 'o' && f.charAt(++i) == 'l' && f.charAt(++i) == 'o' && f.charAt(++i) == 'r' && (f.charAt(++i) < 'a' || f.charAt(i) > 'z') && (f.charAt(i) < 'A' || f.charAt(i) > 'Z')) { int j = i, cptBracket = 0; while(cptBracket < 2 && j < f.length()) { if(f.charAt(j) == '}') cptBracket++; j++; } if(cptBracket < 2) throw new InvalidFormatCommandException("newhsbcolor", nLine);//$NON-NLS-1$ String p = f.substring(i, j); try { PSTricksParserActionsManager.parseNewhsbcolorParameters(p); } catch(Exception e) { e.printStackTrace(); throw new InvalidFormatCommandException("newhsbcolor", nLine);//$NON-NLS-1$ } i = j; } else { i = i2; if(started) throw new UnknownCommandException(nLine); throw new IgnoreCommandException(nLine); } break; case 'r':// newrgbcolor if(i + 8 >= lgth) { if(!started) throw new IgnoreCommandException(nLine); throw new UnexceptedEndOfFileException(); } if(f.charAt(++i) == 'g' && f.charAt(++i) == 'b' && f.charAt(++i) == 'c' && f.charAt(++i) == 'o' && f.charAt(++i) == 'l' && f.charAt(++i) == 'o' && f.charAt(++i) == 'r' && (f.charAt(++i) < 'a' || f.charAt(i) > 'z') && (f.charAt(i) < 'A' || f.charAt(i) > 'Z')) { int j = i, cptBracket = 0; while(cptBracket < 2 && j < f.length()) { if(f.charAt(j) == '}') cptBracket++; j++; } if(cptBracket < 2) throw new InvalidFormatCommandException("newrgbcolor", nLine);//$NON-NLS-1$ String p = f.substring(i, j); try { PSTricksParserActionsManager.parseNewrgbcolorParameters(p); } catch(Exception e) { e.printStackTrace(); throw new InvalidFormatCommandException("newrgbcolor", nLine);//$NON-NLS-1$ } i = j; } else { i = i2; if(started) throw new UnknownCommandException(nLine); throw new IgnoreCommandException(nLine); } break; case 'g':// newgray if(i + 4 >= lgth) { if(!started) throw new IgnoreCommandException(nLine); throw new UnexceptedEndOfFileException(); } if(f.charAt(++i) == 'r' && f.charAt(++i) == 'a' && f.charAt(++i) == 'y' && (f.charAt(++i) < 'a' || f.charAt(i) > 'z') && (f.charAt(i) < 'A' || f.charAt(i) > 'Z')) { int j = i, cptBracket = 0; while(cptBracket < 2 && j < f.length()) { if(f.charAt(j) == '}') cptBracket++; j++; } if(cptBracket < 2) throw new InvalidFormatCommandException("newgray", nLine);//$NON-NLS-1$ String p = f.substring(i, j); try { PSTricksParserActionsManager.parseNewgrayParameters(p); } catch(Exception e) { e.printStackTrace(); throw new InvalidFormatCommandException("newgray", nLine);//$NON-NLS-1$ } i = j; } else { i = i2; if(started) throw new UnknownCommandException(nLine); throw new IgnoreCommandException(nLine); } break; default : i=i2; if(started) throw new UnknownCommandException(nLine); throw new IgnoreCommandException(nLine); } // switch(f.charAt(i)) }// if(f.charAt(i)=='w') else { i=i2; if(started) throw new UnknownCommandException(nLine); throw new IgnoreCommandException(nLine); } break; case 'o' :// no if(!started) throw new IgnoreCommandException(nLine); if(i+9>=lgth) throw new UnexceptedEndOfFileException(); PSTricksParameters tp = params.lastElement(); if(f.charAt(++i)=='r' && f.charAt(++i)=='m' && f.charAt(++i)=='a' && f.charAt(++i)=='l') {// normal if(i+1>=lgth) throw new UnexceptedEndOfFileException(); ++i; switch(f.charAt(i)) { case 'c': // normalcolor if(i+5>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='o' && f.charAt(++i)=='l' && f.charAt(++i)=='o' && f.charAt(++i)=='r' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textColor = Color.BLACK; else { i=i2; throw new UnknownCommandException(nLine); } break; case 's':// normalsize if(i+4>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='i' && f.charAt(++i)=='z' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textSize = PSTricksConstants.COMMAND_TEXT_NORMAL; else { i=i2; throw new UnknownCommandException(nLine); } break; default : i=i2; throw new UnknownCommandException(nLine); } } else { i=i2; throw new UnknownCommandException(nLine); } break; default : i=i2; if(started) throw new UnknownCommandException(nLine); throw new IgnoreCommandException(nLine); } break; case 'r' : i2 = i; i++; if(!started) { i=i2; throw new IgnoreCommandException(nLine); } if(i>=lgth) throw new UnexceptedEndOfFileException(); switch(f.charAt(i)) { case 'o' : //ro if(i+4>=lgth)throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='t' && f.charAt(++i)=='a' && f.charAt(++i)=='t' && f.charAt(++i)=='e')//rotate { i++; if(i>=lgth)throw new UnexceptedEndOfFileException(); switch(f.charAt(i)) { case 'b' : //rotatebox if(i+3>=lgth)throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='o' && f.charAt(++i)=='x' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { int nb=0, j = i; while(j < lgth && nb<2) { if(f.charAt(j)=='{') nb++; j++; } if(j >= lgth) { j = i2; throw new InvalidFormatCommandException("rotatebox", nLine);//$NON-NLS-1$ } PSTricksParserActionsManager.parseRotateBoxCommand(f.substring(i, j), params); i = j+1; } else { i=i2; throw new UnknownCommandException(nLine); } break; case 'l': // rotateleft if(i + 4 >= lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i) == 'e' && f.charAt(++i) == 'f' && f.charAt(++i) == 't' && (f.charAt(++i) < 'a' || f.charAt(i) > 'z') && (f.charAt(i) < 'A' || f.charAt(i) > 'Z')) { params.add(new PSTricksParameters(params.lastElement())); while(i < lgth && PSTricksParserActionsManager.isCharToIgnore(f.charAt(i))) i++; if(i >= lgth || f.charAt(i) != '{') { i = i2; throw new InvalidFormatCommandException("rotateleft", nLine);//$NON-NLS-1$ } i++; params.lastElement().setPosition(0, 0, true, 90, 0, 0, 0., 0.); } else { i = i2; throw new UnknownCommandException(nLine); } break; case 'r' : // rotateright if(i+5>=lgth)throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='i' && f.charAt(++i)=='g' && f.charAt(++i)=='h' && f.charAt(++i)=='t' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { params.add(new PSTricksParameters(params.lastElement())); while(i < lgth && PSTricksParserActionsManager.isCharToIgnore(f.charAt(i))) i++; if(i >= lgth || f.charAt(i) != '{') { i = i2; throw new InvalidFormatCommandException("rotateright", nLine);//$NON-NLS-1$ } i++; params.lastElement().setPosition(0, 0, true, -90, 0, 0, 0., 0.); } else { i = i2; throw new UnknownCommandException(nLine); } break; case 'd' : // rotatedown if(i+4>=lgth)throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='o' && f.charAt(++i)=='w' && f.charAt(++i)=='n' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { params.add(new PSTricksParameters(params.lastElement())); while(i < lgth && PSTricksParserActionsManager.isCharToIgnore(f.charAt(i))) i++; if(i >= lgth || f.charAt(i) != '{') { i = i2; throw new InvalidFormatCommandException("rotatedown", nLine);//$NON-NLS-1$ } i++; params.lastElement().setPosition(0, 0, true, 180, 0, 0, 0., 0.); } else { i = i2; throw new UnknownCommandException(nLine); } break; default : i=i2; throw new UnknownCommandException(nLine); } // switch(f.charAt(i)) } // if(f.charAt(++i)=='t' && f. else { i=i2; throw new UnknownCommandException(nLine); } break; case 'e' : // re i++; if(i>=lgth) { i=i2; throw new IgnoreCommandException(nLine); } switch(f.charAt(i)) { case 'd' : // red if(i+1>=lgth) throw new UnexceptedEndOfFileException(); PSTricksParameters tp = params.lastElement(); if((f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textColor = Color.RED; else { i=i2; throw new IgnoreCommandException(nLine); } break; case 's' : // resizebox if(i+7>=lgth)throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='i' && f.charAt(++i)=='z' && f.charAt(++i)=='e' && f.charAt(++i)=='b' && f.charAt(++i)=='o' && f.charAt(++i)=='x' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("resizebox", nLine);//$NON-NLS-1$ i=i2; throw new UnknownCommandException(nLine); default : i=i2; throw new IgnoreCommandException(nLine); } break; case 'a' : // radians if(i+6>=lgth) throw new UnexceptedEndOfFileException(); PSTricksParameters tp = params.lastElement(); if(f.charAt(++i)=='d' && f.charAt(++i)=='i' && f.charAt(++i)=='a' && f.charAt(++i)=='n' && f.charAt(++i)=='s' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { tp.onRadians = true; params.lastElement().degrees=Math.PI*2; } else { i=i2; throw new IgnoreCommandException(nLine); } break; case 'p' : // rput if(i+3>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='u' && f.charAt(++i)=='t' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { int j = i; boolean end = false, hasStar = f.charAt(i)=='*'; while(j=lgth) throw new UnexceptedEndOfFileException(); String rputS = f.substring(i, j); try{PSTricksParserActionsManager.parserputCommand(rputS, hasStar, params);} catch(Exception e){ e.printStackTrace(); throw new InvalidFormatCommandException("rput", nLine); }//$NON-NLS-1$ i = j; }else { i=i2; throw new IgnoreCommandException(nLine); } break; default : i=i2; throw new IgnoreCommandException(nLine); } break; case 's' : if(!started) throw new IgnoreCommandException(nLine); i2 = i; i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); switch(f.charAt(i)) { case 'c' : //sc if(i+1>=lgth) throw new UnexceptedEndOfFileException(); i++; switch(f.charAt(i)) { case 'a' : //sca if(i+5>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='l' && f.charAt(++i)=='e' && f.charAt(++i)=='b' && f.charAt(++i)=='o' && f.charAt(++i)=='x') { if(i+1>=lgth) throw new UnexceptedEndOfFileException(); if((f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("scalebox", nLine);//$NON-NLS-1$ if(i+3>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='t' && f.charAt(++i)=='o' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("scaleboxto", nLine);//$NON-NLS-1$ } i=i2; throw new UnknownCommandException(nLine); case 'r' : // scriptsize if(i+8>=lgth) throw new UnexceptedEndOfFileException(); PSTricksParameters tp = params.lastElement(); if(f.charAt(++i)=='i' && f.charAt(++i)=='p' && f.charAt(++i)=='t' && f.charAt(++i)=='s' && f.charAt(++i)=='i' && f.charAt(++i)=='z' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textSize = PSTricksConstants.COMMAND_TEXT_SCRIPT; else { i=i2; throw new UnknownCommandException(nLine); } break; default : i=i2; throw new UnknownCommandException(nLine); } break; case 'l' : // sl if(i+1>=lgth) throw new UnexceptedEndOfFileException(); PSTricksParameters tp = params.lastElement(); if((f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textItalic = true; else { i = i2; throw new UnknownCommandException(nLine); } break; case 'm' : // small if(i+4>=lgth) throw new UnexceptedEndOfFileException(); tp = params.lastElement(); if(f.charAt(++i)=='a' && f.charAt(++i)=='l' && f.charAt(++i)=='l' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textSize = PSTricksConstants.COMMAND_TEXT_SMALL; else { i = i2; throw new UnknownCommandException(nLine); } break; case 't' : // st if(i+2>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='r') // str { i++; if(f.charAt(i)=='o') // stro { if(i+3>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='k' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) // stroke throw new NotYetManagedException("stroke", nLine);//$NON-NLS-1$ i = i2; throw new UnknownCommandException(nLine); } else if(f.charAt(i)=='i') // stri { if(i+3>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='n' && f.charAt(++i)=='g' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) // string { // nothing to do }else { i = i2; throw new UnknownCommandException(nLine); } } else { i = i2; throw new UnknownCommandException(nLine); } } else { i = i2; throw new UnknownCommandException(nLine); } break; case 'w' : // swapaxes if(i+7>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='a' && f.charAt(++i)=='p' && f.charAt(++i)=='a' && f.charAt(++i)=='x' && f.charAt(++i)=='e' && f.charAt(++i)=='s' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("swapaxes", nLine);//$NON-NLS-1$ i = i2; throw new UnknownCommandException(nLine); default : i=i2; throw new UnknownCommandException(nLine); } break ; case 'b' : i2 = i; i++; if(i>=lgth) { if(!started) throw new IgnoreCommandException(nLine); throw new UnexceptedEndOfFileException(); } switch(f.charAt(i)) { case 'l' : //bl if(!started) { i=i2; throw new IgnoreCommandException(nLine);} i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); switch(f.charAt(i)) { case 'a' : // black if(i+3>=lgth) throw new UnexceptedEndOfFileException(); PSTricksParameters tp = params.lastElement(); if(f.charAt(++i)=='c' && f.charAt(++i)=='k' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textColor = Color.BLACK; else { i = i2; throw new UnknownCommandException(nLine); } break; case 'u' : // blue if(i+2>=lgth) throw new UnexceptedEndOfFileException(); tp = params.lastElement(); if(f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textColor = Color.BLUE; else { i = i2; throw new UnknownCommandException(nLine); } break; default : i=i2; if(started)throw new UnknownCommandException(nLine); } break; case 'e' : //be if(i+4>=lgth) { if(!started) throw new IgnoreCommandException(nLine); throw new UnexceptedEndOfFileException(); } if(f.charAt(++i)=='g' && f.charAt(++i)=='i' && f.charAt(++i)=='n' && (f.charAt(++i)<'a' || f.charAt(i)>'z')&& (f.charAt(i)<'A' || f.charAt(i)>'Z')) {//begin while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i))) { if(f.charAt(i)==eol) nLine++; i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); } if(f.charAt(i)=='{') {//begin{ i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i))) { if(f.charAt(i)==eol) nLine++; i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); } if(i+1>=lgth) throw new UnexceptedEndOfFileException(); switch(f.charAt(i)) { case 'p'://begin{p if(i+9>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='s' && f.charAt(++i)=='p' && f.charAt(++i)=='i' && f.charAt(++i)=='c' && f.charAt(++i)=='t' && f.charAt(++i)=='u' && f.charAt(++i)=='r' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) {//begin{pspicture while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i))) { if(f.charAt(i)==eol) nLine++; i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); } if(f.charAt(i)=='}') {//begin{pspicture} if(started) throw new FatalErrorParsingException( LaTeXDrawLang.getString1_6("PSTricksParser.1")+ //$NON-NLS-1$ LaTeXDrawLang.getString1_6("PSTricksParser.2")); //$NON-NLS-1$ started = true; startedWithBeginPs = true; Point2D.Double pt1, pt2; String sub = f.substring(i); try { pt1 = PSTricksParserActionsManager.readOneCoordinate(sub, 0, nLine, true); i += sub.indexOf(")", 0);//$NON-NLS-1$ }catch(Exception e) { throw new FatalErrorParsingException("Invalid command begin{pspicture}");//$NON-NLS-1$ } int j, k = ++i; try { // optional while(k=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='e' && f.charAt(++i)=='n' && f.charAt(++i)=='t' && f.charAt(++i)=='e' && f.charAt(++i)=='r' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) {//begin{center while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i))) { if(f.charAt(i)==eol) nLine++; i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); } if(f.charAt(i)=='}') //begin{center} { if(started && !parsingFinished) throw new FatalErrorParsingException(LaTeXDrawLang.getString1_9("PSTricksParser.0")); //$NON-NLS-1$ PSTricksParameters.isCentered = true; } else throw new InvalidFormatCommandException("\\begin{center}", nLine);//$NON-NLS-1$ }else { i = i2; if(started) throw new UnknownCommandException(nLine); throw new IgnoreCommandException(nLine); } break; case 'f'://begin{f if(i+6>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='i' && f.charAt(++i)=='g' && f.charAt(++i)=='u' && f.charAt(++i)=='r' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) {//begin{figure while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i))) { if(f.charAt(i)==eol) nLine++; i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); } if(f.charAt(i)=='}') //begin{figure} i += PSTricksParserActionsManager.parseBeginFigureCmd(f.substring(++i), nLine); else throw new InvalidFormatCommandException("\\begin{pspicture}", nLine);//$NON-NLS-1$ }else { i = i2; if(started) throw new UnknownCommandException(nLine); throw new IgnoreCommandException(nLine); } break; default : i = i2; if(!started) throw new IgnoreCommandException(nLine); throw new IgnoreCommandException(nLine); } } else { i = i2; if(!started) throw new IgnoreCommandException(nLine); throw new IgnoreCommandException(nLine); } }else { i = i2; if(!started) throw new IgnoreCommandException(nLine); throw new IgnoreCommandException(nLine); } break; case 'f' : // bf if(!started) { i=i2; throw new IgnoreCommandException(nLine);} if(i>=lgth) throw new UnexceptedEndOfFileException(); PSTricksParameters tp = params.lastElement(); if((f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textBold = true; else { i = i2; throw new IgnoreCommandException(nLine); } break; case 'o' : // box if(!started) { i=i2; throw new IgnoreCommandException(nLine); } if(i+2>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='x' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("box", nLine);//$NON-NLS-1$ i = i2; throw new IgnoreCommandException(nLine); default : i=i2; if(started) throw new UnknownCommandException(nLine); throw new IgnoreCommandException(nLine); } break; case 'l' : if(!started) throw new IgnoreCommandException(nLine); i2 = i; i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); switch(f.charAt(i)) { case 'a' : // large if(i+4>=lgth) throw new UnexceptedEndOfFileException(); PSTricksParameters tp = params.lastElement(); if(f.charAt(++i)=='r' && f.charAt(++i)=='g' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textSize = PSTricksConstants.COMMAND_TEXT_LARGE1; else { i = i2; throw new UnknownCommandException(nLine); } break; case 'd' : // ldots if(i+4>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='o' && f.charAt(++i)=='t' && f.charAt(++i)=='s' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("ldots", nLine);//$NON-NLS-1$ i = i2; throw new UnknownCommandException(nLine); case 'i'://li if(i+4>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='n' && f.charAt(++i)=='e' && f.charAt(++i)=='t' && f.charAt(++i)=='o' &&(f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { int end = texParserActions.actionsOnLineTo(nLine, params, f.substring(i, f.length())); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; } else { i = i2; throw new UnknownCommandException(nLine); } break; default : i=i2; throw new UnknownCommandException(nLine); } break; case '%' : if(started) { PSTricksParameters p = params.lastElement(); p.textParsed+='%'; } i++; break; case 'e' : i2 = i; if(i+3>=lgth) { if(started) throw new UnexceptedEndOfFileException(); throw new IgnoreCommandException(nLine); } if(f.charAt(++i)=='n' && f.charAt(++i)=='d') {//end ++i; if(f.charAt(i)=='p') {//endp if(f.charAt(++i)=='s' && f.charAt(++i)=='p' && f.charAt(++i)=='i' && f.charAt(++i)=='c' && f.charAt(++i)=='t' && f.charAt(++i)=='u' && f.charAt(++i)=='r' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) {//endpspicture if(!started || (started && startedWithBeginPs)) throw new FatalErrorParsingException("\\endpspicture must come after \\pspicture");//$NON-NLS-1$ parsingFinished = true; i++; } else { if(started) throw new UnknownCommandException(nLine); throw new IgnoreCommandException(nLine); } } else { if((f.charAt(i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i))) { if(f.charAt(i)==eol) nLine++; i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); } if(f.charAt(i)=='{') {//end{ i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i))) { if(f.charAt(i)==eol) nLine++; i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); } switch(f.charAt(i)) { case 'p'://end{p if(i+9>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='s' && f.charAt(++i)=='p' && f.charAt(++i)=='i' && f.charAt(++i)=='c' && f.charAt(++i)=='t' && f.charAt(++i)=='u' && f.charAt(++i)=='r' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) {//end{pspicture while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i))) { if(f.charAt(i)==eol) nLine++; i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); } if(f.charAt(i)=='}') {//end{pspicture} if(!started || (started && !startedWithBeginPs)) throw new FatalErrorParsingException("end{pspicture} must come after begin{pspicture}");//$NON-NLS-1$ parsingFinished = true; i++; } else throw new InvalidFormatCommandException("\\end{pspicture}", nLine);//$NON-NLS-1$ } //if(f.charAt(i)=='p' && f.charAt... else { i = i2; throw new UnexceptedEndOfFileException(); } break; case 'c'://end{c if(i+6>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='e' && f.charAt(++i)=='n' && f.charAt(++i)=='t' && f.charAt(++i)=='e' && f.charAt(++i)=='r' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) {//end{center while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i))) { if(f.charAt(i)==eol) nLine++; i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); } if(f.charAt(i)=='}') //end{center} { if(started && !parsingFinished) throw new FatalErrorParsingException(LaTeXDrawLang.getString1_9("PSTricksParser.1")); //$NON-NLS-1$ if(started) parsingFinished = true; else PSTricksParameters.isCentered = false; } else throw new InvalidFormatCommandException("\\end{center}", nLine);//$NON-NLS-1$ }else { i = i2; throw new UnexceptedEndOfFileException(); } break; case 'f'://end{f if(i+9>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='i' && f.charAt(++i)=='g' && f.charAt(++i)=='u' && f.charAt(++i)=='r' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) {//end{figure while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i))) { if(f.charAt(i)==eol) nLine++; i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); } if(f.charAt(i)=='}') //end{figure} { if(started && !parsingFinished) throw new FatalErrorParsingException(LaTeXDrawLang.getString1_9("PSTricksParser.2")); //$NON-NLS-1$ if(started) parsingFinished = true; else PSTricksParameters.tokenPosition = "";//$NON-NLS-1$ } else throw new InvalidFormatCommandException("\\end{figure}", nLine);//$NON-NLS-1$ }else { i = i2; throw new UnexceptedEndOfFileException(); } break; } } else { i = i2; throw new UnknownCommandException(nLine); } } else { i = i2; throw new UnknownCommandException(nLine); } }// if(f.charAt(++i)=='n' && f.charAt(++i)=... } else { i = i2; throw new UnknownCommandException(nLine); } break; case 'd' : if(!started) throw new IgnoreCommandException(nLine); i2 = i; i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(i)!='e') { i=i2; throw new UnknownCommandException(nLine); } i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); switch(f.charAt(i)) { case 'g' : // degrees if(i+5>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='r' && f.charAt(++i)=='e' && f.charAt(++i)=='e' && f.charAt(++i)=='s' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { int id = texParserActions.parseDegreesCommand(f.substring(i),params.lastElement(), nLine); i += id; } else { i = i2; throw new UnknownCommandException(nLine); } break; case 'f' : // definecolor if(i+9>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='i' && f.charAt(++i)=='n' && f.charAt(++i)=='e' && f.charAt(++i)=='c' && (f.charAt(++i)=='o' && f.charAt(++i)=='l' && f.charAt(++i)=='o' && f.charAt(++i)=='r' && f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { int id1 = f.indexOf("{", i);//$NON-NLS-1$ int id2 = f.indexOf("}", i);//$NON-NLS-1$ if(id1==-1 || id2==-1) { i=i2; throw new UnknownCommandException(nLine); } int[] tmp = {0}; String name = PSTricksParserActionsManager.readString(f.substring(id1, id2), tmp, true); if(name==null || name.length()==0) { i=i2; throw new UnknownCommandException(nLine); } id1 = f.indexOf("{", id2);//$NON-NLS-1$ id2 = f.indexOf("}", id2+1);//$NON-NLS-1$ if(id1==-1 || id2==-1) { i=i2; throw new UnknownCommandException(nLine); } tmp[0]=0; String type = PSTricksParserActionsManager.readString(f.substring(id1, id2), tmp, true); if(name.length()==0) { i=i2; throw new UnknownCommandException(nLine); } id1 = f.indexOf("{", id2);//$NON-NLS-1$ id2 = f.indexOf("}", id2+1);//$NON-NLS-1$ tmp[0] = 0; String subStr = f.substring(id1+1, id2); if(type.equals(PSTricksConstants.TOKEN_COLOR_TYPE_NAMED)) { // definecolor{alias}{named}{colorName} String val1 = PSTricksParserActionsManager.readString(subStr, tmp, true); Color c = DviPsColors.getColour(val1); if(c!=null) DviPsColors.addUserColour(c, name); } else { double val1 = PSTricksParserActionsManager.readReal(subStr, tmp, true); if(val1<0 || val1>1) throw new UnknownCommandException(nLine); if(type.equals(PSTricksConstants.TOKEN_COLOR_TYPE_GRAY)) // definecolor{name}{gray}{val} DviPsColors.addUserColour(new Color((float)val1, (float)val1, (float)val1), name); else { PSTricksParserActionsManager.readChar(subStr, ',', tmp); double val2 = PSTricksParserActionsManager.readReal(subStr, tmp, true); PSTricksParserActionsManager.readChar(subStr, ',', tmp); double val3 = PSTricksParserActionsManager.readReal(subStr, tmp, true); if(val2<0 || val2>1 || val3<0 || val3>1) throw new UnknownCommandException(nLine); if(type.equals(PSTricksConstants.TOKEN_COLOR_TYPE_RGB))// definecolor{name}{rgb}{r g b} DviPsColors.addUserColour(new Color((float)val1, (float)val2, (float)val3), name); else if(type.equals(PSTricksConstants.TOKEN_COLOR_TYPE_HSB)) DviPsColors.addUserColour(Color.getHSBColor((float)val1, (float)val2, (float)val3), name); else if(type.compareTo(PSTricksConstants.TOKEN_COLOR_TYPE_CMYK)==0) { PSTricksParserActionsManager.readChar(subStr, ',', tmp); double val4 = PSTricksParserActionsManager.readReal(subStr, tmp, true); if(val4<0 || val4>1) throw new InvalidFormatCommandException(nLine); DviPsColors.addUserColour(DviPsColors.CMYK2RGB(val1, val2, val3, val4), name); } else throw new UnknownCommandException(nLine); } } i = id2+2; } else { i = i2; throw new UnknownCommandException(nLine); } break; default : i-=2; throw new UnknownCommandException(nLine); } break; case 'g' : if(!started) throw new IgnoreCommandException(nLine); i2 = i; i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(i)!='r') { i = i2; throw new UnknownCommandException(nLine); } i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); switch(f.charAt(i)) { case 'a' : // gray if(i+2>=lgth) throw new UnexceptedEndOfFileException(); PSTricksParameters tp = params.lastElement(); if(f.charAt(++i)=='y' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textColor = Color.GRAY; else { i = i2; throw new UnknownCommandException(nLine); } break; case 'e' : // green if(i+3>=lgth) throw new UnexceptedEndOfFileException(); i2 = i; tp = params.lastElement(); if(f.charAt(++i)=='e' && f.charAt(++i)=='n' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textColor = Color.GREEN; else { i = i2; throw new UnknownCommandException(nLine); } break; default : i=i2; throw new UnknownCommandException(nLine); } break; case 'L' : if(!started) throw new IgnoreCommandException(nLine); i2 = i; i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); switch(f.charAt(i)) { case 'A' : // LARGE if(i+4>=lgth) throw new UnexceptedEndOfFileException(); i2 = i; PSTricksParameters tp = params.lastElement(); if(f.charAt(++i)=='R' && f.charAt(++i)=='G' && f.charAt(++i)=='E' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textSize = PSTricksConstants.COMMAND_TEXT_LARGE3; else { i = i2; throw new UnknownCommandException(nLine); } break; case 'a' : // Large if(i+4>=lgth) throw new UnexceptedEndOfFileException(); i2 = i; tp = params.lastElement(); if(f.charAt(++i)=='r' && f.charAt(++i)=='g' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textSize = PSTricksConstants.COMMAND_TEXT_LARGE2; else { i = i2; throw new UnknownCommandException(nLine); } break; default : i=i2; throw new UnknownCommandException(nLine); } break; case 'q' : if(!started) throw new IgnoreCommandException(nLine); i2 = i; i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); switch(f.charAt(i)) { case 'l' : // qline if(i+4>=lgth) throw new UnexceptedEndOfFileException(); i2 = i; if(f.charAt(++i)=='i' && f.charAt(++i)=='n' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("qline", nLine);//$NON-NLS-1$ i = i2; throw new UnknownCommandException(nLine); case 'd' : // qdisk if(i+4>=lgth) throw new UnexceptedEndOfFileException(); i2 = i; if(f.charAt(++i)=='i' && f.charAt(++i)=='s' && f.charAt(++i)=='k' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("qdisk", nLine);//$NON-NLS-1$ i = i2; throw new UnknownCommandException(nLine); default : i = i2; throw new UnknownCommandException(nLine); } case 'c' : if(!started) throw new IgnoreCommandException(nLine); i2 = i; i++; if(i>=lgth) throw new IgnoreCommandException(nLine); switch(f.charAt(i)) { case 'p' : // cput if(i+3>=lgth) throw new UnexceptedEndOfFileException(); i2 = i; if(f.charAt(++i)=='u' && f.charAt(++i)=='t' && (f.charAt(++i)=='*' || f.charAt(i)=='[' || f.charAt(i)=='{')) throw new NotYetManagedException("cput", nLine);//$NON-NLS-1$ i = i2; throw new UnknownCommandException(nLine); case 'y' : // cyan if(i+3>=lgth) throw new IgnoreCommandException(nLine); i2 = i; PSTricksParameters tp = params.lastElement(); if(f.charAt(++i)=='a' && f.charAt(++i)=='n' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textColor = Color.CYAN; else { i = i2; throw new UnknownCommandException(nLine); } break; case 'o': // color if(i+4>lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='l' && f.charAt(++i)=='o' && f.charAt(++i)=='r' && (f.charAt(++i)=='{' || PSTricksParserActionsManager.isCharToIgnore(f.charAt(i)))) { while(i=lgth) throw new UnexceptedEndOfFileException(); i++; int[] id = {0}; tp = params.lastElement(); String tmp = PSTricksParserActionsManager.readString(f.substring(i), id, true); Color c = DviPsColors.getColour(tmp); // We search the color if(c!=null) tp.textColor = c; while(i=lgth) throw new UnexceptedEndOfFileException(); i++; } else { i = i2; throw new UnknownCommandException(nLine); } break; case 'u'://cu if(i+6>=lgth) throw new UnexceptedEndOfFileException(); i2 = i; if(f.charAt(++i)=='r' && f.charAt(++i)=='v' && f.charAt(++i)=='e' && f.charAt(++i)=='t' && f.charAt(++i)=='o' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))//curveto { int end = texParserActions.actionsOnCurveTo(nLine, params, f.substring(i, f.length())); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; } else { i = i2; throw new UnknownCommandException(nLine); } break; case 'l'://cl if(i+8>=lgth) throw new UnexceptedEndOfFileException(); i2 = i; if(f.charAt(++i)=='o' && f.charAt(++i)=='s' && f.charAt(++i)=='e' && f.charAt(++i)=='p' && f.charAt(++i)=='a' && f.charAt(++i)=='t' && f.charAt(++i)=='h' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))//closepath texParserActions.actionsOnClosePathCommand(nLine); else { i = i2; throw new UnknownCommandException(nLine); } break; default : i = i2; throw new UnknownCommandException(nLine); } break; case 't' : if(!started) throw new IgnoreCommandException(nLine); i2 = i; i++; if(i>=lgth) throw new UnexceptedEndOfFileException(); switch(f.charAt(i)) { case 'r' ://translate if(i+8>=lgth) throw new UnexceptedEndOfFileException(); i2 = i; if(f.charAt(++i)=='a' && f.charAt(++i)=='n' && f.charAt(++i)=='s' && f.charAt(++i)=='l' && f.charAt(++i)=='a' && f.charAt(++i)=='t' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("translate", nLine);//$NON-NLS-1$ i = i2; throw new UnknownCommandException(nLine); case 'i' : //tiny if(i+3>=lgth) throw new UnexceptedEndOfFileException(); i2 = i; PSTricksParameters tp = params.lastElement(); if(f.charAt(++i)=='n' && f.charAt(++i)=='y' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textSize = PSTricksConstants.COMMAND_TEXT_TINY; else { i = i2; throw new UnknownCommandException(nLine); } break; default : i = i2; throw new UnknownCommandException(nLine); } break; case 'u' : if(!started) throw new IgnoreCommandException(nLine); i2 = i; if(++i>=lgth) throw new UnexceptedEndOfFileException(); switch(f.charAt(i)) { case 'p' : // uput if(i+3>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='u' && f.charAt(++i)=='t' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { int j = i; boolean brack = false, end=false;//, hasStar = f.charAt(i)=='*'; while(j=lgth) throw new UnexceptedEndOfFileException(); // String uputS = f.substring(i, j); // try{AbstractPSTricksParserActions.parseuputCommand(uputS, hasStar, params);} // catch(Exception e){ e.printStackTrace(); throw new InvalidFormatCommandException("uput", nLine); } i = j-2; throw new NotYetManagedException("uput", nLine);//$NON-NLS-1$ }//else //{ i=i2; throw new IgnoreCommandException(nLine); //} // break; case 's' : // usefont{enc}{family}{series}{shape} if(i+6>lgth) { i = i2; throw new UnknownCommandException(nLine); } if(f.charAt(++i)=='e' && f.charAt(++i)=='f' && f.charAt(++i)=='o' && f.charAt(++i)=='n' && f.charAt(++i)=='t' && (f.charAt(++i)=='{' || PSTricksParserActionsManager.isCharToIgnore(f.charAt(i)))) { PSTricksParameters tp = params.lastElement(); while(i=lgth) throw new UnexceptedEndOfFileException(); i++; int[] tmp = {0}; tp.textEnc = PSTricksParserActionsManager.readString(f.substring(i), tmp, true); while(i=lgth) throw new UnexceptedEndOfFileException(); i++; while(i=lgth) throw new UnexceptedEndOfFileException(); i++; tmp[0] = 0; tp.textFamily = PSTricksParserActionsManager.readString(f.substring(i), tmp, true); while(i=lgth) throw new UnexceptedEndOfFileException(); i++; while(i=lgth) throw new UnexceptedEndOfFileException(); i++; tmp[0] = 0; tp.textSeries = PSTricksParserActionsManager.readString(f.substring(i), tmp, true); while(i=lgth) throw new UnexceptedEndOfFileException(); i++; while(i=lgth) throw new UnexceptedEndOfFileException(); i++; tmp[0] = 0; tp.textShape = PSTricksParserActionsManager.readString(f.substring(i), tmp, true); while(i=lgth) throw new UnexceptedEndOfFileException(); i++; }else { i = i2; throw new UnknownCommandException(nLine); } break; default : i = i2; throw new UnknownCommandException(nLine); } // switch(f.charAt(i)) break; case 'H' : // Huge if(!started) throw new IgnoreCommandException(nLine); if(i+4>=lgth) throw new UnexceptedEndOfFileException(); i2 = i; PSTricksParameters tp = params.lastElement(); if(f.charAt(++i)=='u' && f.charAt(++i)=='g' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textSize = PSTricksConstants.COMMAND_TEXT_HUGE2; else { i = i2; throw new UnknownCommandException(nLine); } break; case 'N' : //NormalCoor if(!started) throw new IgnoreCommandException(nLine); if(i+11>=lgth) throw new UnexceptedEndOfFileException(); i2 = i; tp = params.lastElement(); if(f.charAt(++i)=='o' && f.charAt(++i)=='r' && f.charAt(++i)=='m' && f.charAt(++i)=='a' && f.charAt(++i)=='l' && f.charAt(++i)=='C' && f.charAt(++i)=='o' && f.charAt(++i)=='o' && f.charAt(++i)=='r' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.specialCoor = false; else { i = i2; throw new UnknownCommandException(nLine); } break; case 'S' : //SpecialCoor if(!started) throw new IgnoreCommandException(nLine); if(i+11>=lgth) throw new UnexceptedEndOfFileException(); i2 = i; tp = params.lastElement(); if(f.charAt(++i)=='p' && f.charAt(++i)=='e' && f.charAt(++i)=='c' && f.charAt(++i)=='i' && f.charAt(++i)=='a' && f.charAt(++i)=='l' && f.charAt(++i)=='C' && f.charAt(++i)=='o' && f.charAt(++i)=='o' && f.charAt(++i)=='r' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.specialCoor = true; else { i = i2; throw new UnknownCommandException(nLine); } break; case 'f': //f if(!started) throw new IgnoreCommandException(nLine); if(i+1>=lgth) throw new UnexceptedEndOfFileException(); i2 = i; switch(f.charAt(++i)) { case 'o'://fo if(i+11>=lgth) throw new UnexceptedEndOfFileException(); tp = params.lastElement(); if(f.charAt(++i)=='o' && f.charAt(++i)=='t' &&// footnodesize f.charAt(++i)=='n' && f.charAt(++i)=='o' && f.charAt(++i)=='t' && f.charAt(++i)=='e' && f.charAt(++i)=='s' && f.charAt(++i)=='i' && f.charAt(++i)=='z' && f.charAt(++i)=='e' &&(f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textSize = PSTricksConstants.COMMAND_TEXT_FOOTNOTE; else { i = i2; throw new UnknownCommandException(nLine); } break; case 'i'://fi if(i+3>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='l' && f.charAt(++i)=='l' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("fill", nLine);//$NON-NLS-1$ i = i2; throw new UnknownCommandException(nLine); default: i = i2; throw new UnknownCommandException(nLine); } break; case 'h' : // huge if(!started) throw new IgnoreCommandException(nLine); if(i+4>=lgth) throw new UnexceptedEndOfFileException(); i2 = i; tp = params.lastElement(); if(f.charAt(++i)=='u' && f.charAt(++i)=='g' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textSize = PSTricksConstants.COMMAND_TEXT_HUGE1; else { i = i2; throw new UnknownCommandException(nLine); } break; case 'm' : // m if(!started) throw new IgnoreCommandException(nLine); if(i+1>=lgth) throw new UnexceptedEndOfFileException(); i2 = i; switch(f.charAt(++i)) { case 'a'://ma if(i+5>=lgth) throw new UnexceptedEndOfFileException(); tp = params.lastElement(); if(f.charAt(++i)=='g' && f.charAt(++i)=='e' &&//magenta f.charAt(++i)=='n' && f.charAt(++i)=='t' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textColor = Color.MAGENTA; else { i = i2; throw new UnknownCommandException(nLine); } break; case 'o'://mo if(i+5>=lgth) throw new UnexceptedEndOfFileException(); tp = params.lastElement(); if(f.charAt(++i)=='v' && f.charAt(++i)=='e' && f.charAt(++i)=='t' && f.charAt(++i)=='o' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { int end = texParserActions.actionsOnMoveTo(nLine, params, f.substring(i, f.length())); if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end; } else { i = i2; throw new UnknownCommandException(nLine); } break; default: i = i2; throw new UnknownCommandException(nLine); } break; case 'y' : // yellow if(!started) throw new IgnoreCommandException(nLine); if(i+6>=lgth) throw new UnexceptedEndOfFileException(); i2 = i; tp = params.lastElement(); if(f.charAt(++i)=='e' && f.charAt(++i)=='l' && f.charAt(++i)=='l' && f.charAt(++i)=='o' && f.charAt(++i)=='w' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textColor = Color.YELLOW; else { i = i2; throw new UnknownCommandException(nLine); } break; case 'i' : i2 = i; if(!started) throw new IgnoreCommandException(nLine); if(++i>=lgth) throw new UnexceptedEndOfFileException(); switch(f.charAt(i)) { case 't' : // it if(i+1>=lgth) throw new UnexceptedEndOfFileException(); if((f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { tp = params.lastElement(); tp.textItalic = true; } else { i = i2; throw new UnknownCommandException(nLine); } break; case 'n' : // in if(i+14>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='c' && f.charAt(++i)=='l' && f.charAt(++i)=='u' && f.charAt(++i)=='d' && f.charAt(++i)=='e' && f.charAt(++i)=='g' && f.charAt(++i)=='r' && f.charAt(++i)=='a' && f.charAt(++i)=='p' && f.charAt(++i)=='h' && f.charAt(++i)=='i' && f.charAt(++i)=='c' && f.charAt(++i)=='s' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) // includegraphics { int z = texParserActions.actionsOnPicture(nLine, params, f.substring(i)); if(z>0) i+=z; throw new NotYetManagedException("includegraphics", nLine); //$NON-NLS-1$ } i = i2; throw new UnknownCommandException(nLine); default : i = i2; throw new UnknownCommandException(nLine); } break; case 'w' :// white if(!started) throw new IgnoreCommandException(nLine); if(i+5>=lgth) throw new UnexceptedEndOfFileException(); i2 = i; tp = params.lastElement(); if(f.charAt(++i)=='h' && f.charAt(++i)=='i' && f.charAt(++i)=='t' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) tp.textColor = Color.WHITE; else { i = i2; throw new UnknownCommandException(nLine); } break; case 'z' : //z if(!started) throw new IgnoreCommandException(nLine); i2 = i;//zigzag if(i+6>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='i' && f.charAt(++i)=='g' && f.charAt(++i)=='z' && f.charAt(++i)=='a' && f.charAt(++i)=='g' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) throw new NotYetManagedException("zigzag", nLine);//$NON-NLS-1$ i = i2; throw new UnknownCommandException(nLine); case 'o'://o if(!started) throw new IgnoreCommandException(nLine); i2 = i; if(i+6>=lgth) throw new UnexceptedEndOfFileException(); if(f.charAt(++i)=='p' && f.charAt(++i)=='e' && f.charAt(++i)=='n' && f.charAt(++i)=='s' && f.charAt(++i)=='h' && f.charAt(++i)=='a' && f.charAt(++i)=='d' && f.charAt(++i)=='o' && f.charAt(++i)=='w' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z')) { int end = texParserActions.parseOpenShadowCommand(params.lastElement(), nLine, f.substring(i)); if(end!=-1) i+=end; } else { i = i2; throw new UnknownCommandException(nLine); } break; default : if(f.charAt(i)==eol) { nLine++; i++; } else { if(started)// throw new UnknownCommandException(nLine); { if(!PSTricksParserActionsManager.isCharToIgnore(f.charAt(i))) { PSTricksParameters p = params.lastElement(); String str = "\\" + String.valueOf(f.charAt(i)); //$NON-NLS-1$ p.textForFrame += str; p.textParsed += str; if(p.fromFramedBox) { boolean again = true; int k = params.size()-2; while(again && k>=0) { p = params.elementAt(k); p.textForFrame += str; if(p.getPosition()!=null) again = false; else k--; } } } i++; } else throw new IgnoreCommandException(nLine); } } //switch(f.charAt(i)) // Any space after a command must not be taken like a text. while(i=0) if(params.elementAt(k).getPosition()==null) k--; else pp = params.elementAt(k); if(pp==null) pp = params.firstElement(); pp.psBox.lastElement().setEnd(pp.textForFrame.length()); pp.psBox.add(0, pp.psBox.remove(pp.psBox.size()-1)); } else if(tp.getPosition()!=null && !tp.psBox.isEmpty()) { Vector fbs = new Vector(); while(!tp.psBox.isEmpty()) fbs.add(tp.psBox.remove(tp.psBox.size()-1)); tp.psBox = fbs; tp.psBoxText.setText(tp.textForFrame); texParserActions.actionsOnTerminatedFramedBoxes(params); } else if(tp.psCustomP.fromPsCustom) { try { texParserActions.actionsOnterminatedPsCustom(params.lastElement()); i++; if(params.isEmpty())//A enlever quand la commande sera totalement gérée. throw new TooManyBracketsException(nLine); }catch(NotFullyManagedException e) {//A enlever quand la commande sera totalement gérée. i++; if(params.isEmpty()) throw new TooManyBracketsException(nLine); params.removeElementAt(params.size()-1); throw new NotFullyManagedException("pscustom", nLine);//$NON-NLS-1$ } } else try {texParserActions.actionsOnText(params);} catch(InvalidFormatCommandException e) { /* Nothing to do.*/ } params.removeElementAt(params.size()-1); } i++; break; case ' ' : case 9 ://'\t' if(started) { PSTricksParameters p = params.lastElement(); p.textForFrame+=" ";//$NON-NLS-1$ p.textParsed+=" ";//$NON-NLS-1$ if(p.fromFramedBox) { boolean again=true; int k = params.size()-2; while(again && k>=0) { p = params.elementAt(k); p.textForFrame+=" ";//$NON-NLS-1$ if(p.getPosition()==null) k--; else again = false; } } } i++; break; default : if(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i))) { if(started) { if(!lastTokenIsEOL && f.charAt(i)!=10) { if(params.isEmpty()) throw new TooManyBracketsException(nLine); PSTricksParameters p = params.lastElement(); p.textForFrame+=" ";//$NON-NLS-1$ p.textParsed+=" ";//$NON-NLS-1$ if(p.fromFramedBox) { boolean again = true; int k = params.size()-2; while(again && k>=0) { p = params.elementAt(k); p.textForFrame+=" ";//$NON-NLS-1$ if(p.getPosition()!=null) again = false; else k--; } } lastTokenIsEOL = true; } } i++; if(f.charAt(i)!=10) nLine++; } else { if(started) { PSTricksParameters p = params.lastElement(); String str = String.valueOf(f.charAt(i)); p.textForFrame+=str; p.textParsed+=str; if(p.fromFramedBox) { boolean again = true; int k = params.size()-2; while(again && k>=0) { p = params.elementAt(k); p.textForFrame+=str; if(p.getPosition()!=null) again = false; else k--; } } }//if i++; }//else break; } // switch(f.charAt(i)) }catch(InvalidFormatCommandException e) { parserMsgs.add(new ParserCmdMessage(e.getNLine(), e, e.getCommand())); }catch(NotYetManagedException e) { parserMsgs.add(new ParserCmdMessage(e.getNLine(), e, e.getCommand())); }catch(UnknownCommandException e) { String cmd = String.valueOf(f.charAt(i)); i++; while(i='a' && f.charAt(i)<='z') || (f.charAt(i)>='A' && f.charAt(i)<='Z')) cmd+=f.charAt(i++); if(latexCommandsWithBrackets.containsValue(cmd)) { PSTricksParameters p = params.lastElement(); p.textParsed+="\\"+cmd; //$NON-NLS-1$ while(i0) { if(!despecialize) { if(f.charAt(i)=='}') cptBraces--; else if(f.charAt(i)=='{') cptBraces++; } despecialize = f.charAt(i)!='\\' || despecialize ? false : true; p.textParsed += f.charAt(i++); } } } else { if(latexCommandsWithoutBrack.containsValue(cmd)) params.lastElement().textParsed+="\\"+cmd; //$NON-NLS-1$ else { e.printStackTrace(); parserMsgs.add(new ParserCmdMessage(e.getNLine(), e, cmd)); } } } }catch(IgnoreCommandException e) { while(i='a' && f.charAt(i)<='z') || (f.charAt(i)>='A' && f.charAt(i)<='Z')) i++; } }//while(i1) throw new UnclosedBracketsException(); if(started && !parsingFinished) throw new FatalErrorParsingException(LaTeXDrawLang.getString1_9("PSTricksParser.3")); //$NON-NLS-1$ if(progressB!=null) progressB.setValue(progressB.getMaximum()); if(!parserMsgs.isEmpty()) ParserMessagesFrame.showParserMessagesFrame(parent, true, parserMsgs); return OK_PARSING; }catch(FatalErrorParsingException e) { String title = LaTeXDrawLang.getString1_6("PSTricksParser.3"); //$NON-NLS-1$ if(parent!=null) JOptionPane.showMessageDialog(parent, e.toString(), title, JOptionPane.ERROR_MESSAGE); else System.out.println(title+" "+e.toString()); //$NON-NLS-1$ return ERROR_PARSING; }catch(Exception e) { e.printStackTrace(); ExceptionFrameDialog.showExceptionDialog(e); return ERROR_PARSING; } } //public int parse(String f, JFrame parent) /** * Allows to know if the code contains the tag : \begin{pspicture} or \pspicture * @param code The code to analyse * @return 1, if the code contains the tag \begin{pspicture}
    * 2, if the code contains the tag \pspicture
    * 0 else. */ public static int containsBeginPSPicture(String code) { char eol = System.getProperty("line.separator").charAt(0);//$NON-NLS-1$ char[] f2 = new char[code.length()]; int i=0, lgth = code.length(), cpt=0; boolean zero = false; while(i0 && code.charAt(i-1)!='\\') { while(i0)cpt--; } else { f2[cpt++] = code.charAt(i); zero = false; } } i++; } // while(i * Copyright(c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 12/18/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public abstract class LaTeXDrawNumber { /** * This method allows to set a threshold that if a number is under it, it will be considered as valuing 0; * for instance, given the numbers 2E-10 and 0.002 and the * threshold 0.00001; then this method will cut the first number and will return 0. The absolute value of * the second number is not lesser than the threshold so it will be returned intact. * @param value The number to check. * @param threshold The minimum threshold of the value. * @return The cut or the intact number. * @since 1.9 */ public static float getCutNumber(float value, double threshold) { return Math.abs(value) < threshold ? 0f : value; } /** * This method allows to set a threshold that if a number is under it, it will be considered as valuing 0; * for instance, given the numbers 2E-10 and 0.002 and the * threshold 0.00001; then this method will cut the first number and will return 0. The absolute value of * the second number is not lesser than the threshold so it will be returned intact. * @param value The number to check. * @param threshold The minimum threshold of the value. * @return The cut or the intact number. * @since 1.9 */ public static double getCutNumber(double value, double threshold) { return Math.abs(value) < threshold ? 0. : value; } } latexdraw-2.0.8+1.orig/latexDraw/util/UndoRedoManager.java0000644000000000000000000005752311347255510020301 0ustar package latexDraw.util; import java.awt.Color; import java.util.Vector; import latexDraw.figures.Dot; import latexDraw.figures.Draw; import latexDraw.figures.Figure; import latexDraw.figures.Line; import latexDraw.lang.LaTeXDrawLang; import latexDraw.ui.DrawContainer; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.ui.dialog.ExceptionFrameDialog; /** * A simple way to implement undo/redo management (contrary to java :s)
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class UndoRedoManager { /** This label corresponds to a change of parameters of a figure */ public static final String LABEL_CHANGE_PARAM = LaTeXDrawLang.getOthersString("UndoRedoManager.changeParams"); //$NON-NLS-1$ /** This label corresponds to a change in the disposition of * some figures (i.e. put in background, foreground, ...)*/ public static final String LABEL_CHANGE_DISPOSITION = LaTeXDrawLang.getOthersString("UndoRedoManager.changeDispo"); //$NON-NLS-1$ public static final String LABEL_TRANSFORM = LaTeXDrawLang.getString1_8("UndoRedoManager.0"); //$NON-NLS-1$ public static final String LABEL_ALIGN = LaTeXDrawLang.getOthersString("UndoRedoManager.align"); //$NON-NLS-1$ public static final String LABEL_DISTRIB = LaTeXDrawLang.getOthersString("UndoRedoManager.distrib"); //$NON-NLS-1$ /** This label corresponds to a change of position of a figure */ public static final String LABEL_CHANGE_MOVE = LaTeXDrawLang.getOthersString("UndoRedoManager.move"); //$NON-NLS-1$ /** This label corresponds to the deletion of a figure */ public static final String LABEL_DEL = LaTeXDrawLang.getOthersString("UndoRedoManager.delete"); //$NON-NLS-1$ /** This label corresponds to the creation of a figure */ public static final String LABEL_CREATE = LaTeXDrawLang.getOthersString("UndoRedoManager.create"); //$NON-NLS-1$ /** This label corresponds to a join of several figures */ public static final String LABEL_JOIN = LaTeXDrawLang.getOthersString("UndoRedoManager.join"); //$NON-NLS-1$ /** This label corresponds to a separation of several joined figures */ public static final String LABEL_SEPARATE = LaTeXDrawLang.getOthersString("UndoRedoManager.seperate"); //$NON-NLS-1$ /** This label corresponds to a change of the attribute fill * of the class figure */ public static final String LABEL_CHANGE_FILL = LaTeXDrawLang.getOthersString("UndoRedoManager.filled"); //$NON-NLS-1$ /** This label corresponds to a change of colour of the interior * of the figure */ public static final String LABEL_CHANGE_INT_COL = LaTeXDrawLang.getOthersString("UndoRedoManager.intCol"); //$NON-NLS-1$ /** This label corresponds to a change of colour of the borders * of the figure */ public static final String LABEL_CHANGE_BORD_COL = LaTeXDrawLang.getOthersString("UndoRedoManager.bordCol"); //$NON-NLS-1$ /** This label corresponds to a change of thickness of the figure */ public static final String LABEL_CHANGE_THICKNESS = LaTeXDrawLang.getOthersString("UndoRedoManager.thick"); //$NON-NLS-1$ /** This label corresponds to a change of style the figure */ public static final String LABEL_CHANGE_STYLE = LaTeXDrawLang.getOthersString("UndoRedoManager.style"); //$NON-NLS-1$ /** This label corresponds to a change of arrow style of the line */ public static final String LABEL_CHANGE_LARROW_STYLE = LaTeXDrawLang.getOthersString("UndoRedoManager.lArrow"); //$NON-NLS-1$ /** This label corresponds to a change of arrow style of the line */ public static final String LABEL_CHANGE_RARROW_STYLE = LaTeXDrawLang.getOthersString("UndoRedoManager.rArrow"); //$NON-NLS-1$ /** This label corresponds to a change of the style of the dot */ public static final String LABEL_CHANGE_DOT_STYLE = LaTeXDrawLang.getOthersString("UndoRedoManager.dotStyle"); //$NON-NLS-1$ /** The label display when there is no redo possible */ public static final String EMPTY_REDO = LaTeXDrawLang.getOthersString("UndoRedoManager.noRedo"); //$NON-NLS-1$ /** The label display when there is no undo action */ public static final String EMPTY_UNDO = LaTeXDrawLang.getOthersString("UndoRedoManager.noUndo"); //$NON-NLS-1$ /** This vector contains all labels of redo actions */ protected Vector textRedo; /** This vector contains positions of figures, in the vector figures, * concerned by the redo */ protected Vector idRedo; /** This vector contains all figures, values, ... concerned by the * redo */ protected Vector objectRedo; /** This vector contains all labels of undo actions */ protected Vector textUndo; /** This vector contains positions of figures, in the vector figures, * concerned by the undo */ protected Vector idUndo; /** This vector contains all figures, values, ... concerned by the * undo */ protected Vector objectUndo; /** This vector contains all the figures of the drawing : in this case, this * vector is pointer of the vector "figures" of the class DrawContainer */ protected Vector
    figures; /** The current drawing which contains the figures */ protected DrawContainer draw; /** The main frame (which contains buttons, ...) */ protected LaTeXDrawFrame mainFrame; /** * The constructor by default * @param f The vector containing all the figures of the drawing */ public UndoRedoManager(Vector
    f, DrawContainer d, LaTeXDrawFrame frame) { textRedo = new Vector(); idRedo = new Vector(); objectRedo = new Vector(); textUndo = new Vector(); idUndo = new Vector(); objectUndo = new Vector(); mainFrame = frame; figures = f; draw = d; } public void setFigures(Vector
    f) { if(f!=null) figures = f; } /** * Allows to get the name of the next undo actions * @return The name of the next undo actions */ public String getTextNextUndo() { if(textUndo.isEmpty()) return null; return textUndo.lastElement(); } /** * Allows to get the name of the next redo actions * @return The name of the next redo actions */ public String getTextNextRedo() { if(textRedo.isEmpty()) return null; return textRedo.lastElement(); } /** * Allows to add a event to manage by undo/redo * @param label The kind of event (add, deletion, rotation, ...) * @param id The position of the concerned figure in the vector "figures" * @param o For some actions (like deletion) we need to have to concerned * figure in order to keep it until a redo */ public void add(String label, int id, Object o) { int[] id2 = new int[1]; id2[0] = id; add(label, id2, o, false); } /** * Allows to add a event to manage by undo/redo * @param label The kind of event (add, deletion, rotation, ...) * @param id The indices of the concerned figures in the vector "figures" * @param o For some actions (like deletion) we need to have to concerned * figure in order to keep it until a redo. * @param fromRedo True if the call of the function comes from the method redo (useful to clear the redo). */ public void add(String label, int[] id, Object o, boolean fromRedo) { try { if(!fromRedo) clearRedo(); for(int i=0, size=id.length; i=0; i--) if(figures.size()==0 || id[i]==figures.size()) figures.add(d.getFigureAt(i)); else figures.add(id[i], d.getFigureAt(i)); d.setDrawFigures(false); draw.setSelected(d); objectRedo.add(d.clone()); }else if(label.equals(LABEL_SEPARATE)) { Object o = objectUndo.remove(objectUndo.size()-1); if(!(o instanceof Draw)) throw new ClassCastException(); Draw d = (Draw)o; int size = d.size(); for(i=0; i=0; i--) { f = figures.remove(id[i]); figures.add(oldId[i], f); } add(LABEL_CHANGE_DISPOSITION, oldId, id, true); }else if(label.equals(LABEL_CREATE)) { Figure f = (Figure) objectRedo.remove(objectRedo.size()-1); if(f.isSelected()) if(!draw.getSelected().contains(f)) draw.setSelected(f); else f.onRelease(); figures.add(id[0], f); add(LABEL_CREATE, id, null, true); }else if(label.equals(LABEL_DEL)) { Draw d = new Draw(false, false); Draw listSelected = draw.getSelected(); for(i=id.length-1; i>=0; i--) { Figure f = figures.remove(id[i]); if(listSelected.contains(f)) listSelected.removeFigure(f); d.addFigure(f); } for(i=id.length-2; i>=0; i--) d.addFigure(d.removeFigureAt(i)); add(LABEL_DEL, id, d, true); } else if(label.equals(LABEL_CHANGE_FILL)) { figures.elementAt(id[0]).setIsFilled(! figures.elementAt(id[0]).isFilled()); add(LABEL_CHANGE_FILL, id, null, true); } else if(label.equals(LABEL_CHANGE_RARROW_STYLE)) { Line l = (Line)figures.elementAt(id[0]); String style = l.getArrow2Style(); l.setArrow2Style( (String)objectRedo.remove(objectRedo.size()-1)); add(LABEL_CHANGE_RARROW_STYLE, id, style, true); } else if(label.equals(LABEL_CHANGE_LARROW_STYLE)) { Line l = (Line)figures.elementAt(id[0]); String style = l.getArrow1Style(); l.setArrow1Style( (String)objectRedo.remove(objectRedo.size()-1)); add(LABEL_CHANGE_LARROW_STYLE, id, style, true); } else if(label.equals(LABEL_CHANGE_BORD_COL)) { Figure f = figures.elementAt(id[0]); Color c = f.getLinesColor(); f.setLinesColor((Color)objectRedo.remove(objectRedo.size()-1)); add(LABEL_CHANGE_BORD_COL, id, c, true); } else if(label.equals(LABEL_CHANGE_INT_COL)) { Figure f = figures.elementAt(id[0]); Color c = f.getInteriorColor(); f.setInteriorColor( (Color) objectRedo.remove(objectRedo.size()-1)); add(LABEL_CHANGE_INT_COL, id, c, true); } else if(label.equals(LABEL_CHANGE_STYLE)) { Figure f = figures.elementAt(id[0]); String style = f.getLineStyle(); f.setLineStyle((String)objectRedo.remove(objectRedo.size()-1)); add(LABEL_CHANGE_STYLE,id,style, true); } else if(label.equals(LABEL_CHANGE_MOVE) || label.equals(LABEL_TRANSFORM) || label.equals(LABEL_ALIGN) || label.equals(LABEL_DISTRIB)) { Object o = objectRedo.remove(objectRedo.size()-1); if(!(o instanceof Draw)) throw new ClassCastException(); Draw fOld = (Draw)o; if(id.length != fOld.size()) throw new LaTeXDrawException(LaTeXDrawException.INCORRECT_VALUE); Draw d = new Draw(false, false); for(i=0; i=0; i--) figures.add(id[0], d.getFigureAt(i)); d.setDrawFigures(false); draw.setSelected(d); add(LABEL_SEPARATE, id, d.clone(), true); }else if(label.equals(LABEL_JOIN)) { Object o = objectRedo.remove(objectRedo.size()-1); int min = id[0]; i = 1; while(i *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * * 09/11/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    * @since 1.8
    */ public class VersionChecker extends Thread { /** The path of the file containing the news */ public static final String PATH_MSG = "http://latexdraw.sourceforge.net/news.txt"; //$NON-NLS-1$ protected LaTeXDrawFrame parent; /** * The constructor. * @param frame The main frame of LaTeXDraw. */ public VersionChecker(LaTeXDrawFrame frame) { parent = frame; } @Override public void run() { try { checkNewVersion(); }catch(Exception e) { parent.setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.213")); //$NON-NLS-1$ } } /** * Allows to check if a new version of latexdraw is out. */ protected void checkNewVersion() { try { URL url = new URL(PATH_MSG); InputStream is = url.openStream(); DataInputStream dis = new DataInputStream(is); InputStreamReader isr = new InputStreamReader(dis); BufferedReader br = new BufferedReader(isr); String[] div = null; String line = br.readLine(); if(line!=null) div = line.split("_");//$NON-NLS-1$ if(div!=null && div.length>3) if(div[3].compareTo(LaTeXDrawFrame.VERSION)>0) { JOptionPane.showMessageDialog(parent, ""//$NON-NLS-1$ +div[1]+ '/'+div[2]+'/'+div[0]+LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.208") //$NON-NLS-1$ +div[3]+LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.209"), //$NON-NLS-1$ LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.210"), //$NON-NLS-1$ JOptionPane.WARNING_MESSAGE); parent.setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.211")); //$NON-NLS-1$ } else parent.setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.212")); //$NON-NLS-1$ br.close(); isr.close(); dis.close(); is.close(); }catch(Exception e) { parent.setStatusBarText(LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.213")); //$NON-NLS-1$ } } } latexdraw-2.0.8+1.orig/latexDraw/util/StreamExecReader.java0000644000000000000000000000371011347255510020437 0ustar package latexDraw.util; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; /** * Defines a thread for managing command execution. While the process is running, * the log is gathered from it. * * This file is part of LaTeXDraw
    * Copyright (c) 2005-2009 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/14/09
    * @author Arnaud BLOUIN
    * @version 2.0.4
    */ public class StreamExecReader extends Thread { /** The stream to listen. */ private InputStream stream; /** The read log. */ private String log; /** * Default constructor. * @param is The stream to listen. */ public StreamExecReader(InputStream is) { stream = is; } @Override public void run() { InputStreamReader isr = null; BufferedReader br = null; try { if(stream!=null) { isr = new InputStreamReader(stream); br = new BufferedReader(isr); String line = null; log = ""; while((line = br.readLine()) != null) log += line; } }catch(IOException ioe) { ioe.printStackTrace(); } try { if(br!=null) br.close(); }catch(IOException ioe) { ioe.printStackTrace(); } try { if(isr!=null) isr.close(); }catch(IOException ioe) { ioe.printStackTrace(); } } /** * @return The read log. */ public synchronized String getLog() { return log; } } latexdraw-2.0.8+1.orig/latexDraw/util/LaTeXDrawPath.java0000644000000000000000000001310411347255510017662 0ustar package latexDraw.util; import java.io.File; import java.net.URL; import java.net.URLDecoder; /** * This class defines paths used in LaTeXDraw.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 05/11/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public abstract class LaTeXDrawPath { /** The name of the cache directory */ public static final String CACHE_DIR = ".cache";//$NON-NLS-1$ /** The name of the cache directory for shared templates */ public static final String CACHE_SHARED_DIR = ".cacheShared";//$NON-NLS-1$ /** The name of the templates directory */ public static final String TEMPLATE_DIR = "templates";//$NON-NLS-1$ public static final String PATH_LOCAL_USER = getPathLocalUser(); public static final String PATH_TEMPLATES_DIR_USER = PATH_LOCAL_USER + File.separator + TEMPLATE_DIR; public static final String PATH_PREFERENCES_FILE_OLD = PATH_LOCAL_USER + File.separator + ".preferences";//$NON-NLS-1$ public static final String PATH_PREFERENCES_XML_FILE = PATH_PREFERENCES_FILE_OLD+".xml";//$NON-NLS-1$ public static final String PATH_CACHE_DIR = PATH_LOCAL_USER + File.separator + CACHE_DIR; public static final String PATH_CACHE_SHARE_DIR = PATH_LOCAL_USER + File.separator + CACHE_SHARED_DIR; public static final String PATH_TEMPLATES_SHARED = getPathTemplatesShared(); public static final String PATH_SHARED = getPathShared(); private static String getPathLocalUser() { String os = System.getProperty("os.name").toLowerCase();//$NON-NLS-1$ String home = System.getProperty("user.home");//$NON-NLS-1$ if(os.equals("windows vista"))//$NON-NLS-1$ return home + "\\AppData\\Local\\latexdraw";//$NON-NLS-1$ else if(os.equals("windows xp") || os.contains("win"))//$NON-NLS-1$ //$NON-NLS-2$ return home + "\\Application Data\\latexdraw";//$NON-NLS-1$ else if(os.equals("mac os x"))//$NON-NLS-1$ return home + "/Library/Preferences/latexdraw";//$NON-NLS-1$ return home + "/.latexdraw";//$NON-NLS-1$ } private static String getPathTemplatesShared() { String path = getPathShared(); if(path==null) return null; return path+File.separator+TEMPLATE_DIR; } private static String getPathShared() { String os = System.getProperty("os.name").toLowerCase();//$NON-NLS-1$ String home = System.getProperty("user.home");//$NON-NLS-1$ if(os.equals("mac os x"))//$NON-NLS-1$ return "/Users/Shared/latexdraw";//$NON-NLS-1$ else if(os.equals("windows vista"))//$NON-NLS-1$ { File dir = new File("C:\\ProgramData");//$NON-NLS-1$ int cpt = 0, max = 10; while(!dir.exists() && cpt * * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/21/07
    * @author Arnaud BLOUIN
    * @version 2.0.0 * @since 2.0.0 */ public abstract class LaTeXDrawResources { /** The e-mail of the latexdraw developer */ public static final String MAIL_ME = "arno_b@users.sourceforge.net"; //$NON-NLS-1$ public static final String LABEL_ZOOM_CHANGE = "zoomChange";//$NON-NLS-1$ /** The label of the menuItem zoomIn */ public static final String LABEL_ZOOM_IN = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.57"); //$NON-NLS-1$ /** The label of the menuItem zoomOut */ public static final String LABEL_ZOOM_OUT = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.58"); //$NON-NLS-1$ /** The label of the menu item drawLineMenu */ public final static String LABEL_LINE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.2"); //$NON-NLS-1$ /** The label of the menu item drawRectMenu */ public final static String LABEL_RECT = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.3"); //$NON-NLS-1$ /** The label of the menu item drawDotMenu */ public final static String LABEL_DOT = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.4"); //$NON-NLS-1$ /** The label of the menu item drawRectMenu */ public final static String LABEL_SQUARE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.5"); //$NON-NLS-1$ /** The label of the menu item drawRhombMenu */ public final static String LABEL_RHOMBUS = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.6"); //$NON-NLS-1$ /** The label of the menu item drawRhombMenu */ public final static String LABEL_POINTS_AKIN = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.7"); //$NON-NLS-1$ /** The label of the menu item drawTrianMenu */ public final static String LABEL_TRIANGLE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.8"); //$NON-NLS-1$ /** The label of the menu item drawJoinedLinesMenu */ public final static String LABEL_JOINED_LINES = LaTeXDrawLang.getString1_6("LaTeXDrawFrame.4"); //$NON-NLS-1$ /** The label of the menu item drawCircleMenu */ public final static String LABEL_CIRCLE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.9"); //$NON-NLS-1$ /** The label of the menu item drawGridMenu */ public final static String LABEL_GRID = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.10"); //$NON-NLS-1$ public final static String LABEL_AXES = LaTeXDrawLang.getString1_8("LaTeXDrawFrame.0"); //$NON-NLS-1$ /** The label of the menu item drawEllipseMenu */ public final static String LABEL_ELLIPSE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.11"); //$NON-NLS-1$ /** The label of the menu item drawPolyMenu */ public final static String LABEL_POLY = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.12"); //$NON-NLS-1$ /** The name of the choice dotChoice */ public static final String CHOICE_DOT_NAME = "dotChoice";//$NON-NLS-1$ /** The name of the choice lineChoice */ public static final String CHOICE_LINE_NAME = "lineChoice";//$NON-NLS-1$ /** The name of the choice lineArrowLChoice */ public static final String CHOICE_ARROW_LEFT_NAME = "arrowLChoice";//$NON-NLS-1$ public static final String CHOICE_ARROW_RIGHT_NAME = "arrowRChoice";//$NON-NLS-1$ /** The name of the extension of LaTeXDraw filenames (LaTeXDraw Project)*/ public final static String PROJECT_EXTENSION = ".ldp"; //$NON-NLS-1$ /** The name of the extension of LaTeXDraw templates */ public static final String TEMPLATE_EXTENSION = ".ldt";//$NON-NLS-1$ /** The beginning of the action command of templates */ public static final String TEMPLATE_START_ACTION_CMD = "template_";//$NON-NLS-1$ public final static String LABEL_EXPORT_EPS_LATEX = "EPS_LATEX_EXPORT";//$NON-NLS-1$ public final static String LABEL_EXPORT_PDF_LATEX = "PDF_LATEX_EXPORT";//$NON-NLS-1$ public final static String LABEL_EXPORT_PDF_LATEX_CROP = "PDFCROP_LATEX_EXPORT";//$NON-NLS-1$ /** The name of the extension of GIF file */ public static final String GIF_EXTENSION = ".gif";//$NON-NLS-1$ /** The name of the extension of PPM file */ public final static String PPM_EXTENSION = ".ppm";//$NON-NLS-1$ /** The name of the extension of bmp file*/ public final static String BMP_EXTENSION = ".bmp";//$NON-NLS-1$ /** The name of the extension of png file */ public final static String PNG_EXTENSION = ".png";//$NON-NLS-1$ /** The name of the extension of jpg file */ public final static String JPG_EXTENSION = ".jpg";//$NON-NLS-1$ /** The name of the extension of EPS file */ public final static String EPS_EXTENSION = ".eps";//$NON-NLS-1$ /** The name of the application */ public final static String LABEL_APP = "LaTeXDraw";//$NON-NLS-1$ /** The label of the menu insert PSTricks code */ public final static String LABEL_INSERT_CODE = LaTeXDrawLang.getString1_6("LaTeXDrawFrame.0"); //$NON-NLS-1$ /** The label of the menu insert picture */ public final static String LABEL_INSERT_PIX = LaTeXDrawLang.getString1_6("LaTeXDrawFrame.1"); //$NON-NLS-1$ /** The label of the menu "convert picture" */ public static final String LABEL_BATCH_CONVERT = LaTeXDrawLang.getString1_6("LaTeXDrawFrame.2"); //$NON-NLS-1$ /** The label of the button stop */ public final static String LABEL_STOP = LaTeXDrawLang.getString1_6("LaTeXDrawFrame.3"); //$NON-NLS-1$ /** The label of the menu help */ public final static String LABEL_HELP = LABEL_APP + LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.0"); //$NON-NLS-1$ /** The label of the menu "aboutTexDraw" */ public final static String LABEL_ABOUT = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.1")+ LABEL_APP+ " ..."; //$NON-NLS-1$//$NON-NLS-2$ /** The label of the menu item selectFigure */ public final static String LABEL_SELECT_FIGURE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.13"); //$NON-NLS-1$ /** The label of the menu item displayBorders */ public final static String LABEL_DISPLAY_BORDERS = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.14"); //$NON-NLS-1$ /** The label of the menu item displayBorders */ public final static String LABEL_AUTO_ADJUST_BORDERS = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.15"); //$NON-NLS-1$ /** The label of the menu export as */ public final static String LABEL_EXPORT_AS = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.16"); //$NON-NLS-1$ /** The label of the menu import */ public final static String LABEL_IMPORT = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.229"); //$NON-NLS-1$ /** The label of the menu item "import from TeX file" */ public static final String LABEL_IMPORT_TEX = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.230"); //$NON-NLS-1$ /** The label of the menu item deleteFigure */ public final static String LABEL_DELETE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.17"); //$NON-NLS-1$ /** The label of the menu item which allows the user to quit the application*/ public final static String LABEL_QUIT = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.18"); //$NON-NLS-1$ /** The label of the exportCodeMenu item */ public final static String LABEL_EXPORT_TRICKS = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.19"); //$NON-NLS-1$ /** The label of the exportAsPNMFile item */ public final static String LABEL_EXPORT_PPM = LaTeXDrawLang.getString1_6("LaTeXDrawFrame.5"); //$NON-NLS-1$ /** The label of the exportAsBMPFile item */ public final static String LABEL_EXPORT_BMP = LaTeXDrawLang.getString1_6("LaTeXDrawFrame.6"); //$NON-NLS-1$ /** The label of the exportAsPNGFile item */ public final static String LABEL_EXPORT_PNG = LaTeXDrawLang.getString1_6("LaTeXDrawFrame.7"); //$NON-NLS-1$ /** The label of the exportDrawMenu item */ public final static String LABEL_EXPORT_JPG = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.20"); //$NON-NLS-1$ /** The label of the exportEPSMenu item */ public final static String LABEL_EXPORT_EPS = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.21"); //$NON-NLS-1$ /** The label of the menuItem redoMenu */ public final static String LABEL_REDO = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.22"); //$NON-NLS-1$ /** The label of the menuItem undoMenu */ public final static String LABEL_UNDO = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.23"); //$NON-NLS-1$ /** The name of the thickness field */ public final static String NAME_THICKNESS_FIELD = "thicknessField"; //$NON-NLS-1$ public final static String NAME_DOT_SIZE_FIELD = "dotSizeField"; //$NON-NLS-1$ /** The label of the saveMenu item */ public final static String LABEL_SAVE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.25"); //$NON-NLS-1$ /** The label of the saveAsMenu item */ public final static String LABEL_SAVE_AS = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.26"); //$NON-NLS-1$ public final static String LABEL_RECENT_FILES = LaTeXDrawLang.getString1_9("LaTeXDrawFrame.0"); //$NON-NLS-1$ /** The label of the openMenu item */ public final static String LABEL_OPEN = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.27"); //$NON-NLS-1$ /** The label of the newMenu item */ public final static String LABEL_NEW = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.28"); //$NON-NLS-1$ public final static String LABEL_NEW_WITH_SEL =LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.26"); //$NON-NLS-1$ /** The label of the printCodeMenu item */ public final static String LABEL_PRINT_CODE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.29"); //$NON-NLS-1$ /** The label of the printDrawMenu item */ public final static String LABEL_PRINT_DRAW = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.30"); //$NON-NLS-1$ /** The label of the ImageButton behindSel */ public static final String LABEL_BEHIND_SEL = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.31"); //$NON-NLS-1$ /** The label of the ImageButton inFrontOfSel */ public static final String LABEL_FRONT_SEL = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.32"); //$NON-NLS-1$ /** The label of the button join */ public static final String LABEL_JOIN = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.33"); //$NON-NLS-1$ /** The label of the button separate */ public static final String LABEL_SEPARATE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.34"); //$NON-NLS-1$ /** The label of the arcMenu item */ public final static String LABEL_ARC = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.35"); //$NON-NLS-1$ /** The label of the wedgeMenu item */ public final static String LABEL_WEDGE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.36"); //$NON-NLS-1$ /** The label of the chordMenu item */ public final static String LABEL_CHORD = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.37"); //$NON-NLS-1$ /** The label of the menuItem displayXScale */ public static final String LABEL_DISPLAY_XSCALE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.38"); //$NON-NLS-1$ /** The label of the menuItem Y */ public static final String LABEL_DISPLAY_YSCALE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.39"); //$NON-NLS-1$ /** The label of the menu copy */ public static final String LABEL_COPY = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.40"); //$NON-NLS-1$ /** The label of the menuItem updateTemplates */ public static final String LABEL_TEMPLATE_UPDATE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.41"); //$NON-NLS-1$ /** The label of the menuItem exportAsTemplate */ public static final String LABEL_TEMPLATE_EXPORT = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.42"); //$NON-NLS-1$ /** The label of the menu paste */ public static final String LABEL_PASTE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.43"); //$NON-NLS-1$ /** The label of the menu cut */ public static final String LABEL_CUT = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.44"); //$NON-NLS-1$ public static final String LABEL_DISPLAY_PERSO_GRID = LaTeXDrawLang.getString1_8("PreferencesFrame.5"); //$NON-NLS-1$ /** The label of the menuItem displayGrid */ public static final String LABEL_DISPLAY_GRID = LaTeXDrawLang.getString1_8("PreferencesFrame.4"); //$NON-NLS-1$ /** The label of the menuItem codePanel */ public static final String LABEL_DISPLAY_CODE_PANEL = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.46"); //$NON-NLS-1$ /** The label of the JButton buttonBordersColor */ public static final String LABEL_COLOR_BUTTON = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.47"); //$NON-NLS-1$ /** The label of the JButton buttonInteriorColor */ public static final String LABEL_COLOR_INTERIOR_BUTTON = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.48"); //$NON-NLS-1$ /** The label of the JButton buttonHatchColor */ public static final String LABEL_COLOR_HATCH = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.49"); //$NON-NLS-1$ /** The label of the JButton buttonDbleBoundColor */ public static final String LABEL_COLOR_DBLE_BOUND = "dbleColBound"; //$NON-NLS-1$ /** The label of the JButton buttonShadowColor. */ public static final String LABEL_COLOR_SHADOW = LaTeXDrawLang.getString1_7("LaTeXDrawFrame.0"); //$NON-NLS-1$ public static final String NAME_COLOR_SHADOW = "SHA_COL_BUT";//$NON-NLS-1$ /** The label of the JCheckBox @see filledCheckBox */ public static final String LABEL_FILLED_CHECKBOX = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.51"); //$NON-NLS-1$ /** The label of the JCheckBox @see dbleBoundCheckBox */ public static final String LABEL_DBLE_BOUND_CHECKBOX = LaTeXDrawLang.getDialogFrameString("AbstractParametersFrame.0"); //$NON-NLS-1$ /** The label of the button which allows to choose the first colour of a gradient. */ public static final String LABEL_COLOR_GRADIENT_FIRST = LaTeXDrawLang.getString1_7("LaTeXDrawFrame.1"); //$NON-NLS-1$ /** The label of the button which allows to choose the second colour of a gradient. */ public static final String LABEL_COLOR_GRADIENT_SECOND = LaTeXDrawLang.getString1_7("LaTeXDrawFrame.2"); //$NON-NLS-1$ /** The label of the JCheckBox shadowCheckBox. */ public static final String LABEL_SHADOW_CHECKBOX = LaTeXDrawLang.getString1_7("LaTeXDrawFrame.0"); //$NON-NLS-1$ /** The label of the menu properties of the selected figure*/ public static final String LABEL_FIGURE_PROPERTIES = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.53"); //$NON-NLS-1$ /** The label of the menu properties of the drawing*/ public static final String LABEL_DRAW_PROPERTIES = LaTeXDrawLang.getDialogFrameString("DrawPropertiesFrame.2"); //$NON-NLS-1$ /** The label of the menu "addCommentsMenu" */ public static final String LABEL_COMMENTS = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.55"); //$NON-NLS-1$ /** The label of the menuItem "preferencesMenu" */ public static final String LABEL_PREFERENCES = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.56"); //$NON-NLS-1$ public static final String LABEL_MAGNETIC_CB = "MagneticCB";//$NON-NLS-1$ public static final String LABEL_PERSO_GRID_GAP_FIELD = "PersoGridGapFD";//$NON-NLS-1$ /** The label of the menuItem "bézier curve" */ public static final String LABEL_BEZIER_CURVE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.63"); //$NON-NLS-1$ public static final String LABEL_CLOSED_BEZIER_CURVE = LaTeXDrawLang.getString1_9("LaTeXDrawFrame.1"); //$NON-NLS-1$ /** Allows the user the zoom at 100 % */ public static final String LABEL_ZOOM_DEFAULT = "Zoom 100%"; //$NON-NLS-1$ /** This token allows the program to identify LaTeXDraw template files */ public static final String TOKEN_TEMPLATE_FILE = "LaTeXDraw template"; //$NON-NLS-1$ public static final String LABEL_TEX_EDITOR = "texEditor";//$NON-NLS-1$ /** The label of the menuItem menuText */ public static final String LABEL_TEXT = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.60"); //$NON-NLS-1$ /** The label of the menus which allow to put a figure in the foreground */ public static final String LABEL_FOREGROUND = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.61"); //$NON-NLS-1$ /** The label of the menus which allow to put a figure in the background */ public static final String LABEL_BACKGROUND = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.62"); //$NON-NLS-1$ /** The label of the button which allow to rotate a figure with the mouse */ public static final String LABEL_ROTATE = LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.64"); //$NON-NLS-1$ public static final String LABEL_ROTATE_90 = "rotation90"; //$NON-NLS-1$ public static final String LABEL_ROTATE_180 = "rotation180"; //$NON-NLS-1$ public static final String LABEL_ROTATE_270 = "rotation270"; //$NON-NLS-1$ public static final String LABEL_MIRROR_H = "mirrorH"; //$NON-NLS-1$ public static final String LABEL_MIRROR_V = "mirrorV"; //$NON-NLS-1$ public static final String NAME_SLIDER_DELIMITOR = "sliderDel";//$NON-NLS-1$ public final static ImageIcon pdfIcon ; public final static ImageIcon bezierCurveIcon; public final static ImageIcon chordIcon; public final static ImageIcon newIcon; public final static ImageIcon lineStyleNoneIcon; public final static ImageIcon openIcon; public final static ImageIcon lineStyleDashedIcon; public final static ImageIcon saveIcon ; public final static ImageIcon lineStyleDottedIcon; public final static ImageIcon saveAsIcon; public final static ImageIcon dotStyleNoneIcon; public final static ImageIcon circleIcon; public final static ImageIcon dotStyleSquareIcon; public final static ImageIcon delIcon; public final static ImageIcon dotStyleSquareFIcon; public final static ImageIcon dotIcon; public final static ImageIcon dotStylePentagonIcon; public final static ImageIcon ellipseIcon; public final static ImageIcon dotStylePentagonFIcon; public final static ImageIcon emptyIcon; public final static ImageIcon dotStyleTriangleIcon; public final static ImageIcon lineIcon; public final static ImageIcon dotStyleTriangleFIcon; public final static ImageIcon rectIcon; public final static ImageIcon dotStyleBarIcon; public final static ImageIcon rhombusIcon; public final static ImageIcon dotStyleAsteriskIcon; public final static ImageIcon selectIcon; public final static ImageIcon dotStyleCrossIcon; public final static ImageIcon squareIcon; public final static ImageIcon dotStyleDiamondIcon; public final static ImageIcon triangleIcon; public final static ImageIcon dotStyleDiamondFIcon; public final static ImageIcon propertiesIcon; public final static ImageIcon dotStyleOIcon; public final static ImageIcon printIcon; public final static ImageIcon dotStyleOPlusIcon; public final static ImageIcon dotStyleOCrossIcon; public final static ImageIcon updateIcon; public final static ImageIcon bordersIcon; public final static ImageIcon dotStylePlusIcon; public final static ImageIcon autoBordersIcon; public final static ImageIcon arrowStyleArcLIcon; public final static ImageIcon exportIcon; public final static ImageIcon arrowStyleArcRIcon; public final static ImageIcon arrowStyleArcRRIcon; public final static ImageIcon arrowStyleArcLRIcon; public final static ImageIcon aboutIcon; public final static ImageIcon arrowStyleArrowLIcon; public final static ImageIcon helpIcon; public final static ImageIcon arrowStyleArrowRIcon; public final static ImageIcon preferencesIcon; public final static ImageIcon arrowStyleBarEndLIcon; public final static ImageIcon arrowStyleBarEndRIcon; public final static ImageIcon drawingPropIcon; public final static ImageIcon arcIcon; public final static ImageIcon arrowStyleBarInLIcon; public final static ImageIcon wedgeIcon; public final static ImageIcon arrowStyleBarInRIcon; public final static ImageIcon zoomInIcon; public final static ImageIcon arrowStyleBrackLIcon; public final static ImageIcon arrowStyleBrackLRIcon; public final static ImageIcon arrowStyleBrackRRIcon; public final static ImageIcon zoomOutIcon; public final static ImageIcon arrowStyleBrackRIcon; public final static ImageIcon zoomDefaultIcon; public final static ImageIcon arrowStyleCircleEndLIcon; public final static ImageIcon undoIcon; public final static ImageIcon arrowStyleCircleEndRIcon; public final static ImageIcon redoIcon; public final static ImageIcon arrowStyleCircleInLIcon; public final static ImageIcon backgroundIcon; public final static ImageIcon arrowStyleCircleInRIcon; public final static ImageIcon foregroundIcon; public final static ImageIcon arrowStyleDbleArrowLIcon; public final static ImageIcon behindSelIcon; public final static ImageIcon arrowStyleDbleArrowRIcon; public final static ImageIcon inFrontOfSelIcon; public final static ImageIcon arrowStyleDiskEndLIcon; public final static ImageIcon rotateIcon; public final static ImageIcon arrowStyleDiskEndRIcon; public final static ImageIcon polygonIcon; public final static ImageIcon arrowStyleDiskInLIcon; public final static ImageIcon textIcon; public final static ImageIcon arrowStyleDiskInRIcon; public final static ImageIcon pointsAkinIcon; public final static ImageIcon arrowStyleNoneLIcon; public final static ImageIcon arrowStyleNoneRIcon; public final static ImageIcon arrowStyleRDbleArrowLIcon; public final static ImageIcon arrowStyleRDbleArrowRIcon; public final static ImageIcon arrowStyleRArrowLIcon; public final static ImageIcon arrowStyleRArrowRIcon; public final static ImageIcon copyIcon; public final static ImageIcon pasteIcon; public final static ImageIcon cutIcon; public final static ImageIcon arrowStyleRoundInLIcon; public final static ImageIcon arrowStyleRoundInRIcon; public final static ImageIcon hatchNoneIcon; public final static ImageIcon hatchHorizIcon; public final static ImageIcon hatchVertIcon; public final static ImageIcon hatchCrossIcon; public final static ImageIcon gridIcon; public final static ImageIcon joinIcon; public final static ImageIcon separateIcon; public final static ImageIcon middleIcon; public final static ImageIcon innerIcon; public final static ImageIcon outerIcon; public final static ImageIcon copySelIcon; public final static ImageIcon importIcon; public final static ImageIcon commentIcon; public final static ImageIcon joinedLinesIcon; public final static ImageIcon latexdrawIcon; public final static ImageIcon okIcon; public final static ImageIcon errIcon; public final static ImageIcon minusIcon; public final static ImageIcon plusIcon; public final static ImageIcon stopIcon; public final static ImageIcon reloadIcon; public final static ImageIcon insertPicIcon; public final static ImageIcon insertPSTricksIcon; public final static ImageIcon thicknessIcon; public final static ImageIcon gradientIcon; public final static ImageIcon displayGridIcon; public final static ImageIcon rotate270Icon; public final static ImageIcon rotate180Icon; public final static ImageIcon rotate90Icon; public final static ImageIcon mirrorVIcon; public final static ImageIcon mirrorHIcon; public final static ImageIcon axesIcon; public final static ImageIcon texEditorIcon; public final static ImageIcon delimitorIcon; public final static ImageIcon curvesFreehandIcon; public final static ImageIcon linesFreehandIcon; public final static ImageIcon closeLineIcon; public final static ImageIcon closeCurveIcon; public final static ImageIcon closedBezierIcon; public final static ImageIcon alignBottomIcon; public final static ImageIcon alignLeftIcon; public final static ImageIcon alignMiddleHorizIcon; public final static ImageIcon alignMiddleVertIcon; public final static ImageIcon alignRightIcon; public final static ImageIcon alignTopIcon; public final static ImageIcon distVertBottomIcon; public final static ImageIcon distHorizEqualIcon; public final static ImageIcon distVertMiddleIcon; public final static ImageIcon distVertTopIcon; public final static ImageIcon distVertEqualIcon; public final static ImageIcon distHorizMiddleIcon; public final static ImageIcon distHorizLeftIcon; public final static ImageIcon distHorizRightIcon; static { hatchNoneIcon = loadImageIcon("/res/hatch/hatch.none.png");//$NON-NLS-1$ hatchVertIcon = loadImageIcon("/res/hatch/hatch.vert.png");//$NON-NLS-1$ hatchHorizIcon = loadImageIcon("/res/hatch/hatch.horiz.png");//$NON-NLS-1$ hatchCrossIcon = loadImageIcon("/res/hatch/hatch.cross.png");//$NON-NLS-1$ arrowStyleArcLIcon = loadImageIcon("/res/arrowStyles/line.arc.left.png");//$NON-NLS-1$ arrowStyleArcRIcon = loadImageIcon("/res/arrowStyles/line.arc.right.png");//$NON-NLS-1$ arrowStyleArcLRIcon = loadImageIcon("/res/arrowStyles/line.arc.r.left.png");//$NON-NLS-1$ arrowStyleArcRRIcon = loadImageIcon("/res/arrowStyles/line.arc.r.right.png");//$NON-NLS-1$ arrowStyleArrowLIcon = loadImageIcon("/res/arrowStyles/line.arrow.left.png");//$NON-NLS-1$ arrowStyleArrowRIcon = loadImageIcon("/res/arrowStyles/line.arrow.right.png");//$NON-NLS-1$ arrowStyleBarEndLIcon = loadImageIcon("/res/arrowStyles/line.barEnd.left.png");//$NON-NLS-1$ arrowStyleBarEndRIcon = loadImageIcon("/res/arrowStyles/line.barEnd.right.png");//$NON-NLS-1$ arrowStyleBarInLIcon = loadImageIcon("/res/arrowStyles/line.barIn.left.png");//$NON-NLS-1$ arrowStyleBarInRIcon = loadImageIcon("/res/arrowStyles/line.barIn.right.png");//$NON-NLS-1$ arrowStyleBrackLIcon = loadImageIcon("/res/arrowStyles/line.bracket.left.png");//$NON-NLS-1$ arrowStyleBrackRIcon = loadImageIcon("/res/arrowStyles/line.bracket.right.png");//$NON-NLS-1$ arrowStyleBrackLRIcon = loadImageIcon("/res/arrowStyles/line.bracket.r.left.png");//$NON-NLS-1$ arrowStyleBrackRRIcon = loadImageIcon("/res/arrowStyles/line.bracket.r.right.png");//$NON-NLS-1$ arrowStyleCircleEndLIcon = loadImageIcon("/res/arrowStyles/line.circle.end.left.png");//$NON-NLS-1$ arrowStyleCircleEndRIcon = loadImageIcon("/res/arrowStyles/line.circle.end.right.png");//$NON-NLS-1$ arrowStyleCircleInLIcon = loadImageIcon("/res/arrowStyles/line.circle.in.left.png");//$NON-NLS-1$ arrowStyleCircleInRIcon = loadImageIcon("/res/arrowStyles/line.circle.in.right.png");//$NON-NLS-1$ arrowStyleDbleArrowLIcon = loadImageIcon("/res/arrowStyles/line.dbleArrow.left.png");//$NON-NLS-1$ arrowStyleDbleArrowRIcon = loadImageIcon("/res/arrowStyles/line.dbleArrow.right.png");//$NON-NLS-1$ arrowStyleDiskEndLIcon = loadImageIcon("/res/arrowStyles/line.disk.end.left.png");//$NON-NLS-1$ arrowStyleDiskEndRIcon = loadImageIcon("/res/arrowStyles/line.disk.end.right.png");//$NON-NLS-1$ arrowStyleDiskInLIcon = loadImageIcon("/res/arrowStyles/line.disk.in.left.png");//$NON-NLS-1$ arrowStyleDiskInRIcon = loadImageIcon("/res/arrowStyles/line.disk.in.right.png");//$NON-NLS-1$ arrowStyleNoneLIcon = loadImageIcon("/res/arrowStyles/line.none.left.png");//$NON-NLS-1$ arrowStyleNoneRIcon = loadImageIcon("/res/arrowStyles/line.none.right.png");//$NON-NLS-1$ arrowStyleRArrowLIcon = loadImageIcon("/res/arrowStyles/line.rarrow.left.png");//$NON-NLS-1$ arrowStyleRArrowRIcon = loadImageIcon("/res/arrowStyles/line.rarrow.right.png");//$NON-NLS-1$ arrowStyleRDbleArrowLIcon = loadImageIcon("/res/arrowStyles/line.rdbleArrow.left.png");//$NON-NLS-1$ arrowStyleRDbleArrowRIcon = loadImageIcon("/res/arrowStyles/line.rdbleArrow.right.png");//$NON-NLS-1$ arrowStyleRoundInLIcon = loadImageIcon("/res/arrowStyles/line.roundIn.left.png");//$NON-NLS-1$ arrowStyleRoundInRIcon = loadImageIcon("/res/arrowStyles/line.roundIn.right.png");//$NON-NLS-1$ dotStyleAsteriskIcon = loadImageIcon("/res/dotStyles/dot.asterisk.png");//$NON-NLS-1$ dotStyleNoneIcon = loadImageIcon("/res/dotStyles/dot.none.png");//$NON-NLS-1$ dotStyleBarIcon = loadImageIcon("/res/dotStyles/dot.bar.png");//$NON-NLS-1$ dotStyleOIcon = loadImageIcon("/res/dotStyles/dot.o.png");//$NON-NLS-1$ dotStyleCrossIcon = loadImageIcon("/res/dotStyles/dot.cross.png");//$NON-NLS-1$ dotStyleDiamondIcon = loadImageIcon("/res/dotStyles/dot.diamond.png");//$NON-NLS-1$ dotStyleDiamondFIcon = loadImageIcon("/res/dotStyles/dot.diamondF.png");//$NON-NLS-1$ dotStyleOCrossIcon = loadImageIcon("/res/dotStyles/dot.ocross.png");//$NON-NLS-1$ dotStyleOPlusIcon = loadImageIcon("/res/dotStyles/dot.oplus.png");//$NON-NLS-1$ dotStylePentagonIcon = loadImageIcon("/res/dotStyles/dot.pentagon.png");//$NON-NLS-1$ dotStylePentagonFIcon = loadImageIcon("/res/dotStyles/dot.pentagonF.png");//$NON-NLS-1$ dotStylePlusIcon = loadImageIcon("/res/dotStyles/dot.plus.png");//$NON-NLS-1$ dotStyleSquareIcon = loadImageIcon("/res/dotStyles/dot.square.png");//$NON-NLS-1$ dotStyleSquareFIcon = loadImageIcon("/res/dotStyles/dot.squareF.png");//$NON-NLS-1$ dotStyleTriangleIcon = loadImageIcon("/res/dotStyles/dot.triangle.png");//$NON-NLS-1$ dotStyleTriangleFIcon = loadImageIcon("/res/dotStyles/dot.triangleF.png");//$NON-NLS-1$ lineStyleNoneIcon = loadImageIcon("/res/lineStyles/lineStyle.none.png");//$NON-NLS-1$ lineStyleDashedIcon = loadImageIcon("/res/lineStyles/lineStyle.dashed.png");//$NON-NLS-1$ lineStyleDottedIcon = loadImageIcon("/res/lineStyles/lineStyle.dotted.png");//$NON-NLS-1$ middleIcon = loadImageIcon("/res/doubleBoundary/double.boundary.middle.png");//$NON-NLS-1$ innerIcon = loadImageIcon("/res/doubleBoundary/double.boundary.inner.png");//$NON-NLS-1$ outerIcon = loadImageIcon("/res/doubleBoundary/double.boundary.outer.png");//$NON-NLS-1$ gridIcon = loadImageIcon("/res/grid.png");//$NON-NLS-1$ copyIcon = loadImageIcon("/res/Copy.png");//$NON-NLS-1$ pasteIcon = loadImageIcon("/res/Paste.png");//$NON-NLS-1$ cutIcon = loadImageIcon("/res/Cut.png");//$NON-NLS-1$ pointsAkinIcon = loadImageIcon("/res/Draw.png"); //$NON-NLS-1$ textIcon = loadImageIcon("/res/text.png"); //$NON-NLS-1$ polygonIcon = loadImageIcon("/res/polygon.png"); //$NON-NLS-1$ rotateIcon = loadImageIcon("/res/rotation.png"); //$NON-NLS-1$ inFrontOfSelIcon= loadImageIcon("/res/InFrontSelect.png"); //$NON-NLS-1$ behindSelIcon = loadImageIcon("/res/behindSelect.png"); //$NON-NLS-1$ backgroundIcon = loadImageIcon("/res/background.png"); //$NON-NLS-1$ foregroundIcon = loadImageIcon("/res/foreground.png");//$NON-NLS-1$ undoIcon = loadImageIcon("/res/Undo.png");//$NON-NLS-1$ redoIcon = loadImageIcon("/res/Redo.png"); //$NON-NLS-1$ zoomDefaultIcon = loadImageIcon("/res/Magnify.png"); //$NON-NLS-1$ zoomInIcon = loadImageIcon("/res/MagnifyPlus.png"); //$NON-NLS-1$ zoomOutIcon = loadImageIcon("/res/MagnifyMinus.png");//$NON-NLS-1$ wedgeIcon = loadImageIcon("/res/wedge.png");//$NON-NLS-1$ arcIcon = loadImageIcon("/res/Arc.png"); //$NON-NLS-1$ preferencesIcon = loadImageIcon("/res/preferences-system.png"); //$NON-NLS-1$ newIcon = loadImageIcon("/res/New.png"); //$NON-NLS-1$ openIcon = loadImageIcon("/res/document-open.png"); //$NON-NLS-1$ saveIcon = loadImageIcon("/res/document-save.png"); //$NON-NLS-1$ saveAsIcon = loadImageIcon("/res/document-save-as.png");//$NON-NLS-1$ circleIcon = loadImageIcon("/res/circle.png"); //$NON-NLS-1$ delIcon = loadImageIcon("/res/del.png"); //$NON-NLS-1$ dotIcon = loadImageIcon("/res/dot.png"); //$NON-NLS-1$ ellipseIcon = loadImageIcon("/res/ellipse.png");//$NON-NLS-1$ emptyIcon = loadImageIcon("/res/empty.png"); //$NON-NLS-1$ lineIcon = loadImageIcon("/res/line.png"); //$NON-NLS-1$ rectIcon = loadImageIcon("/res/rectangle.png"); //$NON-NLS-1$ rhombusIcon = loadImageIcon("/res/rhombus.png");//$NON-NLS-1$ selectIcon = loadImageIcon("/res/select.png"); //$NON-NLS-1$ squareIcon = loadImageIcon("/res/square.png"); //$NON-NLS-1$ triangleIcon = loadImageIcon("/res/triangle.png");//$NON-NLS-1$ propertiesIcon = loadImageIcon("/res/preferences-desktop-theme.png"); //$NON-NLS-1$ printIcon = loadImageIcon("/res/Print.png");//$NON-NLS-1$ bordersIcon = loadImageIcon("/res/Object.png"); //$NON-NLS-1$ helpIcon = loadImageIcon("/res/help-browser.png"); //$NON-NLS-1$ aboutIcon = loadImageIcon("/res/emblem-important.png"); //$NON-NLS-1$ autoBordersIcon = loadImageIcon("/res/AutoBorders.png");//$NON-NLS-1$ exportIcon = loadImageIcon("/res/go-previous.png");//$NON-NLS-1$ joinIcon = loadImageIcon("/res/join.png");//$NON-NLS-1$ separateIcon = loadImageIcon("/res/separate.png");//$NON-NLS-1$ reloadIcon = loadImageIcon("/res/view-refresh.png");//$NON-NLS-1$ bezierCurveIcon = loadImageIcon("/res/bezierCurve.png");//$NON-NLS-1$ chordIcon = loadImageIcon("/res/chord.png"); //$NON-NLS-1$ copySelIcon = loadImageIcon("/res/CopySel.png"); //$NON-NLS-1$ importIcon = loadImageIcon("/res/go-next.png"); //$NON-NLS-1$ commentIcon = loadImageIcon("/res/comment.png"); //$NON-NLS-1$ joinedLinesIcon = loadImageIcon("/res/joinedLines.png"); //$NON-NLS-1$ okIcon = loadImageIcon("/res/ok.png"); //$NON-NLS-1$ errIcon = loadImageIcon("/res/emblem-unreadable.png"); //$NON-NLS-1$ plusIcon = loadImageIcon("/res/list-add.png"); //$NON-NLS-1$ minusIcon = loadImageIcon("/res/list-remove.png"); //$NON-NLS-1$ stopIcon = loadImageIcon("/res/stop.png"); //$NON-NLS-1$ insertPicIcon = loadImageIcon("/res/image-x-generic.png"); //$NON-NLS-1$ insertPSTricksIcon = loadImageIcon("/res/text-x-generic.png"); //$NON-NLS-1$ thicknessIcon = loadImageIcon("/res/thickness.png"); //$NON-NLS-1$ gradientIcon = loadImageIcon("/res/hatch/gradient.png"); //$NON-NLS-1$ displayGridIcon = loadImageIcon("/res/displayGrid.png"); //$NON-NLS-1$ rotate180Icon = loadImageIcon("/res/rotation180.png"); //$NON-NLS-1$ rotate90Icon = loadImageIcon("/res/rotation90.png"); //$NON-NLS-1$ rotate270Icon = loadImageIcon("/res/rotation270.png"); //$NON-NLS-1$ mirrorHIcon = loadImageIcon("/res/mirrorH.png"); //$NON-NLS-1$ mirrorVIcon = loadImageIcon("/res/mirrorV.png"); //$NON-NLS-1$ axesIcon = loadImageIcon("/res/axes.png"); //$NON-NLS-1$ texEditorIcon = loadImageIcon("/res/texEditor.png"); //$NON-NLS-1$ delimitorIcon = loadImageIcon("/res/delimitor.png"); //$NON-NLS-1$ curvesFreehandIcon = loadImageIcon("/res/freehand/curve.png"); //$NON-NLS-1$ linesFreehandIcon = loadImageIcon("/res/freehand/line.png"); //$NON-NLS-1$ closeCurveIcon = loadImageIcon("/res/BezierCurves/closeCurve.png"); //$NON-NLS-1$ closeLineIcon = loadImageIcon("/res/BezierCurves/closeLine.png"); //$NON-NLS-1$ closedBezierIcon = loadImageIcon("/res/closedBezier.png"); //$NON-NLS-1$ updateIcon = loadImageIcon("/res/system-software-update.png"); //$NON-NLS-1$ drawingPropIcon = loadImageIcon("/res/document-properties.png"); //$NON-NLS-1$ latexdrawIcon = loadImageIcon("/res/LaTeXDrawIcon.png"); //$NON-NLS-1$ pdfIcon = loadImageIcon("/res/pdf.png"); //$NON-NLS-1$ alignBottomIcon = loadImageIcon("/res/align/alignBottom.png"); //$NON-NLS-1$ alignLeftIcon = loadImageIcon("/res/align/alignLeft.png"); //$NON-NLS-1$ alignMiddleHorizIcon= loadImageIcon("/res/align/alignMiddleHoriz.png"); //$NON-NLS-1$ alignMiddleVertIcon = loadImageIcon("/res/align/alignMiddleVert.png"); //$NON-NLS-1$ alignRightIcon = loadImageIcon("/res/align/alignRight.png"); //$NON-NLS-1$ alignTopIcon = loadImageIcon("/res/align/alignTop.png"); //$NON-NLS-1$ distVertBottomIcon = loadImageIcon("/res/distrib/distVertBottom.png"); //$NON-NLS-1$ distVertEqualIcon = loadImageIcon("/res/distrib/distVertEqual.png"); //$NON-NLS-1$ distVertMiddleIcon = loadImageIcon("/res/distrib/distVertMiddle.png"); //$NON-NLS-1$ distVertTopIcon = loadImageIcon("/res/distrib/distVertTop.png"); //$NON-NLS-1$ distHorizEqualIcon = loadImageIcon("/res/distrib/distHorizEqual.png"); //$NON-NLS-1$ distHorizMiddleIcon = loadImageIcon("/res/distrib/distHorizMiddle.png"); //$NON-NLS-1$ distHorizRightIcon = loadImageIcon("/res/distrib/distHorizRight.png"); //$NON-NLS-1$ distHorizLeftIcon = loadImageIcon("/res/distrib/distHorizLeft.png"); //$NON-NLS-1$ } /** * Allows to load a image icon from a path. * @param path The path. * @return The image icon or null. */ public static ImageIcon loadImageIcon(String path) { URL url; try { url = Class.class.getResource(path); if(url==null) throw new MalformedURLException(); return new ImageIcon(url); } catch(Exception e) { e.printStackTrace(); return null; } } } latexdraw-2.0.8+1.orig/latexDraw/util/LaTeXDrawNamespace.java0000644000000000000000000002066711347255510020676 0ustar package latexDraw.util; /** * Defines the elements of the latexdraw namespace.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 11/06/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public abstract class LaTeXDrawNamespace { public static final String LATEXDRAW_NAMESPACE_URI = "http://latexdraw.sourceforge.net/namespaces/latexdraw"; //$NON-NLS-1$ public static final String LATEXDRAW_NAMESPACE = "latexdraw"; //$NON-NLS-1$ public static final String XML_TYPE = "type"; //$NON-NLS-1$ public static final String XML_TYPE_RECT = "rectangle"; //$NON-NLS-1$ public static final String XML_TYPE_AKIN_PTS = "akinPoints"; //$NON-NLS-1$ public static final String XML_TYPE_ARC = "arc"; //$NON-NLS-1$ public static final String XML_TYPE_ARROWHEAD = "arrowhead"; //$NON-NLS-1$ public static final String XML_TYPE_AXE = "axe"; //$NON-NLS-1$ public static final String XML_TYPE_BEZIER_CURVE = "bezierCurve"; //$NON-NLS-1$ public static final String XML_TYPE_CIRCLE = "circle"; //$NON-NLS-1$ public static final String XML_TYPE_DOT = "dot"; //$NON-NLS-1$ public static final String XML_TYPE_DRAWING = "drawing"; //$NON-NLS-1$ public static final String XML_TYPE_ELLIPSE = "ellipse"; //$NON-NLS-1$ public static final String XML_TYPE_FRAMEDBOX = "framedbox"; //$NON-NLS-1$ public static final String XML_TYPE_GRID = "grid"; //$NON-NLS-1$ public static final String XML_TYPE_JOINED_LINES = "joinedLines"; //$NON-NLS-1$ public static final String XML_TYPE_POLYGON = "polygon"; //$NON-NLS-1$ public static final String XML_TYPE_PICTURE = "picture"; //$NON-NLS-1$ public static final String XML_TYPE_RHOMBUS = "rhombus"; //$NON-NLS-1$ public static final String XML_TYPE_SQUARE = "square"; //$NON-NLS-1$ public static final String XML_TYPE_TEXT = "text"; //$NON-NLS-1$ public static final String XML_TYPE_TRIANGLE = "triangle"; //$NON-NLS-1$ public static final String XML_TYPE_LINE = "line"; //$NON-NLS-1$ public static final String XML_TYPE_DBLE_BORDERS = "dbleborders"; //$NON-NLS-1$ public static final String XML_TYPE_SHOW_PTS = "showPoints"; //$NON-NLS-1$ public static final String XML_BORDERS_POS = "borderPos"; //$NON-NLS-1$ public static final String XML_TYPE_SHADOW = "shadow"; //$NON-NLS-1$ public static final String XML_ROTATION = "rotationAngle"; //$NON-NLS-1$ public static final String XML_DOT_SHAPE = "dotShape"; //$NON-NLS-1$ public static final String XML_TYPE_GRID_SUB = "subGrid"; //$NON-NLS-1$ public static final String XML_TYPE_BG = "background"; //$NON-NLS-1$ public static final String XML_BORDER = "border"; //$NON-NLS-1$ public static final String XML_CAPTION = "caption"; //$NON-NLS-1$ public static final String XML_LABEL = "label"; //$NON-NLS-1$ public static final String XML_POSITION_VERT = "positionVert"; //$NON-NLS-1$ public static final String XML_POSITION_HORIZ = "positionHoriz"; //$NON-NLS-1$ public static final String XML_COMMENTS = "comments"; //$NON-NLS-1$ public static final String XML_DRAW_BORDERS = "displayBorders"; //$NON-NLS-1$ public static final String XML_AUTO_ADJUST = "autoAdjust"; //$NON-NLS-1$ public static final String XML_PPC = "ppc"; //$NON-NLS-1$ public static final String XML_ZOOM = "zoom"; //$NON-NLS-1$ public static final String XML_UNIT = "unit"; //$NON-NLS-1$ public static final String XML_CLASSIC_GRID = "classicGrid"; //$NON-NLS-1$ public static final String XML_GRID_GAP = "gridGap"; //$NON-NLS-1$ public static final String XML_CODE = "code"; //$NON-NLS-1$ public static final String XML_MAGNETIC_GRID = "magneticGrid"; //$NON-NLS-1$ public static final String XML_VERSION = "version"; //$NON-NLS-1$ public static final String XML_POSITION = "position"; //$NON-NLS-1$ public static final String XML_POSITION_X = "x"; //$NON-NLS-1$ public static final String XML_POSITION_Y = "y"; //$NON-NLS-1$ public static final String XML_SIZE = "size"; //$NON-NLS-1$ public static final String XML_HEIGHT = "height"; //$NON-NLS-1$ public static final String XML_WIDTH = "width"; //$NON-NLS-1$ public static final String XML_MAXIMISED = "maximised"; //$NON-NLS-1$ public static final String XML_DIVIDER_POSITION = "dividerPosition"; //$NON-NLS-1$ public static final String XML_AUTO_UPDATE = "autoUpdate"; //$NON-NLS-1$ public static final String XML_DISPLAY_GRID = "displayGrid"; //$NON-NLS-1$ public static final String XML_ROOT_PREFERENCES = "preferences"; //$NON-NLS-1$ public static final String XML_RENDERING = "rendering"; //$NON-NLS-1$ public static final String XML_COLOR_RENDERING = "colorRendering"; //$NON-NLS-1$ public static final String XML_ALPHA_INTER = "alphaInter"; //$NON-NLS-1$ public static final String XML_ANTI_ALIAS = "antiAlias"; //$NON-NLS-1$ public static final String XML_PATH_EXPORT = "pathExport"; //$NON-NLS-1$ public static final String XML_PATH_OPEN = "pathOpen"; //$NON-NLS-1$ public static final String XML_DISPLAY_CODE_PANEL = "displayCodePanel"; //$NON-NLS-1$ public static final String XML_DISPLAY_X = "displayXScale"; //$NON-NLS-1$ public static final String XML_DISPLAY_Y = "displayYScale"; //$NON-NLS-1$ public static final String XML_CHECK_VERSION = "checkVersion"; //$NON-NLS-1$ public static final String XML_LANG = "lang"; //$NON-NLS-1$ public static final String XML_PATH_TEX_EDITOR = "pathTexEditor"; //$NON-NLS-1$ public static final String XML_PATH_LATEX_DISTRIB = "latexDistrib"; //$NON-NLS-1$ public static final String XML_LATEX_INCLUDES = "latexIncludes"; //$NON-NLS-1$ public static final String XML_RECENT_FILES = "recentFiles"; //$NON-NLS-1$ public static final String XML_NB_RECENT_FILES = "nb"; //$NON-NLS-1$ public static final String XML_RECENT_FILE = "recentFile"; //$NON-NLS-1$ public static final String XML_LAF = "laf"; //$NON-NLS-1$ public static final String XML_DELIMITOR_OPACITY = "delimitorOpacity"; //$NON-NLS-1$ public static final String XML_PATH_TYPE = "pathType"; //$NON-NLS-1$ public static final String XML_INTERVAL = "interval"; //$NON-NLS-1$ public static final String XML_STYLE = "style"; //$NON-NLS-1$ public static final String XML_POINTS = "points"; //$NON-NLS-1$ public static final String XML_GRID_X_SOUTH = "XLabelsSouth"; //$NON-NLS-1$ public static final String XML_GRID_Y_WEST = "YLabelsWest"; //$NON-NLS-1$ public static final String XML_GRID_DOTS = "gridDots"; //$NON-NLS-1$ public static final String XML_GRID_UNIT = "gridUnit"; //$NON-NLS-1$ public static final String XML_GRID_END = "gridEnd"; //$NON-NLS-1$ public static final String XML_GRID_START = "gridStart"; //$NON-NLS-1$ public static final String XML_GRID_ORIGIN = "origin"; //$NON-NLS-1$ public static final String XML_GRID_SUB_DIV = "subDiv"; //$NON-NLS-1$ public static final String XML_GRID_WIDTH = "Gridwidth"; //$NON-NLS-1$ public static final String XML_ARROW_DOT_SIZE_NUM = "dotSizeNum"; //$NON-NLS-1$ public static final String XML_ARROW_TBAR_SIZE_NUM = "tbarSizeNum"; //$NON-NLS-1$ public static final String XML_ARROW_SIZE_NUM = "arrSizeNum"; //$NON-NLS-1$ public static final String XML_AXE_IS_WEST = "isWest"; //$NON-NLS-1$ public static final String XML_AXE_IS_SOUTH = "isSouth"; //$NON-NLS-1$ public static final String XML_AXE_INCREMENT = "increment"; //$NON-NLS-1$ public static final String XML_AXE_TICKS_SIZE = "ticksSize"; //$NON-NLS-1$ public static final String XML_AXE_SHOW_ORIGIN = "showOrigin"; //$NON-NLS-1$ public static final String XML_AXE_SHOW_TICKS = "showTicks"; //$NON-NLS-1$ public static final String XML_AXE_LABELS_STYLE = "showLabels"; //$NON-NLS-1$ public static final String XML_AXE_DIST_LABELS = "distLabels"; //$NON-NLS-1$ public static final String XML_AXE_TICKS_STYLE = "ticksStyle"; //$NON-NLS-1$ } latexdraw-2.0.8+1.orig/latexDraw/util/LaTeXDrawPoint2D.java0000644000000000000000000001300011347255510020240 0ustar package latexDraw.util; import static java.lang.Math.PI; import java.awt.geom.Point2D; import java.io.IOException; import java.io.ObjectInputStream; import latexDraw.figures.Line; /** * This class allows a LaTeXDrawPoint2D to be serializable (it's not the case for java 1.5)
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class LaTeXDrawPoint2D extends Point2D.Double { private static final long serialVersionUID = 1L; /** * Constructs a point from a java point2D * @param pt The java point2D */ public LaTeXDrawPoint2D(Point2D pt) { if(pt==null) x = y = 0.; else setLocation(pt); } /** * Constructs and initialises a Point2D with the specified coordinates. * @param x The X-coordinate to which to set the newly constructed Point2D * @param y The Y-coordinate to which to set the newly constructed Point2D */ public LaTeXDrawPoint2D(double x, double y) { super(x, y); } /** * Constructs and initialises a Point2D with coordinates (0, 0). */ public LaTeXDrawPoint2D() { super(); } /** * Allows to deserialize the point2D.Double * @param ois The input stream */ private void readObject(ObjectInputStream ois) throws IOException { x = ois.readDouble(); y = ois.readDouble(); } /** * Allows to know if the point p is equal to "this" considering a gap. * @param p The point to compare * @param gap The approximation gap * @return True if they are equals * @exception IllegalArgumentException When gap<0 */ public boolean equals(LaTeXDrawPoint2D p, double gap) { if(gap<0) throw new IllegalArgumentException(); if(p==null) return false; //Fixed: < and > are replaced by <= and >= return p.x-gap<=x && p.x+gap>=x && p.y-gap<=y && p.y+gap>=y; } /** * Allows to get middle point of these two points * @param p The second point * @return The middle point */ public LaTeXDrawPoint2D getMiddlePoint(LaTeXDrawPoint2D p) { return new LaTeXDrawPoint2D((x+p.x)/2., (y+p.y)/2.); } /** * Allows to move a point with the difference between a the former position * of a point p and its new. * @param oldP The old position of the point of reference * @param newP The new position of the point of reference */ public synchronized void move(LaTeXDrawPoint2D oldP, LaTeXDrawPoint2D newP) { x+=newP.x-oldP.x; y+=newP.y-oldP.y; } /** * Returns vertically the point. * @param origin The location of the vertical axe. */ public Point2D verticalSymmetry(LaTeXDrawPoint2D origin) { try { Line l = new Line(origin.y, (LaTeXDrawPoint2D)origin.clone(), false); LaTeXDrawPoint2D o2 = new LaTeXDrawPoint2D(x, origin.y); double distance = distance(o2); Line perp = l.getPerpendicularLine(o2, false); LaTeXDrawPoint2D[] pts = perp.findPoints(o2, distance); if(pts==null) return null; if(pts.length==1) return pts[0]; return distance(pts[0])>distance(pts[1]) ? pts[0] : pts[1]; }catch(Exception e) { return null; } } /** * Returns horizontally the point. * @param origin The location of the horizontal axe. */ public Point2D horizontalSymmetry(LaTeXDrawPoint2D origin) { try { Line l = new Line((LaTeXDrawPoint2D)origin.clone(), new LaTeXDrawPoint2D(origin.x, origin.y-10), false); LaTeXDrawPoint2D o2 = new LaTeXDrawPoint2D(origin.x, y); double distance = distance(o2); Line perp = l.getPerpendicularLine(o2, false); LaTeXDrawPoint2D[] pts = perp.findPoints(o2, distance); if(pts==null) return null; if(pts.length==1) return pts[0]; return distance(pts[0])>distance(pts[1]) ? pts[0] : pts[1]; }catch(Exception e) { return null; } } /** * Get a point by central symmetry. * @param centre The centre of the symmetry. * @return The resulting point. * @since 1.9 */ public LaTeXDrawPoint2D centralSymmetry(LaTeXDrawPoint2D centre) { return rotatePoint(centre, Math.PI); } /** * Allows to rotate a point with as reference an other point. * @param gravityC The point of reference. * @param theta The angle of rotation (in rad). * @return The rotated point. * @since 1.9 */ public LaTeXDrawPoint2D rotatePoint(LaTeXDrawPoint2D gravityC, double theta) { LaTeXDrawPoint2D pt = new LaTeXDrawPoint2D(); double cosTheta; double sinTheta; if(theta<0.) theta = 2.*PI + theta; if((theta%(2.*PI))==0.) return (LaTeXDrawPoint2D)clone(); if((theta%(2.*PI))==(PI/2.)) { cosTheta = 0.; sinTheta = 1.; } else { if((theta%(2.*PI))==PI) { cosTheta = -1.; sinTheta = 0.; } else { if((theta%(2.*PI))==(3.*PI/2.)) { cosTheta = 0.; sinTheta = -1.; } else { cosTheta = Math.cos(theta); sinTheta = Math.sin(theta); } } } pt.x = cosTheta * (x - gravityC.x) - sinTheta * (y - gravityC.y) + gravityC.x; pt.y = sinTheta * (x - gravityC.x) + cosTheta * (y - gravityC.y) + gravityC.y; return pt; } } latexdraw-2.0.8+1.orig/latexDraw/util/LaTeXDrawException.java0000644000000000000000000000423211347255510020726 0ustar package latexDraw.util; import latexDraw.lang.LaTeXDrawLang; /** * This class allows the management of exceptions. * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class LaTeXDrawException extends Exception { private static final long serialVersionUID = 1L; /** The code of the exception generated */ private int errorCode; public static final short INCORRECT_VALUE = 0; public static final short NOT_TEXDRAW_FILE = 1; public static final short INVALID_TEXDRAW_VERSION = 2; public static final short INVALID_PICTURE = 3; /** * The constructor using the identifier of the error * @param errorCode The identifier of the error */ public LaTeXDrawException(int errorCode) { this.errorCode = errorCode; } /** * Allows to get the code of the error * @return The code of the error */ public int getErrorCode() { return errorCode; } @Override public String toString() { switch(errorCode) { case INCORRECT_VALUE : return LaTeXDrawLang.getOthersString("LaTeXDrawException.valueInc"); //$NON-NLS-1$ case NOT_TEXDRAW_FILE : return LaTeXDrawLang.getOthersString("LaTeXDrawException.invFile"); //$NON-NLS-1$ case INVALID_TEXDRAW_VERSION : return LaTeXDrawLang.getOthersString("LaTeXDrawException.invLaTeXDrawVer"); //$NON-NLS-1$ case INVALID_PICTURE : return LaTeXDrawLang.getString1_7("LaTeXDrawException.0"); //$NON-NLS-1$ default : return LaTeXDrawLang.getOthersString("LaTeXDrawException.invException"); //$NON-NLS-1$ } } } latexdraw-2.0.8+1.orig/latexDraw/util/LaTeXDrawCursor.java0000644000000000000000000000351711347255510020252 0ustar package latexDraw.util; import java.awt.Cursor; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Toolkit; import java.awt.image.BufferedImage; import java.net.URL; import javax.swing.ImageIcon; /** * This class contains defined several cursors using in LaTeXDraw.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 11/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    * @since 1.9
    */ public abstract class LaTeXDrawCursor { public static final Cursor ROTATE_CURSOR = getCursor("/res/cursors/RotCWDown.gif", "rotate");//$NON-NLS-1$//$NON-NLS-2$ /** * Create a cursor define by the picture corresponding to the path. * @param path The path of the picture of the cursor. * @param name The name which will be given to the cursor. * @return The created cursor. * @since 1.9 */ public static Cursor getCursor(String path, String name) { BufferedImage bi = new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB); Graphics2D graphic = (Graphics2D)bi.getGraphics(); URL url = LaTeXDrawCursor.class.getClass().getResource(path); ImageIcon img = new ImageIcon(url); graphic.drawImage(img.getImage(), null, null); return Toolkit.getDefaultToolkit().createCustomCursor(bi,new Point(0,0), name); } } latexdraw-2.0.8+1.orig/latexDraw/util/LFileUtils.java0000644000000000000000000000516411347255510017275 0ustar package latexDraw.util; import java.io.*; /** * Defines some workarounds to deal with the problem of the renameto function. * The renameto function cannot rename a file from one filesystem to one other.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2009 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/22/09
    * @author Arnaud BLOUIN
    * @version 2.0.5
    */ public class LFileUtils { /** * Copies a file. * The renameTo method does not allow action across NFS mounted filesystems * this method is the workaround * @param fromFile The existing File * @param toFile The new File * @return true if and only if the renaming succeeded; * false otherwise */ public final static boolean copy(File fromFile, File toFile) { if(fromFile==null || toFile==null) return false; try { FileInputStream in = new FileInputStream(fromFile); FileOutputStream out = new FileOutputStream(toFile); BufferedInputStream inBuffer = new BufferedInputStream(in); BufferedOutputStream outBuffer = new BufferedOutputStream(out); int theByte = 0; while ((theByte = inBuffer.read()) > -1) { outBuffer.write(theByte); } outBuffer.close(); inBuffer.close(); out.close(); in.close(); // cleanup if files are not the same length if(fromFile.length() != toFile.length()) { toFile.delete(); return false; } return true; } catch(IOException e) { return false; } } /** * Moves a file. * The renameTo method does not allow action across NFS mounted filesystems * this method is the workaround * @param fromFile The existing File * @param toFile The new File * @return true if and only if the renaming succeeded; * false otherwise */ public final static boolean move(File fromFile, File toFile) { if(fromFile==null || toFile==null) return false; if(fromFile.renameTo(toFile)) return true; // delete if copy was successful, otherwise move will fail if(copy(fromFile, toFile)) return fromFile.delete(); return false; } } latexdraw-2.0.8+1.orig/latexDraw/lang/0000755000000000000000000000000011347255510014354 5ustar latexdraw-2.0.8+1.orig/latexDraw/lang/LaTeXDrawLang.java0000644000000000000000000002521711347255510017623 0ustar package latexDraw.lang; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.io.ObjectInputStream; import java.util.MissingResourceException; import java.util.ResourceBundle; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.ui.dialog.PreferencesFrame; import latexDraw.util.LaTeXDrawException; import latexDraw.util.LaTeXDrawNamespace; import latexDraw.util.LaTeXDrawPath; /** * This class defines the localisation.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 09/01/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public abstract class LaTeXDrawLang { /** The name of the file where preferences are saved */ public static final String PREF_FILENAME = ".preferences";//$NON-NLS-1$ public static final String LANG_EN = "English";//$NON-NLS-1$ public static final String LANG_EN_US = "English-US";//$NON-NLS-1$ public static final String LANG_FR = "Français";//$NON-NLS-1$ public static final String LANG_ES = "Español";//$NON-NLS-1$ public static final String LANG_DE = "Deutsch";//$NON-NLS-1$ public static final String LANG_IT = "Italiano";//$NON-NLS-1$ public static final String LANG_PL = "Język polski";//$NON-NLS-1$ public static final String LANG_TR = "Türkçe";//$NON-NLS-1$ public static final String MISSING_KEY = "missingKey";//$NON-NLS-1$ private static String langCurrent = readLang(); public static final String TOKEN_LANG_EN = "lang.en";//$NON-NLS-1$ public static final String TOKEN_LANG_EN_US = "lang.en-US";//$NON-NLS-1$ public static final String TOKEN_LANG_FR = "lang.fr";//$NON-NLS-1$ public static final String TOKEN_LANG_ES = "lang.es";//$NON-NLS-1$ public static final String TOKEN_LANG_DE = "lang.de";//$NON-NLS-1$ public static final String TOKEN_LANG_IT = "lang.it";//$NON-NLS-1$ public static final String TOKEN_LANG_PL = "lang.pl";//$NON-NLS-1$ public static final String TOKEN_LANG_TR = "lang.tr";//$NON-NLS-1$ public static final String LANG_DEFAULT = LANG_EN; private static ResourceBundle resourceBundleLaTeXDrawFrame = ResourceBundle.getBundle( LaTeXDrawLang.getTokenLang()+".LaTeXDrawFrame");//$NON-NLS-1$ private static ResourceBundle resourceBundleDialogFrame = ResourceBundle.getBundle( LaTeXDrawLang.getTokenLang()+".dialogFrames");//$NON-NLS-1$ private static ResourceBundle resourceBundleOthers = ResourceBundle.getBundle( LaTeXDrawLang.getTokenLang()+".others"); //$NON-NLS-1$ private static ResourceBundle resourceBundle1_6 = ResourceBundle.getBundle( LaTeXDrawLang.getTokenLang()+".1_6"); //$NON-NLS-1$ private static ResourceBundle resourceBundle1_7 = ResourceBundle.getBundle( LaTeXDrawLang.getTokenLang()+".1_7"); //$NON-NLS-1$ private static ResourceBundle resourceBundle1_8 = ResourceBundle.getBundle( LaTeXDrawLang.getTokenLang()+".1_8"); //$NON-NLS-1$ private static ResourceBundle resourceBundle1_9 = ResourceBundle.getBundle( LaTeXDrawLang.getTokenLang()+".1_9"); //$NON-NLS-1$ /** * Allows to get a string of the others components * @param key The key of the string * @return The string */ public static String getOthersString(String key) { try { return resourceBundleOthers.getString(key); } catch(MissingResourceException e) { return '!' + key + '!'; } catch(NullPointerException e) { return '!' + MISSING_KEY + '!'; } } /** * Allows to get a string of the LaTeXDrawFrame * @param key The key of the string * @return The string */ public static String getStringLaTeXDrawFrame(String key) { try { return resourceBundleLaTeXDrawFrame.getString(key); } catch(MissingResourceException e) { return '!' + key + '!'; } catch(NullPointerException e) { return '!' + MISSING_KEY + '!'; } } /** * Allows to get a string of the new 1.6 strings. * @param key The key of the string. * @return The string. */ public static String getString1_6(String key) { try { return resourceBundle1_6.getString(key); } catch(MissingResourceException e) { return '!' + key + '!'; } catch(NullPointerException e) { return '!' + MISSING_KEY + '!'; } } /** * Allows to get a string of the new 1.7 strings. * @param key The key of the string. * @return The string. * @since 1.7 */ public static String getString1_7(String key) { try { return resourceBundle1_7.getString(key); } catch(MissingResourceException e) { return '!' + key + '!'; } catch(NullPointerException e) { return '!' + MISSING_KEY + '!'; } } /** * Allows to get a string of the new 1.8 strings. * @param key The key of the string. * @return The string. * @since 1.8 */ public static String getString1_8(String key) { try { return resourceBundle1_8.getString(key); } catch(MissingResourceException e) { return '!' + key + '!'; } catch(NullPointerException e) { return '!' + MISSING_KEY + '!'; } } /** * Allows to get a string of the new 1.8 strings. * @param key The key of the string. * @return The string. * @since 1.8 */ public static String getString1_9(String key) { try { return resourceBundle1_9.getString(key); } catch(MissingResourceException e) { return '!' + key + '!'; } catch(NullPointerException e) { return '!' + MISSING_KEY + '!'; } } /** * Allows to get a string of the dialog frames. * @param key The key of the string. * @return The string. */ public static String getDialogFrameString(String key) { try { return resourceBundleDialogFrame.getString(key); } catch (MissingResourceException e) { return '!' + key + '!'; } catch(NullPointerException e) { return '!' + MISSING_KEY + '!'; } } /** * Allows to get the language of the program.
    * @return The language. */ public static String readLang() { try { File xml = new File(LaTeXDrawPath.PATH_PREFERENCES_XML_FILE); if(xml.exists()) { DocumentBuilderFactory fabrique = DocumentBuilderFactory.newInstance(); DocumentBuilder constructeur = fabrique.newDocumentBuilder(); Document document = constructeur.parse(xml); Node n = document.getFirstChild(); NodeList nl; if(n==null || !n.getNodeName().equals(LaTeXDrawNamespace.XML_ROOT_PREFERENCES)) throw new NullPointerException(); nl = n.getChildNodes(); for(int i=0, size=nl.getLength() ; i *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version.
    *
    * LaTeXDraw is distributed without any warranty; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details.
    *
    * 05/08/06
    * @author Arnaud BLOUIN
    * @since 1.7 */ public class FramedBox implements Cloneable, Serializable { private static final long serialVersionUID = 1L; /** The text of the box. */ protected Text text; /** Define the separation between the text and the box (in pixels). */ protected double frameSep; /** The box. */ protected Figure box; /** Define if the box can be drawn of the text before and after the framed text. */ protected boolean boxSep; /** The position of the beginning of the box in the string text of the class Text. */ protected int start; /** The type of the box: rectangle, circle, ellipse, triangle or rhombus. */ protected int boxType; /** The position of the end of the box in the string text of the class Text. */ protected int end; protected transient Vector textPosition; /** The box will be a rectangle. */ public static final short BOX_RECTANGLE = 0; /** The box will be a circle. */ public static final short BOX_CIRCLE = 1; /** The box will be an ellipse. */ public static final short BOX_ELLIPSE = 2; /** The box will be a triangle. */ public static final short BOX_TRIANGLE = 3; /** The box will be a diamond. */ public static final short BOX_DIAMOND = 4; public FramedBox(Text text) { this(text, PSTricksConstants.DEFAULT_FRAME_SEP*Figure.PPC, BOX_RECTANGLE, PSTricksConstants.DEFAULT_BOX_SEP, -1, -1); } /** * The constructor. * @param frameSep The size of the separation between the text and the borders (in pixels). */ public FramedBox(Text text, double frameSep, short type, boolean boxSep, int start, int end) { super(); this.text = text; this.frameSep = frameSep; this.boxSep = boxSep; this.start = start; this.end = end; textPosition = new Vector(); setBoxType(type); } /** * Allows to know if the argument type is a valid kind of box. * @param type The type to check. * @return True if type is a valid kind of box. */ public static boolean isValidBoxType(short type) { return type==BOX_CIRCLE || type==BOX_ELLIPSE || type==BOX_RECTANGLE || type==BOX_TRIANGLE || type==BOX_DIAMOND; } /** * Allows to update the size of the box. */ public synchronized void updateBoxSize() { double x1; double x2; double y1; double y2; if(text.text.length()==0) return; text.updateFontsBorders(); LaTeXDrawPoint2D position = text.getPosition(); TextLayout tl = new TextLayout(text.text, text.currentFont, text.fontRenderContext); Rectangle2D bounds = tl.getBounds(); x1 = position.x+bounds.getX()-frameSep; x2 = position.x+bounds.getWidth()+bounds.getX()+frameSep; y1 = bounds.getY()+position.y-frameSep; y2 = position.y+bounds.getHeight()+bounds.getY()+frameSep; if(start>=0 && end>0 && end<=text.text.length()) { if(start>0) x1 += text.fontMetrics.stringWidth(text.text.substring(0, start)); x2 -= text.fontMetrics.stringWidth(text.text.substring(end)); } LaTeXDrawRectangle r = box.getBorders(); if(boxType==BOX_CIRCLE) { double cgX = (x1+x2)/2., cgY = (y1+y2)/2.; double radius = Math.max(Math.abs(x1-x2), Math.abs(y1-y2))/2.; r.getPoint(0).setLocation(cgX-radius, cgY-radius); r.getPoint(-1).setLocation(cgX+radius, cgY+radius); r.getPoint(1).setLocation(cgX+radius, cgY-radius); r.getPoint(2).setLocation(cgX-radius, cgY+radius); ((Square)r).setWidth(radius*2); } else { r.setFirstPoint(x1, y1); r.setLastPoint(x2, y2); r.updateGravityCenter(); if(boxType==BOX_ELLIPSE) { double gap = (bounds.getMaxX() - bounds.getMinX())*0.5; r.setFirstPoint(r.getTheNWPoint().x-gap/2., r.getTheNWPoint().y); r.setLastPoint(r.getTheSEPoint().x+gap/2., r.getTheSEPoint().y); } else { LaTeXDrawPoint2D cg = r.getGravityCenter(); double height = y2-y1, width = x2-x1; if(boxType==BOX_DIAMOND) { double g = box.getThickness()*0.707; double g2 = frameSep/2.; box.setBordersPosition(PSTricksConstants.BORDERS_INSIDE); r.setFirstPoint(cg.x-width-g*2+g2, cg.y-height-g*2.+g2); r.setLastPoint(cg.x+width+g*2-g2, cg.y+height+g*2.-g2); } else if(boxType==BOX_TRIANGLE) { double g = box.getThickness()*0.85; box.setBordersPosition(PSTricksConstants.BORDERS_INSIDE); r.setFirstPoint(cg.x-width-g*2, cg.y-(height*3.)/2.-box.getThickness()*2+frameSep); r.setLastPoint(cg.x+width+g*2, cg.y+height/2.+box.getThickness()); } } } box.updateShape(); } /** * @return the box */ public synchronized Figure getBox() { return box; } /** * @param box the box to set (must be a circle, an ellipse, a rectangle, a rhombus or a triangle). */ public synchronized void setBox(Figure box) { if(box==null) return ; this.box = box; if(box instanceof LaTeXDrawRectangle) setBoxType(BOX_RECTANGLE); else if(box instanceof Rhombus) setBoxType(BOX_DIAMOND); else if(box instanceof Triangle) setBoxType(BOX_TRIANGLE); else if(box instanceof Ellipse) setBoxType(BOX_ELLIPSE); else if(box instanceof Circle) setBoxType(BOX_CIRCLE); } /** * @return the boxSep */ public synchronized boolean isBoxSep() { return boxSep; } /** * @param boxSep the boxSep to set */ public synchronized void setBoxSep(boolean boxSep) { this.boxSep = boxSep; text.hasChanged = true; } /** * @return the frameSep */ public synchronized double getFrameSep() { return frameSep; } /** * @param frameSep the frameSep to set */ public synchronized void setFrameSep(double frameSep) { this.frameSep = frameSep; text.hasChanged = true; } /** * @return the text */ public synchronized Text getText() { return text; } /** * @param text the text to set */ public synchronized void setText(Text text) { this.text = text; text.hasChanged = true; } /** * @return the end */ public synchronized int getEnd() { return end; } /** * @param end the end to set */ public synchronized void setEnd(int end) { this.end = end; text.hasChanged = true; } /** * @return the start */ public synchronized int getStart() { return start; } /** * @param start the start to set */ public synchronized void setStart(int start) { this.start = start; text.hasChanged = true; } /** * @return the boxType */ public synchronized int getBoxType() { return boxType; } /** * @param type the boxType to set. */ public synchronized void setBoxType(short type) { if(!isValidBoxType(type)) return; if(type!=boxType||box==null) { boxType = type; if(box==null) switch(boxType) { case BOX_CIRCLE: box = new Circle(true); break; case BOX_ELLIPSE: box = new Ellipse(true); break; case BOX_RECTANGLE: box = new LaTeXDrawRectangle(true); break; case BOX_TRIANGLE: box = new Triangle(true); break; case BOX_DIAMOND: box = new Rhombus(true); break; default: throw new IllegalArgumentException("Invalid kind of box.");//$NON-NLS-1$ } else switch(boxType) { case BOX_CIRCLE: box = new Circle(box, true); break; case BOX_ELLIPSE: box = new Ellipse(box, true); break; case BOX_RECTANGLE: box = new LaTeXDrawRectangle(box, true); break; case BOX_TRIANGLE: box = new Triangle(box, true); break; case BOX_DIAMOND: box = new Rhombus(box, true); break; default: throw new IllegalArgumentException("Invalid kind of box.");//$NON-NLS-1$ } box.setBordersPosition(PSTricksConstants.BORDERS_OUTSIDE); if(text.hasSeveralBoxes()) text.updateFramedBoxes(); else updateBoxSize(); } text.hasChanged = true; } /** * Draw the framed box. */ public void draw(Graphics2D g, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering) { if(getBox()!=null) getBox().draw(g, antiAlias, rendering, alphaInter, colorRendering); } /** * @return The PSTricks code of the framed box. */ public synchronized String getCodePSTricks(DrawBorders drawBorders, float ppc) { String cmdName = getCodeHeadPSTricks(drawBorders, ppc); cmdName += '{'+getBoxedText()+'}'; return cmdName; } /** * @return The boxed text. */ public synchronized String getBoxedText() { int e, s; if(end<0||start<0||end==start||end>text.text.length()) { e = text.text.length(); s = 0; } else { s = start; e = end; } return text.getText().substring(s, e); } /** * @return The beginning of the code (ex. \psframe[....] instead of psframe[...]{...} of the method getCode. */ public synchronized String getCodeHeadPSTricks(DrawBorders drawBorders, float ppc) { if(box==null) return "";//$NON-NLS-1$ String boxCode = box.getCodePSTricks(drawBorders, ppc); String boxParams = "";//$NON-NLS-1$ int i = boxCode.indexOf('['); if(i!=-1) { int j = boxCode.indexOf(']', i); if(j==-1) throw new IndexOutOfBoundsException(); boxParams = boxCode.substring(i+1, j); boxParams = boxParams.replace(",dimen=inner", "");//$NON-NLS-1$//$NON-NLS-2$ boxParams = boxParams.replace(",dimen=middle", "");//$NON-NLS-1$//$NON-NLS-2$ boxParams = boxParams.replace(",dimen=outer", "");//$NON-NLS-1$//$NON-NLS-2$ } String cmdName; switch(boxType) { case BOX_RECTANGLE: cmdName = "\\psframebox";//$NON-NLS-1$ break; case BOX_ELLIPSE: cmdName = "\\psovalbox";//$NON-NLS-1$ break; case BOX_CIRCLE: cmdName = "\\pscirclebox";//$NON-NLS-1$ break; case BOX_DIAMOND: cmdName = "\\psdiabox";//$NON-NLS-1$ break; case BOX_TRIANGLE: cmdName = "\\pstribox";//$NON-NLS-1$ break; default: return null; } if(((float)(frameSep/ppc))!=(float)PSTricksConstants.DEFAULT_FRAME_SEP) boxParams += (boxParams.length()>0 ? "," : "")//$NON-NLS-1$//$NON-NLS-2$ +"framesep="+LaTeXDrawNumber.getCutNumber((float)frameSep/ppc,0.0001);//$NON-NLS-1$ if(boxSep!=PSTricksConstants.DEFAULT_BOX_SEP) boxParams += (boxParams.length()>0 ? "," : "")+"boxsep=" //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ +boxSep; if(boxParams.length()>0) cmdName += '['+boxParams+']'; return cmdName; } @Override public Object clone() throws CloneNotSupportedException { FramedBox fb = (FramedBox)super.clone(); fb.boxSep = boxSep; fb.boxType = boxType; fb.box = (Figure)box.clone(); fb.end = end; fb.frameSep = frameSep; fb.start = start; fb.text = text;// We cannot clone the text because the text clones the fb. fb.textPosition = new Vector(); for(TextPosition tp : textPosition) fb.textPosition.add(tp); return fb; } private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { text = null; boxSep = ois.readBoolean(); boxType = ois.readInt(); frameSep = ois.readDouble(); start = ois.readInt(); end = ois.readInt(); box = (Figure)ois.readObject(); textPosition = new Vector(); } /** * @return The borders of the framed box. */ public synchronized LaTeXDrawRectangle getBorders() { return box.getBoundBorders(); } /** * Allows to know if the framed box overlap another framed box. * @return True if the framed box overlap another framed box. */ public synchronized boolean overlap(Vector fbs) { if(fbs==null) return false; boolean ok = true; int i = 0, size = fbs.size(); while(ok&&ifbStart&&start=b.end) return 1; return 0; } @Override public String toString() { if(text==null||text.text==null||text.text.length()==0) return super.toString(); if(start<0||end>text.text.length()) return super.toString(); return text.text.substring(start, end); } /** * @return The PSTricks code of the framed boxes. */ @SuppressWarnings("unchecked") private static String getCode(Vector boxes, FramedBox parent, DrawBorders drawBorders, float ppc) { if(boxes==null||boxes.isEmpty()) { if(parent==null) return "";//$NON-NLS-1$ return parent.getBoxedText(); } boolean valid = true; String code = "";//$NON-NLS-1$ int i = 0, j, size = boxes.size(), k, size2; boolean ok; Vector mainBoxes = new Vector(); for(i = 1; i1) while(imainBoxes.elementAt(k).start) k++; if(k>=size2) mainBoxes.add(fBox); else mainBoxes.add(k, fBox); size = boxes.size(); } else i++; }//while else { FramedBox fb = boxes.remove(0); if((parent!=null && parent.contains(fb)!=0) || parent==null) mainBoxes.add(fb); } if(!mainBoxes.isEmpty()) { int s = parent==null ? 0 : parent.start; for(FramedBox b : mainBoxes) { if(b.start>s && (parent==null || parent.start!=b.start)) code += b.getText().text.substring(s, b.start); code += b.getCodeHeadPSTricks(drawBorders, ppc)+"{" +//$NON-NLS-1$ getCode((Vector)boxes.clone(), b, drawBorders, ppc)+'}'; s = b.end; } FramedBox b = mainBoxes.firstElement(); if(parent!=null && parent.end!=b.end && s-1 multipleBox, DrawBorders drawBorders, float ppc) { Vector boxes = new Vector(); for(FramedBox fb : multipleBox) boxes.add(fb); return getCode(boxes, null, drawBorders, ppc); } /** * Allows to update the dimensions of several boxes with taking account of * each box to others. The method updateTextPosition of the class text must be called before. * @param boxes The boxes to update. */ protected static void updateDimensions(Vector boxes, Text text) { text.updateTextPosition(); if(boxes==null || boxes.isEmpty()) { text.updateBorders(); return ; } Vector bx = new Vector(); Vector done = new Vector(); FramedBox fb; boolean found, ok; int size, i, j; double x1, x2, y1, y2, dec=0; Vector tps; Rectangle2D bounds; TextPosition first, last; LaTeXDrawPoint2D[] NWs = new LaTeXDrawPoint2D[boxes.firstElement().text.text.length()]; LaTeXDrawPoint2D[] SEs = new LaTeXDrawPoint2D[boxes.firstElement().text.text.length()]; Vector nwNotBoxSep = new Vector(); Vector seNotBoxSep = new Vector(); for(FramedBox fb2 : boxes) bx.add(fb2); while(!bx.isEmpty()) { found = false; i = 0; size = bx.size(); // Looking for a box to update. while(!found && i(); for(TextPosition tp2 : text.textPos) if(tp2.start>=fb.start && (tp2.end+1)<=fb.end) tps.add(tp2); TextLayout tl = new TextLayout(text.text.substring(fb.start, fb.end), text.currentFont, text.fontRenderContext); bounds = tl.getBounds(); first = tps.firstElement(); last = first; for(j=1; jlast.end) last = tps.elementAt(j); LaTeXDrawPoint2D SE = null; LaTeXDrawPoint2D NW = null; for(i=fb.start; iNWs[i].y) NW.y = NWs[i].y; if(SEs[i]!=null) if(SE==null) SE = SEs[i]; else if(SE.yn.x) NWs[fb.start].x = n.x; if(NWs[fb.start].y>n.y) NWs[fb.start].y = n.y; } if(SEs[fb.end-1]==null) SEs[fb.end-1]= s; else { if(SEs[fb.end-1].xfb.end) fb2.box.shift(dec, 0); fb2.box.updateShape(); } }//if(fb.isBoxSep()) else { nwNotBoxSep.add(n); seNotBoxSep.add(s); } done.add(fb); fb = null; boolean found2 = false; i = 0; size = bx.size(); while(!found2 && iNWs[i].y) NW.y = NWs[i].y; if(SEs[i]!=null) if(SE==null) SE = SEs[i]; else if(SE.ySE.x) SE.x = pt.x; if(pt.y>SE.y) SE.y = pt.y; } } TextLayout tl = new TextLayout(text.text, text.currentFont, text.fontRenderContext); bounds = tl.getBounds(); first = text.getFirstTextPosition(); last = text.getLastTextPosition(); if(NW==null) text.borders.setFirstPoint(first.pos.x, bounds.getY()+first.pos.y); else if(Double.isNaN(NW.x)) text.borders.setFirstPoint(first.pos.x, NW.y); else text.borders.setFirstPoint(NW); if(SE==null) text.borders.setLastPoint(last.pos.x+text.fontMetrics.stringWidth( text.text.substring(last.start, last.end+1)), first.pos.y+bounds.getHeight()+bounds.getY()); else if(Double.isNaN(SE.x)) text.borders.setLastPoint(last.pos.x+text.fontMetrics.stringWidth( text.text.substring(last.start, last.end+1)), SE.y); else text.borders.setLastPoint(SE); text.gravityCenter = text.borders.getGravityCenter(); text.updateShape(); } /** * @return the textPosition. */ public synchronized Vector getTextPosition() { return textPosition; } /** * @param tp the textPosition to add. */ public synchronized void addTextPosition(TextPosition tp) { textPosition.add(tp); } public synchronized void removeAllTextPosition() { textPosition.removeAllElements(); } public boolean contains(TextPosition tp) { boolean again = true; int i=0, size = textPosition.size(); while(again && i *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class Rhombus extends LaTeXDrawPolygon implements BordersMovable { private static final long serialVersionUID = 1L; /** The number of points of a rhombus */ public static final short NB_POINTS_RHOMBUS = 4; /** * The constructor by default */ public Rhombus(boolean increaseMeter) { this(new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), increaseMeter); } /** * @param f The figure to copy. * @param sameNumber True if the figure will have the same number of the copy. * @throws IllegalArgumentException If f is null. */ public Rhombus(Figure f, boolean sameNumber) { super(f, sameNumber); borders = new LaTeXDrawRectangle(getPoint(0), getPoint(1), getPoint(2), getPoint(3), false); updateGravityCenter(); shape = getInsideOutsideOrMiddleBorders(); updateGravityCenter(); isBordersMovable = true; } /** * The constructor using four points * @param pt1 The top left point of rectangle containing the rhombus * @param pt2 The top right point of the rectangle containing the rhombus * @param pt3 The bottom left point * @param pt4 The bottom right point */ public Rhombus(LaTeXDrawPoint2D pt1, LaTeXDrawPoint2D pt2, LaTeXDrawPoint2D pt3, LaTeXDrawPoint2D pt4, boolean increaseMeter) { super(pt1, pt2, pt3, pt4, increaseMeter); borders = new LaTeXDrawRectangle(pt1, pt2, pt3, pt4, false); shape = getInsideOutsideOrMiddleBorders(); updateGravityCenter(); isBordersMovable = true; } @Override public boolean addPoint(LaTeXDrawPoint2D pt) { if(pts==null) pts = new Vector(); if(pt!=null) { Delimitor d = new Delimitor(pt); d.setColorSet3(); delimiters.add(d); pts.add(pt); return true; } return false; } @Override public void draw(Graphics2D g, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering) { LaTeXDrawPoint2D NW = borders.getTheNWPoint(), SE = borders.getTheSEPoint(); double cx = (NW.x+SE.x)/2., cy = (NW.y+SE.y)/2.; double c2x = Math.cos(rotationAngle)*cx - Math.sin(rotationAngle)*cy; double c2y = Math.sin(rotationAngle)*cx + Math.cos(rotationAngle)*cy; double c3x = Math.cos(-rotationAngle)*(cx-c2x) - Math.sin(-rotationAngle)*(cy-c2y); double c3y = Math.sin(-rotationAngle)*(cx-c2x) + Math.cos(-rotationAngle)*(cy-c2y); double dx=0, dy=0; boolean changeFillStyle = false; if(rotationAngle%(Math.PI*2)!=0) { g.rotate(rotationAngle); g.translate(c3x,c3y); } if(hasShadow) { LaTeXDrawPoint2D cg = getGravityCenter(); LaTeXDrawPoint2D shadowCg = (LaTeXDrawPoint2D)cg.clone(); shadowCg.setLocation(cg.x+shadowSize, cg.y); shadowCg = Figure.rotatePoint(shadowCg, cg, shadowAngle); dx = shadowCg.x-cg.x; dy = cg.y-shadowCg.y; } Color formerCol = g.getColor(); if(hasDoubleBoundary) { Shape s0 = shape; Shape s[] = getDbleBoundariesOutInOrMiddle(s0); Shape s1, s2, s3; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) { s1 = s0; s2 = s[0]; s3 = s[1]; } else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) { s1 = s[0]; s2 = s0; s3 = s[1]; } else { s1 = s[0]; s2 = s[1]; s3 = s0; } if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) { if(hasShadow) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.fill(s1); g.draw(s1); g.translate(-dx, -dy); if(!isFilled) { changeFillStyle = true; isFilled = true; } } g.setColor(doubleColor); g.setStroke(new BasicStroke((float)(doubleSep + thickness), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.draw(s2); fillFigure(g, antiAlias, rendering, alphaInter, colorRendering, s3); g.setColor(linesColor); g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.draw(s1); g.draw(s3); } else { if(hasShadow) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.fill(s1); g.draw(s1); g.translate(-dx, -dy); g.setColor(interiorColor); g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.draw(s2); if(!isFilled) { changeFillStyle = true; isFilled = true; } } if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[] { 0, (float)(thickness*2+doubleSep + dotSep) }, 0)); else g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[] { blackDashLength, whiteDashLength }, 0)); fillFigure(g, antiAlias, rendering, alphaInter, colorRendering, s2); g.setColor(linesColor); g.draw(s2); g.setStroke(new BasicStroke((float)doubleSep, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.setColor(doubleColor); g.draw(s2); } } else { if(hasShadow) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.fill(shape); g.draw(shape); g.translate(-dx, -dy); if(!isFilled) { changeFillStyle = true; isFilled = true; } g.setColor(interiorColor); g.draw(shape); } if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); else if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE) ) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[] { 0, thickness + dotSep }, 0)); } else g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[] { blackDashLength, whiteDashLength }, 0)); fillFigure(g, antiAlias, rendering, alphaInter, colorRendering,shape); g.setColor(linesColor); g.draw(shape); } g.setColor(formerCol); if(changeFillStyle) isFilled = false; if(rotationAngle%(Math.PI*2)!=0) { g.translate(-c3x, -c3y); g.rotate(-rotationAngle); } if(isSelected) borders.draw(g, false, antiAlias, rendering, alphaInter, colorRendering); } /** * Allows to get the south-east point by taking into account * the angle of rotation. * @return The south-east point of the rotated rectangle */ @Override public LaTeXDrawPoint2D getTheSERotatedPoint() { if(borders!=null) return borders.getTheSERotatedPoint(); return null; } /** * Allows to get the north-west point by taking into account * the angle of rotation. * @return The north-west point of the rotated rectangle */ @Override public LaTeXDrawPoint2D getTheNWRotatedPoint() { if(borders!=null) return borders.getTheNWRotatedPoint(); return null; } @Override public synchronized void setBordersPosition(String doubleLinePosition) { super.setBordersPosition(doubleLinePosition); shape = getInsideOutsideOrMiddleBorders(); } @Override public synchronized void setLastPoint(LaTeXDrawPoint2D pt) { borders.setLastPoint(pt); updateGravityCenter(); shape = getInsideOutsideOrMiddleBorders(); } @Override public synchronized void setFirstPoint(LaTeXDrawPoint2D pt) { borders.setFirstPoint(pt); updateGravityCenter(); shape = getInsideOutsideOrMiddleBorders(); } @Override public synchronized void setRotationAngle(double theta) { if(!Double.isNaN(theta) && !Double.isInfinite(theta)) { rotationAngle = theta%(Math.PI*2); if(borders!=null) borders.setRotationAngle(rotationAngle); } } @Override public void onDragged(Point formerPt, Point newPt) throws Exception { if(formerPt.equals(newPt)) return; borders.onDragged(formerPt, newPt); rotationAngle = borders.getRotationAngle();//update the angle(when rotation) updateGravityCenter();//update centre of gravity when reshaping shape = getInsideOutsideOrMiddleBorders(); } @Override public synchronized String getCodePSTricks(DrawBorders drawBorders, float ppc) { LaTeXDrawPoint2D d = drawBorders.getOriginPoint(); LaTeXDrawPoint2D pt1 = borders.getPoint(0), pt2 = borders.getPoint(1); LaTeXDrawPoint2D pt3 = borders.getPoint(2); double Xcenter = (pt1.x+pt2.x)/2. - d.x, Ycenter = d.y - (pt1.y+pt3.y)/2.; String add="", fillType=""; //$NON-NLS-1$ //$NON-NLS-2$ boolean isFilledWasChanged = false; double threshold = 0.0001; if(hasShadow) { fillType+=",shadow=true";//$NON-NLS-1$ if((Math.toDegrees(shadowAngle)-Math.toDegrees(rotationAngle))!=PSTricksConstants.DEFAULT_SHADOW_ANGLE) fillType+=",shadowangle="+(float)(Math.toDegrees(shadowAngle)-Math.toDegrees(rotationAngle));//$NON-NLS-1$ if(((float)shadowSize)!=((float)DEFAULT_SHADOW_SIZE)) fillType+=",shadowsize="+LaTeXDrawNumber.getCutNumber((float)(shadowSize/PPC),threshold);//$NON-NLS-1$ if(!shadowColor.equals(PSTricksConstants.DEFAULT_SHADOW_COLOR)) { String name = DviPsColors.getColourName(shadowColor); if(name==null) { name = "color"+number+'e';//$NON-NLS-1$ DviPsColors.addUserColour(shadowColor, name); } add += ",shadowcolor=" + name; //$NON-NLS-1$ } if(!isFilled) { isFilled = true; isFilledWasChanged = true; } } String str = getPSTricksCodeFilling(ppc); if(str.length()>0) fillType=fillType+','+str; str = getPSTricksCodeLine(ppc); if(str.length()>0) add=add+','+str; add+=",dimen="+bordersPosition; //$NON-NLS-1$ if(hasDoubleBoundary) { add+=",doubleline=true,doublesep="+LaTeXDrawNumber.getCutNumber((float)(doubleSep/ppc),threshold); //$NON-NLS-1$ if(doubleColor!=PSTricksConstants.DEFAULT_DOUBLE_COLOR) { String name = DviPsColors.getColourName(doubleColor); if(name==null) { name = "color"+number+'d';//$NON-NLS-1$ DviPsColors.addUserColour(doubleColor, name); } add+= ",doublecolor="+name; //$NON-NLS-1$ } } if(rotationAngle%(Math.PI*2)!=0) add+=",gangle="+(float)Math.toDegrees(-rotationAngle);//$NON-NLS-1$ if(isFilledWasChanged) isFilled = false; return "\\psdiamond[linewidth=" + LaTeXDrawNumber.getCutNumber((thickness/ppc),threshold) + //$NON-NLS-1$ add + fillType + "](" + LaTeXDrawNumber.getCutNumber((float)(Xcenter/ppc),threshold) + ',' + //$NON-NLS-1$ LaTeXDrawNumber.getCutNumber((float)(Ycenter/ppc),threshold) + ")(" //$NON-NLS-1$ + LaTeXDrawNumber.getCutNumber((float)((Math.abs(pt1.x-pt2.x)/2.)/ppc),threshold) + ',' + LaTeXDrawNumber.getCutNumber((float)((Math.abs(pt1.y-pt3.y)/2.)/ppc),threshold) + ')'; } @Override public boolean isIn(LaTeXDrawPoint2D p) { LaTeXDrawPoint2D pt = rotateInvertPoint(p); if(isSelected && (borders.dNE.isIn(pt) || borders.dNW.isIn(pt) || borders.dSE.isIn(pt) || borders.dSW.isIn(pt) || borders.dS.isIn(pt) || borders.dN.isIn(pt) || borders.dE.isIn(pt) || borders.dW.isIn(pt))) return true; GeneralPath gp; if(hasDoubleBoundary) { if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) gp = getBorders(0, true); else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) gp = getBorders(thickness*2+doubleSep, false); else gp = getBorders((thickness*2+doubleSep)*2, false); if(!gp.contains(pt)) return false; if(isFilled || hasShadow || hasGradient()) return true; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) gp = getBorders((thickness*2+doubleSep)*2, true); else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) gp = getBorders(doubleSep+2*thickness, true); else gp = getBorders(0, true); } else { if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) gp = getBorders(0, true); else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) gp = getBorders(thickness, false); else gp = getBorders(thickness*2, false); if(!gp.contains(pt)) return false; if(isFilled || hasShadow || hasGradient()) return true; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) gp = getBorders(thickness*2, true); else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) gp = getBorders(thickness, true); else gp = getBorders(0, true); } return !gp.contains(pt); } @Override public Object clone() throws CloneNotSupportedException { Rhombus r = (Rhombus) super.clone(); r.borders = new LaTeXDrawRectangle(r.getPoint(0), r.getPoint(1), r.getPoint(2), r.getPoint(3), false); r.setThickness(thickness); r.updateShape(); return r; } @Override public Shape createShape2D() { LaTeXDrawPoint2D NW = getTheNWPoint(), SE = getTheSEPoint(); Shape area = createNonRotatedShape2D(); if(rotationAngle % (Math.PI*2) != 0.) { double cx = (NW.x + SE.x) / 2., cy = (NW.y + SE.y) / 2.; double c2x = Math.cos(rotationAngle) * cx - Math.sin(rotationAngle)* cy; double c2y = Math.sin(rotationAngle) * cx + Math.cos(rotationAngle)* cy; AffineTransform at = AffineTransform.getTranslateInstance(cx - c2x, cy - c2y); at.rotate(rotationAngle); area = at.createTransformedShape(area); } return area; } @Override public Shape createNonRotatedShape2D() { Shape area; Shape s = getInsideOutsideOrMiddleBorders(); if(hasDoubleBoundary) { Shape[] s2 = getDbleBoundariesOutInOrMiddle(s); Shape min; Shape max; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) { max = s; min = s2[1]; } else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) { max = s2[0]; min = s2[1]; } else { max = s2[0]; min = s; } area = new Area(max); ((Area)area).exclusiveOr(new Area(min)); } else area = s; return area; } @SuppressWarnings("unchecked") private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { canHaveShadow = true; interiorColor = (Color) ois.readObject(); lineStyle = (String) ois.readObject(); rotationAngle = ois.readDouble(); thickness = ois.readFloat(); isFilled = ois.readBoolean(); isSelected = ois.readBoolean(); isOnRotation = ois.readBoolean(); linesColor = (Color) ois.readObject(); blackDashLength = ois.readFloat(); dotSep = ois.readFloat(); whiteDashLength = ois.readFloat(); pts = (Vector) ois.readObject(); borders = (LaTeXDrawRectangle) ois.readObject(); delimiters = new Vector(); for(int i=0, size = pts.size();i=0)//$NON-NLS-1$ { hasDoubleBoundary = ois.readBoolean(); doubleColor = (Color)ois.readObject(); doubleSep = ois.readDouble(); bordersPosition = (String)ois.readObject(); if(!(LaTeXDrawFrame.getVersionOfFile().compareTo("1.6")>=0)) //$NON-NLS-1$ ois.readBoolean(); hatchingAngle = ois.readDouble(); hatchingColor = (Color)ois.readObject(); hatchingStyle = (String)ois.readObject(); hatchingWidth = ois.readFloat(); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.6") < 0)//$NON-NLS-1$ { if(hatchingStyle.equals(DECREPETED_FILL_CROSS)) hatchingStyle = PSTricksConstants.TOKEN_FILL_CROSSHATCH; else if(hatchingStyle.equals(DECREPETED_FILL_HORIZ)) hatchingStyle = PSTricksConstants.TOKEN_FILL_HLINES; else if(hatchingStyle.equals(DECREPETED_FILL_VERT)) hatchingStyle = PSTricksConstants.TOKEN_FILL_VLINES; else if(hatchingStyle.equals(DECREPETED_FILL_NO)) hatchingStyle = PSTricksConstants.TOKEN_FILL_NONE; } } else { hasDoubleBoundary = DEFAULT_HAS_DOUBLE_BOUNDARY; doubleColor = DEFAULT_DOUBLE_COLOR; doubleSep = DEFAULT_DOUBLESEP; bordersPosition = DEFAULT_BORDERS_POSITION; hatchingAngle = DEFAULT_HATCH_ANGLE; hatchingColor = DEFAULT_HATCH_COL; hatchingStyle = DEFAULT_HATCH_STYLE; hatchingWidth = DEFAULT_HATCH_WIDTH; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.7")>=0) //$NON-NLS-1$ { hasShadow = ois.readBoolean(); shadowAngle = ois.readDouble(); shadowSize = ois.readDouble(); shadowColor = (Color)ois.readObject(); gradientEndColor = (Color)ois.readObject(); gradientStartColor = (Color)ois.readObject(); gradientAngle = ois.readDouble(); gradientMidPoint = ois.readDouble(); } else { hasShadow = DEFAULT_SHADOW_HAS; shadowAngle = DEFAULT_SHADOW_ANGLE; shadowSize = DEFAULT_SHADOW_SIZE; shadowColor = DEFAULT_SHADOW_COLOR; gradientEndColor = PSTricksConstants.DEFAULT_GRADIENT_END_COLOR; gradientStartColor = PSTricksConstants.DEFAULT_GRADIENT_START_COLOR; gradientAngle = DEFAULT_GRADIENT_ANGLE; gradientMidPoint = DEFAULT_GRADIENT_MID_POINT; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.8")>=0) //$NON-NLS-1$ hatchingSep = ois.readDouble(); else hatchingSep = DEFAULT_HATCH_SEP; shape = getInsideOutsideOrMiddleBorders(); } @Override protected GeneralPath getBorders(double gap, boolean into) { if(gap==0.) return getMiddleBorders(); LaTeXDrawPoint2D pt1 = getPoint(0), pt2 = getPoint(-1); GeneralPath gp = new GeneralPath(); if(pt1.xpt2.x-thickness) { gp.moveTo((float)(pt1.x+pt2.x)/2f, (float)pt1.y); gp.lineTo((float)(pt1.x+pt2.x)/2f, (float)pt2.y); } else if(pt1.ypt2.y-thickness) { gp.moveTo((float)pt1.x, (float)(pt1.y+pt2.y)/2f); gp.lineTo((float)pt2.x, (float)(pt1.y+pt2.y)/2f); } else { if(!into) gap*=-1; LaTeXDrawPoint2D gc = getGravityCenter(); LaTeXDrawPoint2D p1 = new LaTeXDrawPoint2D((pt1.x+pt2.x)/2., pt1.y); LaTeXDrawPoint2D p2 = new LaTeXDrawPoint2D(pt2.x, (pt1.y+pt2.y)/2.); LaTeXDrawPoint2D p3 = new LaTeXDrawPoint2D((pt1.x+pt2.x)/2., pt2.y); double cornerGap1 = getCornerGap(gc, p1, p2, gap)/2.; double cornerGap2 = getCornerGap(gc, p2, p3, gap)/2.; if(p2.xp2.y) cornerGap1*=-1; gp.moveTo((float)p1.x, (float)(pt1.y + cornerGap1)); gp.lineTo((float)(pt2.x - cornerGap2), (float)p2.y); gp.lineTo((float)p1.x, (float)(pt2.y - cornerGap1)); gp.lineTo((float)(pt1.x + cornerGap2), (float)p2.y); gp.closePath(); } return gp; } public GeneralPath getInsideBorders() { return getBorders(thickness, true); } public GeneralPath getOutsideBorders() { return getBorders(thickness, false); } public GeneralPath getMiddleBorders() { LaTeXDrawPoint2D pt1 = getPoint(0), pt2 = getPoint(-1); GeneralPath path = new GeneralPath(); path.moveTo((float)(pt1.x+pt2.x)/2f, (float)pt2.y); path.lineTo((float)pt1.x, (float)(pt2.y+pt1.y)/2f); path.lineTo((float)(pt1.x+pt2.x)/2f, (float)pt1.y); path.lineTo((float)pt2.x, (float)(pt2.y+pt1.y)/2f); path.closePath(); return path; } @Override public GeneralPath getInsideOutsideOrMiddleBorders() { GeneralPath path; if (bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) path = getInsideBorders(); else if (bordersPosition.equals(PSTricksConstants.BORDERS_OUTSIDE)) path = getOutsideBorders(); else path = getMiddleBorders(); return path; } @Override public GeneralPath[] getDbleBoundariesOutside(Shape classicBord) { LaTeXDrawPoint2D pt1 = getPoint(0), pt2 = getPoint(-1); GeneralPath[] sx = new GeneralPath[2]; if(pt1.xpt2.x-thickness) { sx[0] = new GeneralPath(classicBord); sx[1] = new GeneralPath(classicBord); } else { sx[0] = getBorders(3*thickness+2*doubleSep, false); sx[1] = getBorders(2*thickness+doubleSep, false); } return sx; } @Override public GeneralPath[] getDbleBoundariesInside(Shape classicBord) { LaTeXDrawPoint2D pt1 = getPoint(0), pt2 = getPoint(-1); GeneralPath[] sx = new GeneralPath[2]; if(pt1.xpt2.x-thickness) { sx[0] = new GeneralPath(classicBord); sx[1] = new GeneralPath(classicBord); } else { sx[1] = getBorders(3*thickness+2*doubleSep, true); sx[0] = getBorders(2*thickness+doubleSep, true); } return sx; } @Override public GeneralPath[] getDbleBoundariesMiddle(Shape classicBord) { LaTeXDrawPoint2D pt1 = getPoint(0), pt2 = getPoint(-1); GeneralPath[] sx = new GeneralPath[2]; if(pt1.xpt2.x-thickness) { sx[0] = new GeneralPath(classicBord); sx[1] = new GeneralPath(classicBord); } else { sx[0] = getBorders(thickness+doubleSep, false); sx[1] = getBorders(thickness+doubleSep, true); } return sx; } @Override public GeneralPath[] getDbleBoundariesOutInOrMiddle(Shape classicBord) { GeneralPath[] path; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) path = getDbleBoundariesInside(classicBord); else if(bordersPosition.equals(PSTricksConstants.BORDERS_OUTSIDE)) path = getDbleBoundariesOutside(classicBord); else path = getDbleBoundariesMiddle(classicBord); return path; } @Override public void shift(double shiftX,double shiftY) { if(shiftX==0 && shiftY==0) return ; borders.shift(shiftX, shiftY); updateShape(); } @Override public synchronized void setThickness(float val) { if(!Double.isInfinite(val) && !Double.isNaN(val) && val>0) { thickness = val; shape = getInsideOutsideOrMiddleBorders(); borders.setThickness(thickness); } } @Override @Deprecated public void updateBorders() { /* * Update the borders change the points of the rhombus. */ } @Override public Shape createShadowShape() { if(!canHaveShadow || !hasShadow) return shape; Shape shadowS; if(hasDoubleBoundary) { if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) shadowS = getBorders(0, true); else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) shadowS = getBorders(thickness*2+doubleSep, false); else shadowS = getBorders((thickness*2+doubleSep)*2, false); } else { if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) shadowS = getBorders(0, false); else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) shadowS = getBorders(thickness, false); else shadowS = getBorders(thickness*2, false); } double dx=0, dy=0; LaTeXDrawPoint2D cg = getGravityCenter(); LaTeXDrawPoint2D shadowCg = (LaTeXDrawPoint2D)cg.clone(); AffineTransform at = new AffineTransform(); shadowCg.setLocation(cg.x+shadowSize, cg.y); shadowCg = Figure.rotatePoint(shadowCg, cg, shadowAngle); dx = shadowCg.x-cg.x; dy = cg.y-shadowCg.y; at.translate(dx, dy); return at.createTransformedShape(shadowS); } @Override public String getPSTricksCodeFilling(float ppc) { String str="fillstyle=";//$NON-NLS-1$ double threshold = 0.001; if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_NONE)) { if(isFilled) str += "solid"; //$NON-NLS-1$ else str = "";//$NON-NLS-1$ } else if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_GRADIENT)) { str+= "gradient,gradlines=2000";//$NON-NLS-1$ if(!gradientStartColor.equals(PSTricksConstants.DEFAULT_GRADIENT_START_COLOR)) { String name = DviPsColors.getColourName(gradientStartColor); if(name==null) { name = "color"+number+'g';//$NON-NLS-1$ DviPsColors.addUserColour(gradientStartColor, name); } str += ",gradbegin=" + name; //$NON-NLS-1$ } if(!gradientEndColor.equals(PSTricksConstants.DEFAULT_GRADIENT_END_COLOR)) { String name = DviPsColors.getColourName(gradientEndColor); if(name==null) { name = "color"+number+'f';//$NON-NLS-1$ DviPsColors.addUserColour(gradientEndColor, name); } str += ",gradend=" + name; //$NON-NLS-1$ } if(gradientMidPoint!=PSTricksConstants.DEFAULT_GRADIENT_MID_POINT) str+=",gradmidpoint="+(float)gradientMidPoint;//$NON-NLS-1$ if(((toDegrees(gradientAngle)-Math.toDegrees(rotationAngle))%360.)!=PSTricksConstants.DEFAULT_GRADIENT_ANGLE) str+=",gradangle="+(float)((toDegrees(gradientAngle)-Math.toDegrees(rotationAngle))%360.);//$NON-NLS-1$ } else { if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_CROSSHATCH)) str += "crosshatch"; //$NON-NLS-1$ else if (hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_HLINES)) str += "hlines"; //$NON-NLS-1$ else str += "vlines"; //$NON-NLS-1$ if(isFilled) str += "*"; //$NON-NLS-1$ str += ",hatchwidth=" + LaTeXDrawNumber.getCutNumber(hatchingWidth/PPC,threshold) + ",hatchangle=" + //$NON-NLS-1$ //$NON-NLS-2$ (float)((-Math.toDegrees(rotationAngle))%360.); //TODO hatching angle if(!hatchingColor.equals(PSTricksConstants.DEFAULT_HATCHING_COLOR)) { String name = DviPsColors.getColourName(hatchingColor); if(name==null) { name = "color"+number+'c';//$NON-NLS-1$ DviPsColors.addUserColour(hatchingColor, name); } str += ",hatchcolor=" + name; //$NON-NLS-1$ } } if(isFilled) { if (!interiorColor.equals(PSTricksConstants.DEFAULT_INTERIOR_COLOR)) { String name = DviPsColors.getColourName(interiorColor); if(name==null) { name = "color"+number+'b';//$NON-NLS-1$ DviPsColors.addUserColour(interiorColor, name); } str += ",fillcolor=" + name; //$NON-NLS-1$ } } return str; } @Override @Deprecated public void updateBorders(LaTeXDrawPoint2D pt) { // Nothing must be done. } @Override public void mirrorHorizontal(LaTeXDrawPoint2D origin) { borders.mirrorHorizontal(origin); updateShape(); } @Override public void mirrorVertical(LaTeXDrawPoint2D origin) { borders.mirrorVertical(origin); updateShape(); } @Override public synchronized LaTeXDrawPoint2D getLastPoint() { return borders.getLastPoint(); } @Override public void updateToGrid(MagneticGrid grid) { borders.updateToGrid(grid); updateShape(); } @Override public void rescaleX(double formerX, double newX, double percent, LaTeXDrawRectangle bound) { borders.rescaleX(formerX, newX, percent, bound); updateShape(); } @Override public void rescaleY(double formerY, double newY, double percent, LaTeXDrawRectangle bound) { borders.rescaleY(formerY, newY, percent, bound); updateShape(); } @Override public int hashCode() { return (int)(super.hashCode()/1.5); } } latexdraw-2.0.8+1.orig/latexDraw/figures/LaTeXDrawPolygon.java0000644000000000000000000010263111347255510021110 0ustar package latexDraw.figures; import java.awt.*; import java.awt.geom.AffineTransform; import java.awt.geom.GeneralPath; import java.io.IOException; import java.io.ObjectInputStream; import java.util.Vector; import latexDraw.figures.properties.DoubleBoundaryable; import latexDraw.psTricks.DviPsColors; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.ui.components.Delimitor; import latexDraw.ui.components.MagneticGrid; import latexDraw.util.LaTeXDrawException; import latexDraw.util.LaTeXDrawNumber; import latexDraw.util.LaTeXDrawPoint2D; /** * This class defines a polygon.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    * @java6 Replace GeneralPath by Path2D.Double */ public class LaTeXDrawPolygon extends Figure implements DoubleBoundaryable { private static final long serialVersionUID = 1L; /** All the corners of the polygon */ protected Vector pts; /** All delimiters of the polygon */ protected Vector delimiters; /** * The constructor by default */ public LaTeXDrawPolygon(boolean increaseMeter) { super(increaseMeter); isBordersMovable = false; borders=null; pts = new Vector(); delimiters = new Vector(); } /** * Create a figure from one another. * @param f The figure to copy. * @param sameNumber True is the new figure must have the same number as the other. * @throws IllegalArgumentException If f is null or if f has no border. */ public LaTeXDrawPolygon(Figure f, boolean sameNumber) { super(f, sameNumber); pts = new Vector(); delimiters = new Vector(); if(f==null) return; LaTeXDrawRectangle b = f.getBorders(); if(b==null) throw new IllegalArgumentException(); borders = new LaTeXDrawRectangle((LaTeXDrawPoint2D)b.getPoint(0).clone(), (LaTeXDrawPoint2D)b.getPoint(-1).clone(), false); for(LaTeXDrawPoint2D pt : b.pts) { pts.add((LaTeXDrawPoint2D)pt.clone()); Delimitor d = new Delimitor(pts.lastElement()); d.setColorSet3(); delimiters.add(d); } isBordersMovable = false; updateBorders(); updateShape(); setThickness(thickness); } /** * The constructor using two points * @param pt1 The first point of the polygon * @param pt2 The second point of the polygon */ public LaTeXDrawPolygon(LaTeXDrawPoint2D pt1, LaTeXDrawPoint2D pt2, boolean increaseMeter) { super(increaseMeter); isBordersMovable = false; borders = new LaTeXDrawRectangle((LaTeXDrawPoint2D)pt1.clone(), (LaTeXDrawPoint2D)pt2.clone(), false); pts = new Vector(); delimiters = new Vector(); addPoint(pt1); addPoint(pt2); updateGravityCenter(); } /** * The constructor using four points * @param pt1 The first point of the polygon * @param pt2 The second point of the polygon * @param pt3 The third point of the polygon * @param pt4 The fourth point of the polygon */ public LaTeXDrawPolygon(LaTeXDrawPoint2D pt1, LaTeXDrawPoint2D pt2, LaTeXDrawPoint2D pt3, LaTeXDrawPoint2D pt4, boolean increaseMeter) { super(increaseMeter); borders = new LaTeXDrawRectangle((LaTeXDrawPoint2D)pt1.clone(),(LaTeXDrawPoint2D)pt2.clone(), (LaTeXDrawPoint2D)pt3.clone(),(LaTeXDrawPoint2D)pt4.clone(),false); pts = new Vector(); delimiters = new Vector(); addPoint(pt1); addPoint(pt2); addPoint(pt3); addPoint(pt4); updateGravityCenter(); isBordersMovable = false; } /** * Allows to add a point to the polygon * @param pt The point to be added * @return True if the point has been added */ public boolean addPoint(LaTeXDrawPoint2D pt) { int id = pts.isEmpty() ? 0 : pts.size()-1; return addPointAt(pt, id); } /** * Allows to add a point to the polygon at a specific position. * @param pt The point to be added (-1=the last position). * @return True if the point has been added. */ public boolean addPointAt(LaTeXDrawPoint2D pt, int id) { if(id == -1) id = pts.size()-1; if(id<0 || id>pts.size()) throw new IllegalArgumentException(String.valueOf(id)); if(pt!=null) { Delimitor d = new Delimitor(pt); d.setDim(Math.max(6, 1.33*thickness+3.33 +1.)); d.setColorSet3(); if(pts.size()-1==id || pts.isEmpty()) { pts.add(pt); delimiters.add(d); } else { pts.add(id, pt); delimiters.add(id, d); } if(borders!=null) updateBorders(pt); return true; } return false; } /** * Allows to remove a point at the position id. If id = -1 * the last point will be deleted * @param id The position of the point (-1 for the last point) */ public void removePointAt(int id) { if(pts.isEmpty()) return ; if(id>=pts.size() || id<-1) throw new IllegalArgumentException(); if(id==-1) id = pts.size()-1; pts.remove(id); delimiters.remove(id); if(borders!=null) updateBorders(); updateShape(); } public Shape getInsideOutsideOrMiddleBorders() { return getBorders(0, true); } /** * Allow to get the point at the position id in the vector pts * @param id The position of the point asked (-1 = the last point) * @return The point asked */ public synchronized LaTeXDrawPoint2D getPoint(int id) { if(pts==null) return null; if(id==-1) return pts.lastElement(); if(id<0 || id>=pts.size()) throw new ArrayIndexOutOfBoundsException(id); return pts.elementAt(id); } /** * Allows to replace a given point of the polygon * @param pt The point to be replaced * @param id The position of the point in the vector pts */ public synchronized void setPointAt(LaTeXDrawPoint2D pt, int id) { if(id<0 || id>=pts.size()) throw new IllegalArgumentException(); if(!pt.equals(pts.elementAt(id))) { pts.setElementAt(pt, id); if(borders!=null) updateBorders(pt); updateShape(); } } @Override public void onDragged(Point formerPt, Point newPt) throws Exception { if(formerPt.equals(newPt)) return; if(isOnRotation && (borders.dSelected!=null || dSelected!=null)) addRotationAngle(computeRotationAngle(formerPt, newPt)); else if(dSelected==null)// We dragged the figure or a delimiter of the {//borders is selected if(borders.dSelected==null) shift(formerPt, newPt); else if(borders!=null && borders.dSelected!=null) { if(borders.dSelected==borders.dE || borders.dSelected==borders.dNE || borders.dSelected==borders.dSE) { double dEx = borders.dE.getX(), dWx = borders.dW.getX(); // The user must not be able to reduce too much to figure if(dEx!=dWx && newPt.x-dWx>10) rescaleX(dEx, newPt.x, Math.abs((newPt.x-dWx)/(dEx-dWx)), borders); } if(borders.dSelected==borders.dW || borders.dSelected==borders.dNW || borders.dSelected==borders.dSW) { double dEx = borders.dE.getX(), dWx = borders.dW.getX(); if(dEx!=dWx && dEx-newPt.x>10) // The user must not be able to reduce too much to figure rescaleX(dWx, newPt.x, Math.abs((newPt.x-dEx)/(dWx-dEx)), borders); } if(borders.dSelected==borders.dN || borders.dSelected==borders.dNW || borders.dSelected==borders.dNE) { double dNy = borders.dN.getY(), dSy = borders.dS.getY(); if(dNy!=dSy && dSy-newPt.y>10) // The user must not be able to reduce too much to figure rescaleY(dNy, newPt.y, Math.abs((newPt.y-dSy)/(dNy-dSy)), borders); } if(borders.dSelected==borders.dS || borders.dSelected==borders.dSW || borders.dSelected==borders.dSE) { double dNy = borders.dN.getY(), dSy = borders.dS.getY(); if(dNy!=dSy && newPt.y-dNy>10) // The user must not be able to reduce too much to figure rescaleY(dSy, newPt.y, Math.abs((newPt.y-dNy)/(dSy-dNy)), borders); } } }//if(dSelected==null) else { dSelected.setCoordinates(newPt.x, newPt.y); updateShape(); } updateBorders(); } @Override public void draw(Graphics2D g, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering) { Color formerCol = g.getColor(); double dx=0, dy=0; boolean changeFillStyle = false; if(hasShadow) { LaTeXDrawPoint2D cg = getGravityCenter(); LaTeXDrawPoint2D shadowCg = (LaTeXDrawPoint2D)cg.clone(); shadowCg.setLocation(cg.x+shadowSize, cg.y); shadowCg = Figure.rotatePoint(shadowCg, cg, shadowAngle); dx = shadowCg.x-cg.x; dy = cg.y-shadowCg.y; } if(shape==null) shape = getInsideOutsideOrMiddleBorders(); if(hasDoubleBoundary) { g.setColor(linesColor); BasicStroke wideline=null; if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) wideline = new BasicStroke((float)(doubleSep+thickness*2.), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); else if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) wideline = new BasicStroke((float)(doubleSep+thickness*2.), BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[]{0,(float)(doubleSep+thickness*2.)+dotSep}, 0); else wideline = new BasicStroke((float)(doubleSep+thickness*2.), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[]{blackDashLength, whiteDashLength}, 0); Shape outline = wideline.createStrokedShape(shape); if(hasShadow) { Stroke stroke = g.getStroke(); g.setStroke(new BasicStroke((float)(doubleSep+thickness*2.), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.fill(shape); g.draw(shape); g.translate(-dx, -dy); g.setStroke(stroke); if(!isFilled) { changeFillStyle = true; isFilled = true; } } fillFigure(g, antiAlias, rendering, alphaInter, colorRendering, shape); g.setColor(linesColor); g.fill(outline); g.setColor(doubleColor); wideline = new BasicStroke((float)doubleSep); outline = wideline.createStrokedShape(shape); g.fill(outline); } else { if(hasShadow) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.fill(shape); g.draw(shape); g.translate(-dx, -dy); if(!isFilled) { changeFillStyle = true; isFilled = true; } g.setColor(interiorColor); g.draw(shape); } if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); else if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[]{0,thickness+dotSep}, 0)); } else if(lineStyle.equals(PSTricksConstants.LINE_DASHED_STYLE)) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[]{blackDashLength, whiteDashLength}, 0)); } fillFigure(g, antiAlias,rendering,alphaInter, colorRendering,shape); g.setColor(linesColor); g.draw(shape); } if(changeFillStyle) isFilled = false; g.setColor(formerCol); if(isSelected) { int sizeD = delimiters.size(); for(int i=0; i0) { LaTeXDrawPoint2D NW = bound.getTheNWPoint(), SE = bound.getTheSEPoint(),farest,p; if(formerX == SE.x) farest = NW; else if(formerX == NW.x) farest = SE; else throw new IllegalArgumentException(); for(i=0; i0) { LaTeXDrawPoint2D NW = bound.getTheNWPoint(), SE = bound.getTheSEPoint(),farest,p; if(formerY == SE.y) farest = NW; else if(formerY == NW.y) farest = SE; else throw new IllegalArgumentException(); for(i=0; i0) fillType=fillType+','+str; str = getPSTricksCodeLine(ppc); if(str.length()>0) add=add+','+str; if(hasDoubleBoundary) { add+=",doubleline=true,doublesep="+LaTeXDrawNumber.getCutNumber((float)(doubleSep/ppc),threshold); //$NON-NLS-1$ if(doubleColor!=PSTricksConstants.DEFAULT_DOUBLE_COLOR) { String name = DviPsColors.getColourName(doubleColor); if(name==null) { name = "color"+number+'d';//$NON-NLS-1$ DviPsColors.addUserColour(doubleColor, name); } add+= ",doublecolor="+name; //$NON-NLS-1$ } } if(isFilledWasChanged) isFilled = false; return "\\pspolygon[linewidth=" + LaTeXDrawNumber.getCutNumber(thickness/ppc,threshold) //$NON-NLS-1$ + add + fillType + "]"+coord; //$NON-NLS-1$ } @Override public void onClick(Point pt) { isSelected = true; int i, sizeD = delimiters.size(); boolean in = false; for(i=0; i(); p.delimiters = new Vector(); int i, size; LaTeXDrawPoint2D pt; for(i=0, size=pts.size(); i0) { for(LaTeXDrawPoint2D pt : pts) { gravityCenter.x+=pt.x; gravityCenter.y+=pt.y; } gravityCenter.x/=pts.size(); gravityCenter.y/=pts.size(); } } @Override public synchronized void setThickness(float val) { super.setThickness(val); if(!Double.isInfinite(val) && !Double.isNaN(val) && val>0) { double dim = Math.max(6,1.33*val+3.33 +1.); int i, size = delimiters.size(); // We change the size of the delimiters when the size of the figure change for(i=0; iSEx) SEx = pt.x; if(pt.ySEy) SEy = pt.y; } if(borders==null) borders = new LaTeXDrawRectangle(new LaTeXDrawPoint2D(NWx,NWy), new LaTeXDrawPoint2D(SEx,SEy), false); else { borders.setLastPoint(SEx, SEy); borders.setFirstPoint(NWx, NWy); } updateGravityCenter(); } } /** * Allows to update the dimension of the borders of the polygon when a point pt is added to the polygon * @param pt The added point */ public void updateBorders(LaTeXDrawPoint2D pt) { if(pt==null || borders==null) return ; if(pts.size()>1) { LaTeXDrawPoint2D NW = getBordersPoint(0); LaTeXDrawPoint2D SE = getBordersPoint(-1); if(pt.xSE.y) { borders.setFirstPoint(pt.x,NW.y); borders.setLastPoint(SE.x,pt.y); } else borders.setFirstPoint(pt.x,NW.y); } else { if(pt.ySE.x) { if(pt.y>SE.y) borders.setLastPoint(pt); else borders.setLastPoint(pt.x, SE.y); } else if(pt.y>SE.y) borders.setLastPoint(SE.x,pt.y); } }//if(pts.size()>1) } @Override public Shape createShape2D() { if(hasDoubleBoundary) { BasicStroke wideline = new BasicStroke((float)(doubleSep+thickness)); Shape outline = wideline.createStrokedShape(shape); return outline; } return getInsideOutsideOrMiddleBorders(); } @Override public Shape createNonRotatedShape2D() { return createShape2D(); } @SuppressWarnings("unchecked") private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { canHaveShadow = true; isDoubleBoundaryable = true; interiorColor = (Color) ois.readObject(); lineStyle = (String) ois.readObject(); rotationAngle = ois.readDouble(); thickness = ois.readFloat(); isFilled = ois.readBoolean(); isSelected = ois.readBoolean(); isOnRotation = ois.readBoolean(); linesColor = (Color) ois.readObject(); blackDashLength = ois.readFloat(); dotSep = ois.readFloat(); whiteDashLength = ois.readFloat(); pts = (Vector) ois.readObject(); delimiters = new Vector(); for(int i=0, size = pts.size();i=0)//$NON-NLS-1$ { hasDoubleBoundary = ois.readBoolean(); doubleColor = (Color)ois.readObject(); doubleSep = ois.readDouble(); if(!(LaTeXDrawFrame.getVersionOfFile().compareTo("1.6")>=0)) //$NON-NLS-1$ ois.readBoolean(); hatchingAngle = ois.readDouble(); hatchingColor = (Color)ois.readObject(); hatchingStyle = (String)ois.readObject(); hatchingWidth = ois.readFloat(); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.6") < 0)//$NON-NLS-1$ { if(hatchingStyle.equals(DECREPETED_FILL_CROSS)) hatchingStyle = PSTricksConstants.TOKEN_FILL_CROSSHATCH; else if(hatchingStyle.equals(DECREPETED_FILL_HORIZ)) hatchingStyle = PSTricksConstants.TOKEN_FILL_HLINES; else if(hatchingStyle.equals(DECREPETED_FILL_VERT)) hatchingStyle = PSTricksConstants.TOKEN_FILL_VLINES; else if(hatchingStyle.equals(DECREPETED_FILL_NO)) hatchingStyle = PSTricksConstants.TOKEN_FILL_NONE; } } else { hasDoubleBoundary = DEFAULT_HAS_DOUBLE_BOUNDARY; doubleColor = DEFAULT_DOUBLE_COLOR; doubleSep = DEFAULT_DOUBLESEP; hatchingAngle = DEFAULT_HATCH_ANGLE; hatchingColor = DEFAULT_HATCH_COL; hatchingStyle = DEFAULT_HATCH_STYLE; hatchingWidth = DEFAULT_HATCH_WIDTH; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.7")>=0) //$NON-NLS-1$ { hasShadow = ois.readBoolean(); shadowAngle = ois.readDouble(); shadowSize = ois.readDouble(); shadowColor = (Color)ois.readObject(); gradientEndColor = (Color)ois.readObject(); gradientStartColor = (Color)ois.readObject(); gradientAngle = ois.readDouble(); gradientMidPoint = ois.readDouble(); } else { hasShadow = DEFAULT_SHADOW_HAS; shadowAngle = DEFAULT_SHADOW_ANGLE; shadowSize = DEFAULT_SHADOW_SIZE; shadowColor = DEFAULT_SHADOW_COLOR; gradientEndColor = PSTricksConstants.DEFAULT_GRADIENT_END_COLOR; gradientStartColor = PSTricksConstants.DEFAULT_GRADIENT_START_COLOR; gradientAngle = DEFAULT_GRADIENT_ANGLE; gradientMidPoint = DEFAULT_GRADIENT_MID_POINT; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.8")>=0) //$NON-NLS-1$ hatchingSep = ois.readDouble(); else hatchingSep = DEFAULT_HATCH_SEP; setThickness(thickness); updateGravityCenter(); shape = getInsideOutsideOrMiddleBorders(); } public Shape[] getDbleBoundariesOutside(Shape classicBord) {// A Line cannot be double boundaries which move return getDbleBoundariesMiddle(classicBord); } public Shape[] getDbleBoundariesInside(Shape classicBord) {// A Line cannot be double boundaries which move return getDbleBoundariesMiddle(classicBord); } public Shape[] getDbleBoundariesMiddle(Shape classicBord) { LaTeXDrawPoint2D pt1 = getPoint(0), pt2 = getPoint(-1); Shape[] sx = new Shape[2]; if(pt1.xpt2.x-thickness) { sx[0] = new GeneralPath(classicBord); sx[1] = new GeneralPath(classicBord); } else { sx[0] = getBorders(thickness+doubleSep, false); sx[1] = getBorders(thickness+doubleSep, true); } return sx; } public Shape[] getDbleBoundariesOutInOrMiddle(Shape classicBord) {// A Line cannot be double boundaries which move return getDbleBoundariesMiddle(classicBord); } /** * Allows to get the outer or the inner borders following a distance * @param gap The distance of the borders * @param into True, you will get the borders inside the real borders */ protected GeneralPath getBorders(double gap, boolean into) { int i, nbP = getNbPoints(); LaTeXDrawPoint2D pt; double xs[] = new double[nbP], ys[] = new double[nbP]; GeneralPath path = new GeneralPath(); if(nbP<2) return path; pt = pts.elementAt(0); path.moveTo((float)pt.x, (float)pt.y); for(i=1; i=pts.size()) throw new IllegalArgumentException(); pts.elementAt(id).setLocation(x, y); if(borders!=null) updateBorders(); updateShape(); } /** * @return The points of the shape. * @since 2.0.0 */ public Vector getPoints() { return pts; } } latexdraw-2.0.8+1.orig/latexDraw/figures/Draw.java0000644000000000000000000011677511347255510016660 0ustar package latexDraw.figures; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Shape; import java.awt.geom.Rectangle2D; import java.io.IOException; import java.io.ObjectInputStream; import java.util.LinkedList; import java.util.Vector; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.ui.components.MagneticGrid; import latexDraw.util.LaTeXDrawPoint2D; /** * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class Draw extends Figure { private static final long serialVersionUID = 1L; /** All the figures which constitute the drawing. */ protected Vector
    figures; /** Defines the borders of the draw without taking account of the thickness of the figures. */ protected LaTeXDrawRectangle minBorders; /** True: the figures of the drawing must be drawn (and the method get code get there code. */ protected boolean drawFigures; /** The point is useful to rotate the selection. */ protected transient LaTeXDrawPoint2D formerGravityC = null; /** The value by default of the attribute drawFigure */ public static final boolean DEFAULT_DRAWFIGURE = false; /** * The constructor by default. */ public Draw(boolean drawFigures, boolean increaseMeter) { this(null, drawFigures, increaseMeter); } public Draw(Vector
    figs, boolean drawFigures, boolean increaseMeter, boolean cloneFigures) { super(increaseMeter); canHaveShadow = true; isResizable = true; isBordersMovable = true; isDashableOrDotable = true; isDoubleBoundaryable = true; this.drawFigures = drawFigures; canBeFilled = true; isCustomizable = true; isThicknessable = true; initializeBorders(); figures = new Vector
    (); if(figs!=null) if(cloneFigures) { for(Figure f : figs) if(f!=null) try { addFigure((Figure)f.clone()); } catch(CloneNotSupportedException e) { e.printStackTrace(); } } else for(Figure f : figs) if(f!=null) addFigure(f); shape = createShape2D(); } public Draw(Vector
    figs, boolean drawFigures, boolean increaseMeter) { this(figs, drawFigures, increaseMeter, false); } /** * Initialise the minBorders and the borders (colour, style, ...). */ protected void initializeBorders() { if(minBorders==null) minBorders = new LaTeXDrawRectangle(false); if(borders==null) borders = new LaTeXDrawRectangle(false); borders.setLinesColor(Color.gray); borders.setLineStyle(PSTricksConstants.LINE_DASHED_STYLE); } /** * Allows to add a figure to the drawing. * @param f The figure to add. * @throws IllegalArgumentException If f is null. */ public void addFigure(Figure f) { if(f==null) throw new IllegalArgumentException("f is null.");//$NON-NLS-1$ f.onRelease(); figures.add(f); updateBorders(); updateGravityCenter(); } /** * Allows to add a figure to the drawing at a given position. * @param f The figure to add. * @param index THe position where insert the figure. * @throws IllegalArgumentException If f is null or if the index is bad. */ public void addFigure(Figure f, int index) { if(index<0 || (index>=figures.size() && index>0)) throw new IllegalArgumentException("Bad index.");//$NON-NLS-1$ if(f==null) throw new IllegalArgumentException("f is null.");//$NON-NLS-1$ f.onRelease(); figures.add(index, f); updateBorders(); updateGravityCenter(); } @Override public synchronized void setOnRotation(boolean on) { super.setOnRotation(on); int i, size=figures.size(); for(i=0; iid is invalid. * @return The deleted figure. * @since 1.9.1 */ public Figure removeFigureAt(int id) { if(id<0 || id>=figures.size()) throw new IllegalArgumentException(); Figure f = figures.remove(id); updateBorders(); return f; } /** * Allows to update the dimension and the position of the borders of the drawing. */ public void updateBorders() { if(minBorders==null) initializeBorders(); if(borders==null) initializeBorders(); if(figures.isEmpty()) { borders.setFirstPoint(0, 0); borders.setLastPoint(0, 0); minBorders.setFirstPoint(0, 0); minBorders.setLastPoint(0, 0); } else { int size = figures.size(), i; LaTeXDrawPoint2D NW, SE, NW2, SE2; LaTeXDrawPoint2D NWb, SEb, NW2b, SE2b; Figure f = figures.firstElement(); NW = (LaTeXDrawPoint2D) f.getTheNWBoundPoint().clone(); SE = (LaTeXDrawPoint2D) f.getTheSEBoundPoint().clone(); if(f instanceof Draw) { NWb = (LaTeXDrawPoint2D)((Draw)f).minBorders.getTheNWPoint().clone(); SEb = (LaTeXDrawPoint2D)((Draw)f).minBorders.getTheSEPoint().clone(); } else { NWb = (LaTeXDrawPoint2D) f.getTheNWPoint().clone(); SEb = (LaTeXDrawPoint2D) f.getTheSEPoint().clone(); } for(i=1; iSE.x) SE.x = SE2.x; if(SE2.y>SE.y) SE.y = SE2.y; if(NW2b.xSEb.x) SEb.x = SE2b.x; if(SE2b.y>SEb.y) SEb.y = SE2b.y; } borders.setFirstPoint(NW.x, NW.y); borders.setLastPoint(SE); minBorders.setFirstPoint(NWb); minBorders.setLastPoint(SEb); shape = createShape2D(); } } @Override public void onDragged(Point formerPt, Point newPt) throws Exception { if(formerPt.equals(newPt)) return; int i, size = figures.size(); if(figures.size()==1 && !drawFigures) { figures.firstElement().onDragged(formerPt, newPt); updateBorders(); updateGravityCenter(); return; } if(borders.dSelected!=null) { if(isOnRotation) { double angle = computeRotationAngle(formerPt, newPt); rotationAngle+=angle; rotationAngle%=(2*Math.PI); if(formerGravityC==null) throw new IllegalArgumentException("beginRotate must be called before to initialise the rotation"); //$NON-NLS-1$ for(i=0; i=borders.dS.getY()) return ; if((borders.dSelected==borders.dSE || borders.dSelected==borders.dSW || borders.dSelected==borders.dS) && newPt.y<=borders.dN.getY()) return ; if((borders.dSelected==borders.dSE || borders.dSelected==borders.dNE || borders.dSelected==borders.dE) && newPt.x<=borders.dW.getX()) return ; if((borders.dSelected==borders.dSW || borders.dSelected==borders.dNW || borders.dSelected==borders.dW) && newPt.x>=borders.dE.getX()) return ; boolean rescalable; Figure f; if(borders.dSelected==borders.dE || borders.dSelected==borders.dNE || borders.dSelected==borders.dSE) { double dEx = borders.dE.getX(), dWx = borders.dW.getX(); double percent = Math.abs((newPt.x-dWx)/(dEx-dWx)); rescalable = true; i=0; while(i=newPt.x) rescalable = false; } else rescalable = false; i++; } // The user must not be able to reduce too much to figure if(rescalable) rescaleX(minBorders.getTheSEPoint().x, minBorders.getTheSEPoint().x+dEx-newPt.x, percent, minBorders); } if(borders.dSelected==borders.dW || borders.dSelected==borders.dNW || borders.dSelected==borders.dSW) { double dEx = borders.dE.getX(), dWx = borders.dW.getX(); double percent = Math.abs((newPt.x-dEx)/(dWx-dEx)); rescalable = true; i=0; while(i=newPt.y) rescalable = false; } else rescalable = false; i++; } if(rescalable) // The user must not be able to reduce too much to figure rescaleY(minBorders.getTheSEPoint().y, minBorders.getTheSEPoint().y-dSy+newPt.y, percent, minBorders); } }//if(borders.dSelected==null) else for(i=0; i1 && isSelected && borders!=null) borders.draw(g, antiAlias, rendering, alphaInter, colorRendering); } /** * Allows to know if there is a figure in the drawing. * @return True if there is at least one figure in the drawing. */ public boolean isEmpty() { return figures.isEmpty(); } @Override public boolean isIn(LaTeXDrawPoint2D pt) { int i, size = figures.size(); boolean in = false; for(i=0; ipoint. * @param pt The point of reference. * @return The figure which contains the point. */ public Figure whereIsIt(Point pt) { int i, size = figures.size(); boolean here = false; for(i=0; iid in the vector Figures. * @param id The position of the figure in the vector Figures. * @return The figure corresponding to the identifier. */ public Figure getFigureAt(int id) { if(id<0 || id>=figures.size()) throw new ArrayIndexOutOfBoundsException(id); return figures.elementAt(id); } /** * Allows to get the number of figures which contains the drawing. * @return The number of figures in the drawing. */ public int size() { return figures.size(); } @Override public String getCodePSTricks(DrawBorders drawBorders, float ppc) { int i, size = figures.size(); if(drawFigures && size>0) { String code=""; //$NON-NLS-1$ for(i=0; i=1) figures.firstElement().setSelected(size()==1); } @Override public synchronized void setRotationAngle(double theta) { double angle = theta - rotationAngle; super.setRotationAngle(theta); if(drawFigures) { int i, size = figures.size(); for(i=0; ifigures. */ public void clear() { setSelected(false); figures.removeAllElements(); shape = createShape2D(); } @Override public Object clone() throws CloneNotSupportedException { Draw d = (Draw) super.clone(); d.drawFigures = drawFigures; int i, size = size(); d.figures = new Vector
    (); for(i=0; ise.x) se.x = se2.x; if(se2.y>se.y) se.y = se2.y; } gravityCenter.x = (nw.x+se.x)/2.; gravityCenter.y = (nw.y+se.y)/2.; } @Override public void updateStyleOfDelimitors() { super.updateStyleOfDelimitors(); for(int i=0, size=figures.size(); i) ois.readObject(); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.5")>=0)//$NON-NLS-1$ drawFigures = ois.readBoolean(); else { ois.readObject(); drawFigures = DEFAULT_DRAWFIGURE; } updateStyleOfDelimitors(); canBeFilled = false; initializeBorders(); if(linesColor==null) { linesColor = DEFAULT_BORDERS_COL; doubleColor = DEFAULT_DOUBLE_COLOR; interiorColor = DEFAULT_INTERIOR_COL; hatchingColor = DEFAULT_HATCH_COL; gradientEndColor = PSTricksConstants.DEFAULT_GRADIENT_END_COLOR; gradientStartColor = PSTricksConstants.DEFAULT_GRADIENT_START_COLOR; shadowColor = DEFAULT_SHADOW_COLOR; } } /** * @return Returns the drawFigures. */ public boolean isDrawFigures() { return drawFigures; } /** * @param drawFigures The drawFigures to set. */ public synchronized void setDrawFigures(boolean drawFigures) { this.drawFigures = drawFigures; } @Override public Shape createNonRotatedShape2D() { return borders.createNonRotatedShape2D(); } @Override @Deprecated public void updateShape() { /* The shape is not used by a drawing. */ } /** * @return the minBorders. */ public LaTeXDrawRectangle getMinBorders() { return minBorders; } /** * @param minBorders the minBorders to set. */ public void setMinBorders(LaTeXDrawRectangle minBorders) { this.minBorders = minBorders; } @Override public boolean isTooSmallToBeRescaled() { // TODO Auto-generated method stub return false; } @Override public void rotate(LaTeXDrawPoint2D gravityC, double angle) { for(Figure f : figures) f.rotate(gravityC, angle); updateBorders(); } @Override public void mirrorHorizontal(LaTeXDrawPoint2D origin) { for(Figure f : figures) f.mirrorHorizontal(origin); updateBorders(); updateGravityCenter(); } @Override public void mirrorVertical(LaTeXDrawPoint2D origin) { for(Figure f : figures) f.mirrorVertical(origin); updateBorders(); updateGravityCenter(); } @Override public synchronized LaTeXDrawPoint2D getLastPoint() { return null; } /** * @since 1.9 * @return The figures of the drawing. */ public synchronized Vector
    getFigures() { return figures; } @Override public void updateToGrid(MagneticGrid grid) { for(Figure figure : figures) figure.updateToGrid(grid); updateBorders(); } @Override public int getSelectedDelimitorOrientation() { if(size()==1) return getFigureAt(0).getSelectedDelimitorOrientation(); return borders.getSelectedDelimitorOrientation(); } @Override public int hashCode() { return super.hashCode()^5; } /** * This method must be called before each rotation of the selection. Initialize the rotation. * @since 1.9 */ public void beginRotation() { updateGravityCenter(); formerGravityC = (LaTeXDrawPoint2D)gravityCenter.clone(); if(!drawFigures) for(Figure f : figures) if(f instanceof Draw) ((Draw)f).beginRotation(); } /** * This method must be called after each rotation of the selection. Deinitialize the rotation. * @since 1.9 */ public void endRotation() { updateGravityCenter(); updateBorders(); formerGravityC = null; if(!drawFigures) for(Figure f : figures) if(f instanceof Draw) ((Draw)f).endRotation(); } @Override public synchronized float getThickness() { if(figures==null || figures.isEmpty()) return super.getThickness(); return figures.firstElement().getThickness(); } @Override public synchronized void setThickness(float value) { if(figures!=null) for(Figure f : figures) f.setThickness(value); } @Override public synchronized Color getDoubleColor() { if(figures==null || figures.isEmpty()) return super.getDoubleColor(); int i=0, size = figures.size(); boolean ok=true; while(ok && i1) return figures.elementAt(i).getDoubleColor(); return figures.firstElement().getDoubleColor(); } @Override public synchronized Color getGradientEndColor() { if(figures==null || figures.isEmpty()) return super.getGradientEndColor(); int i=0, size = figures.size(); boolean ok=true; while(ok && i1) return figures.elementAt(i).getGradientEndColor(); return figures.firstElement().getGradientEndColor(); } @Override public synchronized Color getGradientStartColor() { if(figures==null || figures.isEmpty()) return super.getGradientStartColor(); int i=0, size = figures.size(); boolean ok=true; while(ok && i1) return figures.elementAt(i).getGradientStartColor(); return figures.firstElement().getGradientStartColor(); } @Override public synchronized Color getHatchingColor() { if(figures==null || figures.isEmpty()) return super.getHatchingColor(); int i=0, size = figures.size(); boolean ok=true; while(ok && i1) return figures.elementAt(i).getHatchingColor(); return figures.firstElement().getHatchingColor(); } @Override public synchronized String getHatchingStyle() { if(figures==null || figures.isEmpty()) return super.getHatchingStyle(); int i=0, size = figures.size(); boolean ok=true; while(ok && i1) return figures.elementAt(i).getHatchingStyle(); return figures.firstElement().getHatchingStyle(); } @Override public synchronized Color getInteriorColor() { if(figures==null || figures.isEmpty()) return super.getInteriorColor(); int i=0, size = figures.size(); boolean ok=true; while(ok && i1) return figures.elementAt(i).getInteriorColor(); return figures.firstElement().getInteriorColor(); } @Override public synchronized Color getLinesColor() { if(figures==null || figures.isEmpty()) return super.getLinesColor(); return figures.firstElement().getLinesColor(); } @Override public synchronized String getLineStyle() { if(figures==null || figures.isEmpty()) return super.getLineStyle(); int i=0, size = figures.size(); boolean ok=true; while(ok && i1) return figures.elementAt(i).getLineStyle(); return figures.firstElement().getLineStyle(); } @Override public synchronized boolean hasDoubleBoundary() { if(figures==null || figures.isEmpty()) return super.hasDoubleBoundary(); int i=0, size = figures.size(); boolean ok=true; while(ok && i1) return figures.elementAt(i).hasDoubleBoundary(); return figures.firstElement().hasDoubleBoundary(); } @Override public synchronized boolean hasShadow() { if(figures==null || figures.isEmpty()) return super.hasShadow(); int i=0, size = figures.size(); boolean ok=true; while(ok && i1) return figures.elementAt(i).hasShadow(); return figures.firstElement().hasShadow(); } @Override public synchronized boolean isFilled() { if(figures==null || figures.isEmpty()) return super.isFilled(); int i=0, size = figures.size(); boolean ok=true; while(ok && i1) return figures.elementAt(i).isFilled(); return figures.firstElement().isFilled(); } @Override public String toString() { String str = "["; //$NON-NLS-1$ for(int i=0, size=figures.size()-1; i sortedF = new LinkedList
    (); LinkedList ses = new LinkedList(); LaTeXDrawPoint2D pt; boolean ok; double gap; int i, size; for(Figure f : figures) { pt = f.getTheSERotatedPoint(); ok = true; for(i=0, size=sortedF.size(); i sortedF = new LinkedList
    (); LinkedList gcs = new LinkedList(); LaTeXDrawPoint2D pt; int i, size; boolean ok; double gap; for(Figure f : figures) { pt = f.getGravityCenter(); ok = true; for(i=0, size=sortedF.size(); i sortedF = new LinkedList
    (); LinkedList nws = new LinkedList(); LaTeXDrawPoint2D pt; int i, size; boolean ok; double gap; for(Figure f : figures) { pt = f.getTheNWRotatedPoint(); ok = true; for(i=0, size=sortedF.size(); i sortedF = new LinkedList
    (); LinkedList tops = new LinkedList(); LinkedList bots = new LinkedList(); LaTeXDrawPoint2D pt; int i, size; boolean ok; double gap; for(Figure f : figures) { pt = f.getTheNWRotatedPoint(); ok = true; for(i=0, size=tops.size(); i sortedF = new LinkedList
    (); LinkedList nws = new LinkedList(); LaTeXDrawPoint2D pt; int i, size; boolean ok; double gap; for(Figure f : figures) { pt = f.getTheNWRotatedPoint(); ok = true; for(i=0, size=sortedF.size(); i sortedF = new LinkedList
    (); LinkedList gcs = new LinkedList(); LaTeXDrawPoint2D pt; int i, size; boolean ok; double gap; for(Figure f : figures) { pt = f.getGravityCenter(); ok = true; for(i=0, size=sortedF.size(); i sortedF = new LinkedList
    (); LinkedList ses = new LinkedList(); LaTeXDrawPoint2D pt; int i, size; boolean ok; double gap; for(Figure f : figures) { pt = f.getTheSERotatedPoint(); ok = true; for(i=0, size=sortedF.size(); i sortedF = new LinkedList
    (); LinkedList rights = new LinkedList(); LinkedList lefts = new LinkedList(); LaTeXDrawPoint2D pt; int i, size; boolean ok; double gap; for(Figure f : figures) { pt = f.getTheNWRotatedPoint(); ok = true; for(i=0, size=lefts.size(); i nws = new LinkedList(); double minX = Double.MAX_VALUE; LaTeXDrawPoint2D pt; for(Figure f : figures) { pt = f.getTheNWRotatedPoint(); nws.add(pt); if(pt.x ses = new LinkedList(); double maxX = Double.MIN_VALUE; LaTeXDrawPoint2D pt; for(Figure f : figures) { pt = f.getTheSERotatedPoint(); ses.add(pt); if(pt.x>maxX) maxX = pt.x; } for(Figure f : figures) { pt = ses.poll(); if(((float)maxX)!=((float)pt.x)) f.shift(maxX-pt.x, 0); } updateBorders(); } /** * Align the selected figures to the figure on the top. * @since 2.0.0 */ public void alignTop() { if(size()<2) return ; LinkedList nws = new LinkedList(); double minY = Double.MAX_VALUE; LaTeXDrawPoint2D pt; for(Figure f : figures) { pt = f.getTheNWRotatedPoint(); nws.add(pt); if(pt.y ses = new LinkedList(); double maxY = Double.MIN_VALUE; LaTeXDrawPoint2D pt; for(Figure f : figures) { pt = f.getTheSERotatedPoint(); ses.add(pt); if(pt.y>maxY) maxY = pt.y; } for(Figure f : figures) { pt = ses.poll(); if(((float)maxY)!=((float)pt.y)) f.shift(0, maxY-pt.y); } updateBorders(); } /** * Align vertically the selected figures to the figure in the middle. * @since 2.0.0 */ public void alignMiddleVertically() { if(size()<2) return ; LinkedList middles = new LinkedList(); double maxX = Double.MIN_VALUE; double minX = Double.MAX_VALUE, middle, middle2; LaTeXDrawPoint2D pt, pt2; for(Figure f : figures) { pt = f.getTheNWRotatedPoint(); pt2 = f.getTheSERotatedPoint(); if(pt.xmaxX) maxX = pt2.x; middles.add((pt.x+pt2.x)/2.); } middle = (minX+maxX)/2.; for(Figure f : figures) { middle2 = middles.poll(); if(((float)middle2)!=((float)middle)) f.shift(middle-middle2, 0); } updateBorders(); } /** * Align horizontally the selected figures to the figure in the middle. * @since 2.0.0 */ public void alignMiddleHorizontally() { if(size()<2) return ; LinkedList middles = new LinkedList(); double maxY = Double.MIN_VALUE; double minY = Double.MAX_VALUE, middle, middle2; LaTeXDrawPoint2D pt, pt2; for(Figure f : figures) { pt = f.getTheNWRotatedPoint(); pt2 = f.getTheSERotatedPoint(); if(pt.ymaxY) maxY = pt2.y; middles.add((pt.y+pt2.y)/2.); } middle = (minY+maxY)/2.; for(Figure f : figures) { middle2 = middles.poll(); if(((float)middle2)!=((float)middle)) f.shift(0, middle-middle2); } updateBorders(); } } latexdraw-2.0.8+1.orig/latexDraw/figures/Text.java0000644000000000000000000014333011347255510016672 0ustar package latexDraw.figures; import java.awt.*; import java.awt.font.FontRenderContext; import java.awt.font.TextLayout; import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; import java.util.Vector; import javax.swing.JComboBox; import latexDraw.psTricks.DviPsColors; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.DrawContainer; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.ui.components.MagneticGrid; import latexDraw.util.LaTeXDrawNumber; import latexDraw.util.LaTeXDrawPoint2D; /** * This class defines a text. *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class Text extends Figure { private static final long serialVersionUID = 1L; public class TextPosition { protected int start; protected int end; protected LaTeXDrawPoint2D pos; public TextPosition(int s, int e, LaTeXDrawPoint2D p) { start = s; end = e; pos = p; } public TextPosition(int s, int e, double x, double y) { start = s; end = e; pos = new LaTeXDrawPoint2D(x, y); } /** * @return the start. * @since 2.0.0 */ public synchronized int getStart() { return start; } /** * @return the end. * @since 2.0.0 */ public synchronized int getEnd() { return end; } /** * @return the pos. * @since 2.0.0 */ public synchronized LaTeXDrawPoint2D getPos() { return pos; } } /** The text which must be displayed */ protected String text; /** The position of the first character of the text */ protected LaTeXDrawPoint2D position; /** The current font*/ protected Font currentFont; /** The current size of the text */ protected TextSize currentSize; /** Allows to know if the text is bold */ protected boolean isBold; /** Allows to know if the text is italic */ protected boolean isItalic; /** The text is in italic or not by default */ public static final boolean DEFAULT_ISITALIC = false; /** The text is bold or not by default */ public static final boolean DEFAULT_ISBOLD = false; /** The text is or not framed by default. */ public static final boolean DEFAULT_HAS_BOX = false; /** Define if the text is opaque by default. */ public static final boolean DEFAULT_IS_OPAQUE = false; /** The text has a simple box or not by default */ public static final boolean DEFAULT_HAS_SIMPLE_BOX = true; /** The colour of the opacity by default. */ public static final Color DEFAULT_OPACITY_COLOR = Color.WHITE; /** The current font metrics of the text */ protected FontMetrics fontMetrics; /** The current FontRenderContext of the text. */ protected transient FontRenderContext fontRenderContext; /** The simple framed box of the text. */ protected FramedBox simpleBox; /** Define if the text has a framed box. */ protected boolean hasFramedBox; /** Define if the text has a simple or a complex framed box. */ protected boolean hasSimpleFramedBox; /** The size of the labels which is used when the grid is drawn (takes account the PPC).*/ protected double textSizeDrawn; /** Define if the background of the text is opaque. */ protected boolean isOpaque; /** Contains all the boxes define by the user when she has selected multiple boxes. */ protected Vector multipleBox; /** * Contains the boxes of the vector multipleBox and some textPostions but in the order to by displayed. * The parts of the non-boxed text are contained in this vector as TextPosition. In order to display * the words of the text in the order. */ protected transient Vector multipleBoxDisplay; protected transient Vector textPos; /** Define if a text has been change and so, if several parameters (font, ...) must be * updated. */ protected transient boolean hasChanged; /** The colour of the opacity */ protected Color opacityColor; /** * Allows to define a font of text * 01/20/06
    * @author Arnaud BLOUIN
    * @version 0.5
    */ public static class TextFont implements Cloneable, Serializable { private static final long serialVersionUID = 1L; /** The name of the font */ protected String name; /** The family of the font */ protected String family; /** The encoding of the font */ protected String encoding; /** * The constructor by default * @param name The name of the font * @param family The family of the font * @param encoding The encoding of the font (cf. LaTeX : T1, ...) */ public TextFont(String name, String family, String encoding) { this.name = name; this.family = family; this.encoding = encoding; } /** * Allows to get the name of the font * @return The name of the font */ public String getName() { return name; } /** * Allows to get the family of the font * @return The family of the font */ public String getFamily() { return family; } /** * Allows to get the encoding of the font * @return The encoding of the font */ public String getEncoding() { return encoding; } @Override public Object clone() throws CloneNotSupportedException { return super.clone(); } } /** * Allows to define a size of text * 01/20/06
    * @author Arnaud BLOUIN
    * @version 0.5
    */ public static class TextSize implements Cloneable, Serializable { private static final long serialVersionUID = 1L; /** The label of the size */ protected String label; /** The (pstricks) keyword of the size */ protected String keyword; /** The size */ protected int size; /** * The constructor by default * @param label The label of the size * @param keyword The pstricks keyword of the size * @param size The size */ public TextSize(String label, String keyword, int size) { this.label = label; this.keyword = keyword; this.size = size; } /** * Allows to get the label of the size * @return The label of the size */ public String getLabel() { return label; } /** * Allows to get the pstricks keyword of the size * @return The keyword */ public String getKeyword() { return keyword; } /** * Allows to get the size * @return The size */ public int getSize() { return size; } @Override public Object clone() throws CloneNotSupportedException { return super.clone(); } } /** The tiny size */ public static final TextSize SIZE_TINY = new TextSize("Tiny", PSTricksConstants.COMMAND_TEXT_TINY, 11); //$NON-NLS-1$ /** The script size */ public static final TextSize SIZE_SCRIPT = new TextSize("Script size", PSTricksConstants.COMMAND_TEXT_SCRIPT, 14); //$NON-NLS-1$ /** The footnote size */ public static final TextSize SIZE_FOOTNOTE = new TextSize("Footnote size", PSTricksConstants.COMMAND_TEXT_FOOTNOTE, 16); //$NON-NLS-1$ /** The small size */ public static final TextSize SIZE_SMALL = new TextSize("Small", PSTricksConstants.COMMAND_TEXT_SMALL, 17); //$NON-NLS-1$ /** The normal size */ public static final TextSize SIZE_NORMAL = new TextSize("Normal", PSTricksConstants.COMMAND_TEXT_NORMAL, 18); //$NON-NLS-1$ /** The large size */ public static final TextSize SIZE_LARGE1 = new TextSize("Large", PSTricksConstants.COMMAND_TEXT_LARGE1, 22); //$NON-NLS-1$ /** The very large size */ public static final TextSize SIZE_LARGE2 = new TextSize("Very large", PSTricksConstants.COMMAND_TEXT_LARGE2, 24); //$NON-NLS-1$ /** The very very large size */ public static final TextSize SIZE_LARGE3 = new TextSize("Very very large", PSTricksConstants.COMMAND_TEXT_LARGE3, 30); //$NON-NLS-1$ /** The huge size */ public static final TextSize SIZE_HUGE1 = new TextSize("huge", PSTricksConstants.COMMAND_TEXT_HUGE1, 35); //$NON-NLS-1$ /** The very huge size */ public static final TextSize SIZE_HUGE2 = new TextSize("Very huge", PSTricksConstants.COMMAND_TEXT_HUGE2, 44); //$NON-NLS-1$ /** The times new roman font */ public static final TextFont TEXTFONT_TIMES = new TextFont("Times New Roman", "ptm", "T1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ /** The courier font */ public static final TextFont TEXTFONT_COURIER = new TextFont("Courier New", "pcr", "T1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ /** The palatino font */ public static final TextFont TEXTFONT_PALATINO = new TextFont("Palatino Linotype", "ppl", "T1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ public static final TextFont TEXTFONT_DIALOG = new TextFont("Dialog", "Dialog.plain", "T1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ public static final TextFont TEXTFONT_DIALOG2 = new TextFont("Dialog", "Dialog", "T1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ /** The font used by default */ public static final TextFont DEFAULT_TEXTFONT = TEXTFONT_TIMES; /** The size by default of the text */ public static final TextSize DEFAULT_SIZE = SIZE_NORMAL; /** The style of the text by default */ public static final int DEFAULT_STYLE = Font.PLAIN; /** The current textFont */ protected TextFont currentTextFont; protected static final Graphics2D INS_GRAPHICS; protected static final FontMetrics INS_FONT_METRICS; protected static final FontRenderContext INS_FONT_RENDER_CONT; static { BufferedImage bufferImage = new BufferedImage(2, 2, BufferedImage.TYPE_INT_RGB); INS_GRAPHICS = bufferImage.createGraphics(); INS_GRAPHICS.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); INS_GRAPHICS.setFont(new Font(DEFAULT_TEXTFONT.getName(), DEFAULT_STYLE, DEFAULT_SIZE.getSize())); INS_FONT_METRICS = INS_GRAPHICS.getFontMetrics(); INS_FONT_RENDER_CONT = INS_GRAPHICS.getFontRenderContext(); bufferImage.flush(); bufferImage = null; } /** * The constructor by default */ public Text(boolean increaseMeter) { this("", new LaTeXDrawPoint2D(), increaseMeter);//$NON-NLS-1$ } /** * The constructor using two parameters * @param t The text * @param increaseMeter If true the meter of figures will be increased */ public Text(String t, boolean increaseMeter) { this(t, new LaTeXDrawPoint2D(), increaseMeter); } /** * The constructor using three parameters * @param t The text. * @param increaseMeter If true the meter of figures will be increased. * @param pos The position of the text. */ public Text(String t, LaTeXDrawPoint2D pos, boolean increaseMeter) { super(increaseMeter); opacityColor = DEFAULT_OPACITY_COLOR; hasChanged = true; textPos = new Vector(); multipleBox = new Vector(); multipleBoxDisplay = new Vector(); hasFramedBox = false; hasSimpleFramedBox = true; simpleBox = null; canHaveShadow = false; isBordersMovable = false; isResizable = false; isDashableOrDotable = false; isDoubleBoundaryable= false; isThicknessable = false; canBeFilled = false; currentFont = new Font(DEFAULT_TEXTFONT.getName(), DEFAULT_STYLE, DEFAULT_SIZE.getSize()); currentSize = DEFAULT_SIZE; currentTextFont = DEFAULT_TEXTFONT; isItalic = DEFAULT_ISITALIC; isBold = DEFAULT_ISBOLD; text = t==null ? "" : t; //$NON-NLS-1$ position = pos; borders = new LaTeXDrawRectangle((LaTeXDrawPoint2D)pos.clone(), (LaTeXDrawPoint2D)pos.clone(),false); borders.setIsFilled(true); borders.setBordersPosition(PSTricksConstants.BORDERS_OUTSIDE); fontMetrics = INS_FONT_METRICS; fontRenderContext = INS_FONT_RENDER_CONT; updateBorders(fontMetrics); shape = createShape2D(); textSizeDrawn = currentSize.getSize(); currentFont = new Font(currentFont.getFontName(), currentFont.getStyle(), (int)textSizeDrawn); updateFontsBorders(); hasChanged = true; } /** * Allows to know if the given label is a valid size of text * @param label The label to check * @return True if the label is valid */ public static boolean isValidSize(String label) { return label.equals(SIZE_TINY.getLabel()) || label.equals(SIZE_SMALL.getLabel()) || label.equals(SIZE_SCRIPT.getLabel()) || label.equals(SIZE_FOOTNOTE.getLabel()) || label.equals(SIZE_NORMAL.getLabel()) || label.equals(SIZE_LARGE1.getLabel()) || label.equals(SIZE_LARGE2.getLabel()) || label.equals(SIZE_LARGE3.getLabel()) || label.equals(SIZE_HUGE1.getLabel()) || label.equals(SIZE_HUGE2.getLabel()); } /** * Allows to create a list with the different size of text * @return The list */ public static JComboBox getChoiceSize() { JComboBox c = new JComboBox(); c.addItem(SIZE_TINY.getLabel()); c.addItem(SIZE_SCRIPT.getLabel()); c.addItem(SIZE_FOOTNOTE.getLabel()); c.addItem(SIZE_SMALL.getLabel()); c.addItem(SIZE_NORMAL.getLabel()); c.addItem(SIZE_LARGE1.getLabel()); c.addItem(SIZE_LARGE2.getLabel()); c.addItem(SIZE_LARGE3.getLabel()); c.addItem(SIZE_HUGE1.getLabel()); c.addItem(SIZE_HUGE2.getLabel()); return c; } /** * Allows to create a list of the different fonts. * @return The list */ public static JComboBox getChoiceFont() { JComboBox c = new JComboBox(); c.addItem(TEXTFONT_TIMES.getName()); c.addItem(TEXTFONT_COURIER.getName()); c.addItem(TEXTFONT_PALATINO.getName()); return c; } /** * Allows to update the borders of the text */ public synchronized void updateBorders() { updateBorders(fontMetrics); } /** * @since 1.7 * Update the simple or the complexes boxes of the text. */ public synchronized void updateFramedBoxes() { if(!hasFramedBox) return ; if(hasSimpleFramedBox) { if(simpleBox!=null) simpleBox.updateBoxSize(); } else { FramedBox.updateDimensions(multipleBox, this); updateBoxesOrder(); } } /** * Allows to update the borders of the text. It is possible that you need to * update the framed boxes before: updateFramedBoxes. */ public synchronized void updateBorders(FontMetrics f) { fontMetrics = f; if(hasSeveralBoxes() && !multipleBox.isEmpty()) { FramedBox.updateDimensions(multipleBox, this); return ; } if(text.length()!=0) { if(hasFramedBox && hasSimpleFramedBox && simpleBox!=null) { borders.setFirstPoint((LaTeXDrawPoint2D)simpleBox.getBorders().getPoint(0).clone()); borders.setLastPoint((LaTeXDrawPoint2D)simpleBox.getBorders().getPoint(-1).clone()); } else { TextLayout tl = new TextLayout(text, currentFont, fontRenderContext); Rectangle2D bounds = tl.getBounds(); borders.setFirstPoint(position.x+bounds.getX(), bounds.getY()+position.y); borders.setLastPoint(position.x+bounds.getWidth()+bounds.getX(), position.y+bounds.getHeight()+bounds.getY()); } gravityCenter = borders.getGravityCenter(); shape = createShape2D(); } } @Override public Object clone() throws CloneNotSupportedException { Text t = (Text) super.clone(); t.isOpaque = isOpaque; t.opacityColor = opacityColor; t.textPos = new Vector(); t.text = text; t.textSizeDrawn = textSizeDrawn; t.borders = (LaTeXDrawRectangle) borders.clone(); t.position = (LaTeXDrawPoint2D)t.position.clone(); t.hasFramedBox = hasFramedBox; t.hasSimpleFramedBox = hasSimpleFramedBox; t.updateBorders(fontMetrics); t.shape = t.createShape2D(); if(simpleBox!=null) { t.simpleBox = (FramedBox)simpleBox.clone(); t.simpleBox.setText(t); } t.multipleBox = new Vector(); t.multipleBoxDisplay = new Vector(); int i, size = multipleBox.size(); for(i=0; i(); interiorColor = (Color) ois.readObject(); lineStyle = (String) ois.readObject(); rotationAngle = ois.readDouble(); thickness = ois.readFloat(); isFilled = ois.readBoolean(); isSelected = ois.readBoolean(); isOnRotation = ois.readBoolean(); linesColor = (Color) ois.readObject(); blackDashLength = ois.readFloat(); dotSep = ois.readFloat(); whiteDashLength = ois.readFloat(); borders = (LaTeXDrawRectangle) ois.readObject(); text = (String) ois.readObject(); position = (LaTeXDrawPoint2D) ois.readObject(); currentFont = (Font)ois.readObject(); currentSize = (TextSize) ois.readObject(); currentTextFont = (TextFont) ois.readObject(); isItalic = ois.readBoolean(); isBold = ois.readBoolean(); textSizeDrawn = DrawContainer.DEFAULT_PIXPERCM; currentFont = new Font(currentTextFont.getName(), currentFont.getStyle(), currentSize.getSize()); multipleBoxDisplay = new Vector(); textPos = new Vector(); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.7")>=0)//$NON-NLS-1$ { hasFramedBox = ois.readBoolean(); hasSimpleFramedBox = ois.readBoolean(); isOpaque = ois.readBoolean(); simpleBox = (FramedBox)ois.readObject(); multipleBox = new Vector(); int size = ois.readInt(); for(int i=0; i(); } updateFontsBorders(); updateFramedBoxes(); shape = createShape2D(); textSizeDrawn = currentSize.getSize(); currentFont = new Font(currentFont.getFontName(), currentFont.getStyle(), (int)textSizeDrawn); updateFontsBorders(); hasChanged = true; } /** * Allows to update the Font, the FontMetrics and * the borders of the text. */ public void updateFontsBorders() { INS_GRAPHICS.setFont(getCurrentFont()); fontRenderContext = INS_GRAPHICS.getFontRenderContext(); updateBorders(INS_GRAPHICS.getFontMetrics()); } @Override public Shape createNonRotatedShape2D() { return borders.createNonRotatedShape2D(); } @Override public synchronized void updateShape() { shape = createShape2D(); } /** * @return the currentFont */ public synchronized Font getCurrentFont() { return currentFont; } /** * Allows to get the width of the text. * @return The width of the text. */ public synchronized double getWidth() { return fontMetrics.stringWidth(getText()); } /** * Allows to get the height of the text. * @return The height of the text. */ public synchronized double getHeight() { return fontMetrics.getHeight(); } /** * @return the fontMetrics */ public synchronized FontMetrics getFontMetrics() { return fontMetrics; } @Override public synchronized boolean isTooSmallToBeRescaled() { return true; } /** * @since 1.7 * @return the simpleBox */ public synchronized FramedBox getSimpleBox() { return simpleBox; } /** * @return the hasFramedBox */ public synchronized boolean hasFramedBox() { return hasFramedBox; } /** * @param hasFramedBox the hasFramedBox to set */ public synchronized void setHasFramedBox(boolean hasFramedBox) { this.hasFramedBox = hasFramedBox; if(simpleBox==null) simpleBox = new FramedBox(this); updateFramedBoxes(); hasChanged = true; } /** * @return the hasSimpleFramedBox */ public synchronized boolean hasSimpleFramedBox() { return hasSimpleFramedBox && hasFramedBox(); } /** * Must be used with setHasFramedBox. * @param hasSimpleFramedBox the hasSimpleFramedBox to set. */ public synchronized void setHasSimpleFramedBox(boolean hasSimpleFramedBox) { if(hasSimpleFramedBox) isOpaque = false; this.hasSimpleFramedBox = hasSimpleFramedBox; if(simpleBox==null) simpleBox = new FramedBox(this); updateBorders(); hasChanged = true; } /** * @since 1.7 * @param simpleBox the simpleBox to set. */ public synchronized void setSimpleBox(FramedBox simpleBox) { if(simpleBox==null) return ; Figure box = simpleBox.getBox(); if(box!=null && (box instanceof LaTeXDrawRectangle || box instanceof Circle || box instanceof Ellipse || box instanceof Triangle || box instanceof Rhombus)) this.simpleBox = simpleBox; this.simpleBox.text = this; hasChanged = true; } /** * @return the fontRenderContext. */ public synchronized FontRenderContext getFontRenderContext() { return fontRenderContext; } @Override public boolean intersected(Rectangle2D.Double r) { if(hasFramedBox() && hasSimpleFramedBox() && simpleBox!=null) { Shape s = simpleBox.getBox().createShape2D(); return s.intersects(r) && !s.contains(r); } Shape s; if(shape==null) s = createShape2D(); else s = shape; return s.intersects(r) && !s.contains(r); } /** * @since 1.7 * @return the isOpaque. */ public synchronized boolean isOpaque() { return isOpaque; } /** * @since 1.7 * @param isOpaque the isOpaque to set. */ public synchronized void setOpaque(boolean isOpaque) { this.isOpaque = isOpaque; if(isOpaque) hasSimpleFramedBox = false; updateBorders(); hasChanged = true; } /** * @return True if the text has several framed boxes (not only or no one). */ public synchronized boolean hasSeveralBoxes() { return hasFramedBox && !hasSimpleFramedBox; } /** * Allows to add a box to frame a part of the text. * @since 1.7 * @param box The new box to add. * @return True if the box has been added and false of it is not possible. */ public synchronized boolean addBox(FramedBox box) { if(multipleBox==null) multipleBox = new Vector(); if(box==null) return false; boolean valid = true; int i=0, size = multipleBox.size(); while(valid && i getMultipleBox() { return multipleBox; } /** * Update the position of the elements of the text by taking account of the * multiple boxes. */ public void updateTextPosition() { if(!hasSeveralBoxes()) return ; textPos.removeAllElements(); textPos.add(new TextPosition(0,text.length()-1, (LaTeXDrawPoint2D)position.clone())); boolean found, ok; int i, size, j; TextPosition tp, add; double x; for(FramedBox fb : multipleBox) { i=0; found = false; size = textPos.size(); while(i=textPos.elementAt(i).start && fb.end<=(textPos.elementAt(i).end+1)) found = true; else i++; if(found) { tp = textPos.elementAt(i); if(fb.start!=tp.start || (fb.end-1)!=tp.end) { textPos.remove(i); x = tp.pos.x + (tp.start==fb.start ? 0 : fontMetrics.stringWidth(text.substring(tp.start, fb.start))); if(fb.start>tp.start) textPos.add(i++, new TextPosition(tp.start, fb.start-1, (LaTeXDrawPoint2D)tp.pos.clone())); add = new TextPosition(fb.start, fb.end-1, x, tp.pos.y); textPos.add(i++, add); if((fb.end-1)textPos.elementAt(i).start && fb.start<(textPos.elementAt(i).end+1)) found = true; else i++; if(found) { tp = textPos.remove(i); if(fb.start>tp.start) textPos.add(i++, new TextPosition(tp.start, fb.start-1, (LaTeXDrawPoint2D)tp.pos.clone())); x = tp.pos.x + fontMetrics.stringWidth(text.substring(tp.start, fb.start)); add = new TextPosition(fb.start, tp.end, x, tp.pos.y); textPos.add(i, add); } found = false; i=0; size = textPos.size(); while(!found && itextPos.elementAt(i).start && fb.end<(textPos.elementAt(i).end+1)) found = true; else i++; if(found) { tp = textPos.remove(i); add = new TextPosition(tp.start, fb.end-1, (LaTeXDrawPoint2D)tp.pos.clone()); textPos.add(i, add); if(fb.end<(tp.end+1)) { x = tp.pos.x + fontMetrics.stringWidth(text.substring(tp.start, fb.end)); textPos.add(i+1, new TextPosition(fb.end, tp.end, x, tp.pos.y)); } } }//else }//for // We update the TextPostion of the FramedBox Vector boxes = new Vector(); Vector tps = new Vector(); FramedBox fb; for(FramedBox fb2 : multipleBox) { fb2.removeAllTextPosition(); boxes.add(fb2); } for(TextPosition tp2 : textPos) tps.add(tp2); while(!boxes.isEmpty()) { found = false; i=0; size = boxes.size(); while(!found && i=fb.start && (tp2.end+1)<=fb.end) { tps.remove(tp2); fb.addTextPosition(tp2); } else i++; } }//while } /** * @since 1.7 * @return the textPos. */ public synchronized Vector getTextPos() { return textPos; } /** * @since 1.7 * @return The first textPosition (where start==0 and pos.x is min) of the vector. */ public synchronized TextPosition getFirstTextPosition() { if(textPos==null || textPos.isEmpty()) return null; TextPosition tp = null; for(TextPosition tp2 : textPos) if(tp2.start==0) if(tp==null) tp = tp2; else if(tp.pos.x>tp2.pos.x) tp = tp2; return tp; } /** * @since 1.7 * @return The last textPosition (where end==text.length-1 and pos.x is max) of the vector. */ public synchronized TextPosition getLastTextPosition() { if(textPos==null || textPos.isEmpty()) return null; TextPosition tp = null; int size = text.length()-1; for(TextPosition tp2 : textPos) if(tp2.end==size) if(tp==null) tp = tp2; else if(tp.pos.x boxes = new Vector(); for(FramedBox fb : multipleBox) boxes.add(fb); multipleBoxDisplay.removeAllElements(); while(!boxes.isEmpty()) { FramedBox first=null, fb; int start=text.length()+1, i; for(i = boxes.size()-1; i>=0; i--) { fb = boxes.elementAt(i); if(fb.start getMultipleBoxDisplay() { return multipleBoxDisplay; } /** * @param size The size to test. * @return The text size constant that has the closest size than the given size. */ public static TextSize getClosestTextSize(float size) { if(size<=SIZE_TINY.getSize()) return SIZE_TINY; if(size<=SIZE_SCRIPT.getSize()) return (SIZE_SCRIPT.getSize()-size) *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class Triangle extends LaTeXDrawPolygon implements BordersMovable { private static final long serialVersionUID = 1L; /** The number of points in a triangle */ public static final short NB_PTS_TRIANGLE = 3; /** * The constructor by default */ public Triangle(boolean increaseMeter) { this(new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), increaseMeter); } /** * @param f The figure to copy. * @param sameNumber True if the figure will have the same number of the copy. */ public Triangle(Figure f, boolean sameNumber) { super(f, sameNumber); if(f==null) return ; LaTeXDrawRectangle b = f.getBorders(); if(b==null) return ; borders = new LaTeXDrawRectangle(getPoint(0), getPoint(1), getPoint(2), getPoint(3), false); updateGravityCenter(); shape = getInsideOutsideOrMiddleBorders(); updateGravityCenter(); isBordersMovable = true; } /** * The constructor using four points * @param pt1 The top left point of rectangle containing the triangle * @param pt2 The top right point of the rectangle containing the triangle * @param pt3 The bottom left point * @param pt4 The bottom right point */ public Triangle(LaTeXDrawPoint2D pt1, LaTeXDrawPoint2D pt2, LaTeXDrawPoint2D pt3, LaTeXDrawPoint2D pt4, boolean increaseMeter) { super(pt1, pt2, pt3, pt4, increaseMeter); borders = new LaTeXDrawRectangle(pt1, pt2, pt3, pt4, false); shape = getInsideOutsideOrMiddleBorders(); updateGravityCenter(); isBordersMovable = true; } @Override public boolean addPoint(LaTeXDrawPoint2D pt) { if(pts==null) pts = new Vector(); if(pt!=null) { Delimitor d = new Delimitor(pt); d.setColorSet3(); delimiters.add(d); pts.add(pt); return true; } return false; } @Override public Shape createShape2D() { LaTeXDrawPoint2D NW = getTheNWPoint(), SE = getTheSEPoint(); Shape area = createNonRotatedShape2D(); if(rotationAngle % (Math.PI*2)!= 0.) { double cx = (NW.x + SE.x) / 2., cy = (NW.y + SE.y) / 2.; double c2x = Math.cos(rotationAngle) * cx - Math.sin(rotationAngle)* cy; double c2y = Math.sin(rotationAngle) * cx + Math.cos(rotationAngle)* cy; AffineTransform at = AffineTransform.getTranslateInstance(cx - c2x, cy - c2y); at.rotate(rotationAngle); area = at.createTransformedShape(area); } return area; } @Override public Shape createNonRotatedShape2D() { Shape area; Shape s = getInsideOutsideOrMiddleBorders(); if(hasDoubleBoundary) { Shape[] s2 = getDbleBoundariesOutInOrMiddle(s); Shape min; Shape max; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) { max = s; min = s2[1]; } else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) { max = s2[0]; min = s2[1]; } else { max = s2[0]; min = s; } area = new Area(max); ((Area)area).exclusiveOr(new Area(min)); } else area = s; return area; } @Override public void draw(Graphics2D g, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering) { LaTeXDrawPoint2D NW = borders.getTheNWPoint(), SE = borders.getTheSEPoint(); double cx = (NW.x+SE.x)/2., cy = (NW.y+SE.y)/2.; double c2x = Math.cos(rotationAngle)*cx - Math.sin(rotationAngle)*cy; double c2y = Math.sin(rotationAngle)*cx + Math.cos(rotationAngle)*cy; double c3x = Math.cos(-rotationAngle)*(cx-c2x) - Math.sin(-rotationAngle)*(cy-c2y); double c3y = Math.sin(-rotationAngle)*(cx-c2x) + Math.cos(-rotationAngle)*(cy-c2y); double dx=0, dy=0; boolean changeFillStyle = false; if(rotationAngle%(Math.PI*2)!=0) { g.rotate(rotationAngle); g.translate(c3x,c3y); } if(hasShadow) { LaTeXDrawPoint2D cg = getGravityCenter(); LaTeXDrawPoint2D shadowCg = (LaTeXDrawPoint2D)cg.clone(); shadowCg.setLocation(cg.x+shadowSize, cg.y); shadowCg = Figure.rotatePoint(shadowCg, cg, shadowAngle); dx = shadowCg.x-cg.x; dy = cg.y-shadowCg.y; } Color formerCol = g.getColor(); if(hasDoubleBoundary) { Shape s0 = shape; Shape s[] = getDbleBoundariesOutInOrMiddle(s0); Shape s1, s2, s3; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) { s1 = s0; s2 = s[0]; s3 = s[1]; } else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) { s1 = s[0]; s2 = s0; s3 = s[1]; } else { s1 = s[0]; s2 = s[1]; s3 = s0; } if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) { if(hasShadow) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.fill(s1); g.draw(s1); g.translate(-dx, -dy); if(!isFilled) { changeFillStyle = true; isFilled = true; } } g.setColor(doubleColor); g.setStroke(new BasicStroke((float)(doubleSep + thickness), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.draw(s2); fillFigure(g, antiAlias, rendering, alphaInter, colorRendering,s3); g.setColor(linesColor); g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.draw(s1); g.draw(s3); } else { if(hasShadow) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.fill(s1); g.draw(s1); g.translate(-dx, -dy); g.setColor(interiorColor); g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.draw(s2); if(!isFilled) { changeFillStyle = true; isFilled = true; } } if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[]{ 0, (float)(thickness*2+doubleSep + dotSep) }, 0)); else g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[] { blackDashLength, whiteDashLength }, 0)); fillFigure(g, antiAlias, rendering, alphaInter, colorRendering, s2); g.setColor(linesColor); g.draw(s2); g.setStroke(new BasicStroke((float)doubleSep, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.setColor(doubleColor); g.draw(s2); } } else { if(hasShadow) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.fill(shape); g.draw(shape); g.translate(-dx, -dy); if(!isFilled) { changeFillStyle = true; isFilled = true; } g.setColor(interiorColor); g.draw(shape); } if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); else if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[] { 0, thickness + dotSep }, 0)); else g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[] { blackDashLength, whiteDashLength }, 0)); if(shape==null) shape = getInsideOutsideOrMiddleBorders(); fillFigure(g, antiAlias, rendering, alphaInter, colorRendering,shape); g.setColor(linesColor); g.draw(shape); } if(changeFillStyle) isFilled = false; g.setColor(formerCol); if(rotationAngle%(Math.PI*2)!=0) { g.translate(-c3x, -c3y); g.rotate(-rotationAngle); } if(isSelected) borders.draw(g, false, antiAlias, rendering, alphaInter, colorRendering); } @Override public void setLastPoint(LaTeXDrawPoint2D pt) { borders.setLastPoint(pt); updateGravityCenter(); shape = getInsideOutsideOrMiddleBorders(); } @Override public void setFirstPoint(LaTeXDrawPoint2D pt) { borders.setFirstPoint(pt); updateGravityCenter(); shape = getInsideOutsideOrMiddleBorders(); } @Override public synchronized void setBordersPosition(String doubleLinePosition) { super.setBordersPosition(doubleLinePosition); shape = getInsideOutsideOrMiddleBorders(); } @Override public synchronized void setRotationAngle(double theta) { if(!Double.isNaN(theta) && !Double.isInfinite(theta)) { rotationAngle = theta%(Math.PI*2); if(borders!=null) borders.setRotationAngle(rotationAngle); } } @Override public synchronized void shift(double shiftX,double shiftY) { if(shiftX==0 && shiftY==0) return ; borders.shift(shiftX, shiftY); updateShape(); } @Override public void onDragged(Point formerPt, Point newPt) throws Exception { if(formerPt.equals(newPt)) return; borders.onDragged(formerPt, newPt); rotationAngle = borders.getRotationAngle();//update the angle (when rotation) updateShape(); } @Override public synchronized String getCodePSTricks(DrawBorders drawBorders, float ppc) { LaTeXDrawPoint2D d = drawBorders.getOriginPoint(); LaTeXDrawPoint2D NW = getTheNWPoint(), SE = getTheSEPoint(); float baseX = (float) ((NW.x+SE.x)/2. - d.x), baseY = (float) (d.y - SE.y) ; String add="", fillType=""; //$NON-NLS-1$ //$NON-NLS-2$ String addBegin = "";//$NON-NLS-1$ String addEnd = "";//$NON-NLS-1$ LaTeXDrawPoint2D pt1 = borders.getPoint(0), pt2 = borders.getPoint(2); boolean isFilledWasChanged = false; double threshold = 0.001; if(pt1.y>pt2.y || rotationAngle%(Math.PI*2)!=0.) { double angle = -Math.toDegrees(rotationAngle); if(pt1.y>pt2.y) angle-=180; double angleRad = Math.toRadians(angle); double cx = (gravityCenter.x-d.x)/ppc; double cy = (d.y-gravityCenter.y)/ppc; double x = -Math.cos(angleRad)*cx+Math.sin(angleRad)*cy+cx; double y = -Math.sin(angleRad)*cx-Math.cos(angleRad)*cy+cy; if(Math.abs(x) < 0.001) x = 0; if(Math.abs(y) < 0.001) y = 0; addBegin +="\\rput{"+(float)angle+ "}("+(float)x+','+(float)y+"){"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addEnd = "}"; //$NON-NLS-1$ } if(hasShadow) { fillType+=",shadow=true";//$NON-NLS-1$ fillType+=",shadowangle="+LaTeXDrawNumber.getCutNumber((float)(Math.toDegrees(shadowAngle)-(pt1.y>pt2.y?180:0)),threshold);//$NON-NLS-1$ if(((float)shadowSize)!=((float)DEFAULT_SHADOW_SIZE)) fillType+=",shadowsize="+LaTeXDrawNumber.getCutNumber((float)(shadowSize/PPC),threshold);//$NON-NLS-1$ if(!shadowColor.equals(PSTricksConstants.DEFAULT_SHADOW_COLOR)) { String name = DviPsColors.getColourName(shadowColor); if(name==null) { name = "color"+number+'e';//$NON-NLS-1$ DviPsColors.addUserColour(shadowColor, name); } fillType += ",shadowcolor=" + name; //$NON-NLS-1$ } if(!isFilled) { isFilled = true; isFilledWasChanged = true; } } String str = getPSTricksCodeFilling(ppc); if(str.length()>0) fillType=fillType+','+str; str = getPSTricksCodeLine(ppc); if(str.length()>0) add=add+','+str; add+=",dimen="+bordersPosition; //$NON-NLS-1$ if(hasDoubleBoundary) { add+=",doubleline=true,doublesep="+LaTeXDrawNumber.getCutNumber((float)(doubleSep/ppc),threshold); //$NON-NLS-1$ if(doubleColor!=PSTricksConstants.DEFAULT_DOUBLE_COLOR) { String name = DviPsColors.getColourName(doubleColor); if(name==null) { name = "color"+number+'d';//$NON-NLS-1$ DviPsColors.addUserColour(doubleColor, name); } add+= ",doublecolor="+name; //$NON-NLS-1$ } } if(isFilledWasChanged) isFilled = false; return addBegin+"\\pstriangle[linewidth=" + //$NON-NLS-1$ LaTeXDrawNumber.getCutNumber(thickness/ppc,threshold) + add + fillType + "](" //$NON-NLS-1$ + LaTeXDrawNumber.getCutNumber(baseX/ppc, threshold) + ',' + LaTeXDrawNumber.getCutNumber(baseY/ppc, threshold) + ")(" //$NON-NLS-1$ + LaTeXDrawNumber.getCutNumber((float)(Math.abs(NW.x-SE.x)/ppc),threshold) + ',' + LaTeXDrawNumber.getCutNumber((float)(Math.abs(NW.y-SE.y)/ppc),threshold) + ')'+addEnd; } /** * Allows to get the south-east point by taking into account * the angle of rotation. * @return The south-east point of the rotated rectangle */ @Override public LaTeXDrawPoint2D getTheSERotatedPoint() { if(borders!=null) return borders.getTheSERotatedPoint(); return null; } /** * Allows to get the north-west point by taking into account * the angle of rotation. * @return The north-west point of the rotated rectangle */ @Override public LaTeXDrawPoint2D getTheNWRotatedPoint() { if(borders!=null) return borders.getTheNWRotatedPoint(); return null; } @Override public boolean isIn(LaTeXDrawPoint2D p) { LaTeXDrawPoint2D pt = rotateInvertPoint(p); if(isSelected && (borders.dNE.isIn(pt) || borders.dNW.isIn(pt) || borders.dSE.isIn(pt) || borders.dSW.isIn(pt) || borders.dS.isIn(pt) || borders.dN.isIn(pt) || borders.dE.isIn(pt) || borders.dW.isIn(pt))) return true; GeneralPath path; if(hasDoubleBoundary) { if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) path = getBorders(0, true); else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) path = getBorders(thickness*2+doubleSep, false); else path = getBorders((thickness*2+doubleSep)*2, false); if(!path.contains(pt)) return false; if(isFilled || hasShadow || hasGradient()) return true; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) path = getBorders((thickness*2+doubleSep)*2, true); else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) path = getBorders(doubleSep+2*thickness, true); else path = getBorders(0, true); } else { if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) path = getBorders(0, true); else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) path = getBorders(thickness, false); else path = getBorders(thickness*2, false); if(!path.contains(pt)) return false; if(isFilled || hasShadow || hasGradient()) return true; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) path = getBorders(thickness*2, true); else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) path = getBorders(thickness, true); else path = getBorders(0, true); } return !path.contains(pt); } @Override public Object clone() throws CloneNotSupportedException { Triangle t = (Triangle) super.clone(); t.borders = new LaTeXDrawRectangle(t.getPoint(0), t.getPoint(1), t.getPoint(2), t.getPoint(3), false); t.setThickness(thickness); t.updateShape(); return t; } @SuppressWarnings("unchecked") private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { canHaveShadow = true; interiorColor = (Color) ois.readObject(); lineStyle = (String) ois.readObject(); rotationAngle = ois.readDouble(); thickness = ois.readFloat(); isFilled = ois.readBoolean(); isSelected = ois.readBoolean(); isOnRotation = ois.readBoolean(); linesColor = (Color) ois.readObject(); blackDashLength = ois.readFloat(); dotSep = ois.readFloat(); whiteDashLength = ois.readFloat(); pts = (Vector) ois.readObject(); borders = (LaTeXDrawRectangle) ois.readObject(); delimiters = new Vector(); for(int i=0, size = pts.size();i=0)//$NON-NLS-1$ { hasDoubleBoundary = ois.readBoolean(); doubleColor = (Color)ois.readObject(); doubleSep = ois.readDouble(); bordersPosition = (String)ois.readObject(); if(!(LaTeXDrawFrame.getVersionOfFile().compareTo("1.6")>=0)) //$NON-NLS-1$ ois.readBoolean(); hatchingAngle = ois.readDouble(); hatchingColor = (Color)ois.readObject(); hatchingStyle = (String)ois.readObject(); hatchingWidth = ois.readFloat(); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.6") < 0)//$NON-NLS-1$ { if(hatchingStyle.equals(DECREPETED_FILL_CROSS)) hatchingStyle = PSTricksConstants.TOKEN_FILL_CROSSHATCH; else if(hatchingStyle.equals(DECREPETED_FILL_HORIZ)) hatchingStyle = PSTricksConstants.TOKEN_FILL_HLINES; else if(hatchingStyle.equals(DECREPETED_FILL_VERT)) hatchingStyle = PSTricksConstants.TOKEN_FILL_VLINES; else if(hatchingStyle.equals(DECREPETED_FILL_NO)) hatchingStyle = PSTricksConstants.TOKEN_FILL_NONE; } } else { hasDoubleBoundary = DEFAULT_HAS_DOUBLE_BOUNDARY; doubleColor = DEFAULT_DOUBLE_COLOR; doubleSep = DEFAULT_DOUBLESEP; bordersPosition = DEFAULT_BORDERS_POSITION; hatchingAngle = DEFAULT_HATCH_ANGLE; hatchingColor = DEFAULT_HATCH_COL; hatchingStyle = DEFAULT_HATCH_STYLE; hatchingWidth = DEFAULT_HATCH_WIDTH; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.7")>=0) //$NON-NLS-1$ { hasShadow = ois.readBoolean(); shadowAngle = ois.readDouble(); shadowSize = ois.readDouble(); shadowColor = (Color)ois.readObject(); gradientEndColor = (Color)ois.readObject(); gradientStartColor = (Color)ois.readObject(); gradientAngle = ois.readDouble(); gradientMidPoint = ois.readDouble(); } else { hasShadow = DEFAULT_SHADOW_HAS; shadowAngle = DEFAULT_SHADOW_ANGLE; shadowSize = DEFAULT_SHADOW_SIZE; shadowColor = DEFAULT_SHADOW_COLOR; gradientEndColor = PSTricksConstants.DEFAULT_GRADIENT_END_COLOR; gradientStartColor = PSTricksConstants.DEFAULT_GRADIENT_START_COLOR; gradientAngle = DEFAULT_GRADIENT_ANGLE; gradientMidPoint = DEFAULT_GRADIENT_MID_POINT; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.8")>=0) //$NON-NLS-1$ hatchingSep = ois.readDouble(); else hatchingSep = DEFAULT_HATCH_SEP; shape = getInsideOutsideOrMiddleBorders(); } @Override protected GeneralPath getBorders(double gap, boolean into) { if(gap==0.) return getMiddleBorders(); GeneralPath gp = new GeneralPath(); LaTeXDrawPoint2D pt1 = getPoint(0), pt2 = getPoint(-1); if(pt1.xpt2.x-thickness) { gp.moveTo((float)(pt1.x+pt2.x)/2f, (float)pt1.y); gp.lineTo((float)(pt1.x+pt2.x)/2f, (float)pt2.y); } else if(pt1.ypt2.y-thickness) { gp.moveTo((float)pt1.x, (float)(pt1.y+pt2.y)/2f); gp.lineTo((float)pt2.x, (float)(pt1.y+pt2.y)/2f); } else { if(!into) gap*=-1; LaTeXDrawPoint2D p1 = new LaTeXDrawPoint2D((pt1.x+pt2.x)/2., pt1.y); LaTeXDrawPoint2D p2 = new LaTeXDrawPoint2D(pt2.x, pt2.y); LaTeXDrawPoint2D p3 = new LaTeXDrawPoint2D(pt1.x, pt2.y); double cornerGap1 = Figure.getCornerGap(new LaTeXDrawPoint2D(p1.x, p2.y), p1, p2, gap)/2.; double cornerGap2 = Figure.getCornerGap(getGravityCenter(), p2, p3, gap)/2.; if(p2.xp2.y) cornerGap1*=-1; gp.moveTo((float)p1.x, (float)(p1.y + cornerGap1)); gp.lineTo((float)(p2.x - cornerGap2), (float)(p2.y + (p1.y>p2.y ? gap/2. : -gap/2.))); gp.lineTo((float)(p3.x + cornerGap2), (float)(p2.y + (p1.y>p2.y ? gap/2. : -gap/2.))); gp.closePath(); } return gp; } public GeneralPath getInsideBorders() { return getBorders(thickness, true); } public GeneralPath getOutsideBorders() { return getBorders(thickness, false); } public GeneralPath getMiddleBorders() { LaTeXDrawPoint2D pt1 = getPoint(0), pt2 = getPoint(-1); GeneralPath gp = new GeneralPath(); gp.moveTo((float)(pt2.x + pt1.x)/2f, (float)pt1.y); gp.lineTo((float)pt1.x, (float)pt2.y); gp.lineTo((float)pt2.x, (float)pt2.y); gp.closePath(); return gp; } @Override public GeneralPath getInsideOutsideOrMiddleBorders() { GeneralPath path; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) path = getInsideBorders(); else if(bordersPosition.equals(PSTricksConstants.BORDERS_OUTSIDE)) path = getOutsideBorders(); else path = getMiddleBorders(); return path; } @Override public GeneralPath[] getDbleBoundariesOutside(Shape classicBord) { LaTeXDrawPoint2D pt1 = getPoint(0), pt2 = getPoint(-1); GeneralPath[] sx = new GeneralPath[2]; if(pt1.xpt2.x-thickness) { sx[0] = new GeneralPath(classicBord); sx[1] = new GeneralPath(classicBord); } else { sx[0] = getBorders(3*thickness+2*doubleSep, false); sx[1] = getBorders(2*thickness+doubleSep, false); } return sx; } @Override public GeneralPath[] getDbleBoundariesInside(Shape classicBord) { LaTeXDrawPoint2D pt1 = getPoint(0), pt2 = getPoint(-1); GeneralPath[] sx = new GeneralPath[2]; if(pt1.xpt2.x-thickness) { sx[0] = new GeneralPath(classicBord); sx[1] = new GeneralPath(classicBord); } else { sx[1] = getBorders(3*thickness+2*doubleSep, true); sx[0] = getBorders(2*thickness+doubleSep, true); } return sx; } @Override public GeneralPath[] getDbleBoundariesMiddle(Shape classicBord) { LaTeXDrawPoint2D pt1 = getPoint(0), pt2 = getPoint(-1); GeneralPath[] sx = new GeneralPath[2]; if(pt1.xpt2.x-thickness) { sx[0] = new GeneralPath(classicBord); sx[1] = new GeneralPath(classicBord); } else { sx[0] = getBorders(thickness+doubleSep, false); sx[1] = getBorders(thickness+doubleSep, true); } return sx; } @Override public GeneralPath[] getDbleBoundariesOutInOrMiddle(Shape classicBord) { GeneralPath[] path; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) path = getDbleBoundariesInside(classicBord); else if(bordersPosition.equals(PSTricksConstants.BORDERS_OUTSIDE)) path = getDbleBoundariesOutside(classicBord); else path = getDbleBoundariesMiddle(classicBord); return path; } @Override public synchronized void setThickness(float val) { if(!Double.isInfinite(val) && !Double.isNaN(val) && val>0) { thickness = val; shape = getInsideOutsideOrMiddleBorders(); borders.setThickness(thickness); } } @Override @Deprecated public void updateBorders() { /* * Update the borders change the points of the triangle. */ } @Override public Shape createShadowShape() { if(!canHaveShadow || !hasShadow) return shape; Shape shadowS; if(hasDoubleBoundary) { if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) shadowS = getBorders(0, true); else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) shadowS = getBorders(thickness*2+doubleSep, false); else shadowS = getBorders((thickness*2+doubleSep)*2, false); } else { if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) shadowS = getBorders(0, false); else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) shadowS = getBorders(thickness, false); else shadowS = getBorders(thickness*2, false); } double dx=0, dy=0; LaTeXDrawPoint2D cg = getGravityCenter(); LaTeXDrawPoint2D shadowCg = (LaTeXDrawPoint2D)cg.clone(); AffineTransform at = new AffineTransform(); shadowCg.setLocation(cg.x+shadowSize, cg.y); shadowCg = Figure.rotatePoint(shadowCg, cg, shadowAngle); dx = shadowCg.x-cg.x; dy = cg.y-shadowCg.y; at.translate(dx, dy); return at.createTransformedShape(shadowS); } @Override public String getPSTricksCodeFilling(float ppc) { String str="fillstyle=";//$NON-NLS-1$ if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_NONE)) { if(isFilled) str += "solid"; //$NON-NLS-1$ else str = "";//$NON-NLS-1$ } else if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_GRADIENT)) { str+= "gradient,gradlines=2000";//$NON-NLS-1$ if(!gradientStartColor.equals(PSTricksConstants.DEFAULT_GRADIENT_START_COLOR)) { String name = DviPsColors.getColourName(gradientStartColor); if(name==null) { name = "color"+number+'g';//$NON-NLS-1$ DviPsColors.addUserColour(gradientStartColor, name); } str += ",gradbegin=" + name; //$NON-NLS-1$ } if(!gradientEndColor.equals(PSTricksConstants.DEFAULT_GRADIENT_END_COLOR)) { String name = DviPsColors.getColourName(gradientEndColor); if(name==null) { name = "color"+number+'f';//$NON-NLS-1$ DviPsColors.addUserColour(gradientEndColor, name); } str += ",gradend=" + name; //$NON-NLS-1$ } if(gradientMidPoint!=PSTricksConstants.DEFAULT_GRADIENT_MID_POINT) str+=",gradmidpoint="+(float)gradientMidPoint;//$NON-NLS-1$ boolean reverse = getPoint(0).y>getPoint(2).y; if(Math.toDegrees(gradientAngle)!=PSTricksConstants.DEFAULT_GRADIENT_ANGLE || (reverse && (Math.toDegrees(gradientAngle)+180)!=PSTricksConstants.DEFAULT_GRADIENT_ANGLE)) str+=",gradangle="+(float)(toDegrees(gradientAngle)-//$NON-NLS-1$ (reverse? 180 : 0)); } else { if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_CROSSHATCH)) str += "crosshatch"; //$NON-NLS-1$ else if (hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_HLINES)) str += "hlines"; //$NON-NLS-1$ else str += "vlines"; //$NON-NLS-1$ if(isFilled) str += "*"; //$NON-NLS-1$ str += ",hatchwidth=" + (hatchingWidth / ppc) + ",hatchangle=" + //$NON-NLS-1$ //$NON-NLS-2$ (float)Math.toDegrees(hatchingAngle); if(!hatchingColor.equals(PSTricksConstants.DEFAULT_HATCHING_COLOR)) { String name = DviPsColors.getColourName(hatchingColor); if(name==null) { name = "color"+number+'c';//$NON-NLS-1$ DviPsColors.addUserColour(hatchingColor, name); } str += ",hatchcolor=" + name; //$NON-NLS-1$ } } if(isFilled) { if (!interiorColor.equals(PSTricksConstants.DEFAULT_INTERIOR_COLOR)) { String name = DviPsColors.getColourName(interiorColor); if(name==null) { name = "color"+number+'b';//$NON-NLS-1$ DviPsColors.addUserColour(interiorColor, name); } str += ",fillcolor=" + name; //$NON-NLS-1$ } } return str; } @Override @Deprecated public void updateBorders(LaTeXDrawPoint2D pt) { // Nothing must be done. } @Override public void mirrorHorizontal(LaTeXDrawPoint2D origin) { borders.mirrorHorizontal(origin); updateShape(); } @Override public void mirrorVertical(LaTeXDrawPoint2D origin) { borders.mirrorVertical(origin); updateShape(); } @Override public synchronized LaTeXDrawPoint2D getLastPoint() { return borders.getLastPoint(); } @Override public void updateToGrid(MagneticGrid grid) { borders.updateToGrid(grid); updateShape(); } @Override public void rescaleX(double formerX, double newX, double percent, LaTeXDrawRectangle bound) { borders.rescaleX(formerX, newX, percent, bound); updateShape(); } @Override public void rescaleY(double formerY, double newY, double percent, LaTeXDrawRectangle bound) { borders.rescaleY(formerY, newY, percent, bound); updateShape(); } /** * Computes the altitude ha of the right-triangle ABC, right in A. * @param a The point A. * @param b The point B. * @param c The point C. * @return The altitude ha or 0. * @since 2.0.0 */ public static double getAltitude(Point2D a, Point2D b, Point2D c) { if(a==null || b==null || c==null) return 0.; double ac = a.distance(c), ab = a.distance(b); if(((float)ab) == ((float)ac)) return a.distance((b.getX()+c.getX())/2., (b.getY()+c.getY())/2.); return ab * ac / b.distance(c); } @Override public int hashCode() { return (int)(super.hashCode()/3.5); } } latexdraw-2.0.8+1.orig/latexDraw/figures/JoinedLines.java0000644000000000000000000005245111347255510020154 0ustar package latexDraw.figures; import java.awt.*; import java.awt.geom.GeneralPath; import java.awt.geom.Line2D; import java.awt.geom.Rectangle2D; import java.io.IOException; import java.io.ObjectInputStream; import java.util.Vector; import latexDraw.figures.properties.Arrowable; import latexDraw.psTricks.DviPsColors; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.ui.components.Delimitor; import latexDraw.util.LaTeXDrawNumber; import latexDraw.util.LaTeXDrawPoint2D; /** * This class defines a kind of figure: joined lines.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details.
    *
    * 01/28/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class JoinedLines extends LaTeXDrawPolygon implements Arrowable { private static final long serialVersionUID = 1L; /** the arrowhead of the first line. */ private ArrowHead arrowHead1; /** The arrowhead of the last line. */ private ArrowHead arrowHead2; /** * The constructor using two points * @param pt1 The first point of the polygon * @param pt2 The second point of the polygon */ public JoinedLines(LaTeXDrawPoint2D pt1, LaTeXDrawPoint2D pt2, boolean increaseMeter) { super(pt1, pt2, increaseMeter); canBeFilled = true; isBordersMovable = false; isDoubleBoundaryable = true; canHaveArrow = true; shape = getInsideOutsideOrMiddleBorders(); arrowHead1 = new ArrowHead(pt1, new Line(pt1, pt2, false), this); arrowHead2 = new ArrowHead(pt2, new Line(pt2, pt1, false), this); } /** * Allows to get the outer or the inner borders following a distance * @param gap The distance of the borders * @param into True, you will get the borders inside the real borders */ @Override protected GeneralPath getBorders(double gap, boolean into) { GeneralPath gp = new GeneralPath(); gp.moveTo((float)pts.firstElement().x, (float)pts.firstElement().y); if(pts.size()==1) gp.lineTo((float)pts.firstElement().x-1, (float)pts.firstElement().y); else if(pts.size()==2) gp.lineTo(((float)pts.firstElement().x)==((float)pts.lastElement().x) && ((float)pts.firstElement().y)==((float)pts.lastElement().y) ? (float)pts.lastElement().x-1 : (float)pts.lastElement().x, (float)pts.lastElement().y); else for(int i=1, size=pts.size(); i1; boolean arrow2Drawable = arrowHead2.isDrawable() && !arrowHead2Style.equals(PSTricksConstants.NONEARROW_STYLE) && pts.size()>1; boolean update = false; LaTeXDrawPoint2D pFormer0 = pts.firstElement(); LaTeXDrawPoint2D pFormer1 = pts.lastElement(); BasicStroke wideline = new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); float thick = thickness; if(hasShadow) { LaTeXDrawPoint2D cg = getGravityCenter(); LaTeXDrawPoint2D shadowCg = (LaTeXDrawPoint2D)cg.clone(); shadowCg.setLocation(cg.x+shadowSize, cg.y); shadowCg = Figure.rotatePoint(shadowCg, cg, shadowAngle); dx = shadowCg.x-cg.x; dy = cg.y-shadowCg.y; } if(shape==null) shape = getInsideOutsideOrMiddleBorders(); if(arrow1Drawable) { LaTeXDrawPoint2D pt0 = pts.firstElement(); LaTeXDrawPoint2D pt1 = pts.elementAt(1); Line l = arrowHead1.getLine(); l.updateAandB(); double lineAngle = Math.atan(l.getA()); double xRot,yRot, b = l.getB(); double lgth = arrowHead1.getArrowHeadLength(); if(Math.abs(lineAngle)==(Math.PI/2.)) { first.y = pt0.y0) fillType = fillType+','+str; str = getPSTricksCodeLine(ppc); if(str.length()>0) add = add+','+str; String arrowHead1Style = arrowHead1.getArrowStyle(); String arrowHead2Style = arrowHead2.getArrowStyle(); if(!arrowHead1Style.equals(PSTricksConstants.NONEARROW_STYLE) || !arrowHead2Style.equals(PSTricksConstants.NONEARROW_STYLE)) { if(arrowHead2Style.equals(PSTricksConstants.DLARROW_STYLE)) arrowHead2Style = PSTricksConstants.DRARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.DRARROW_STYLE)) arrowHead2Style = PSTricksConstants.DLARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.RARROW_STYLE)) arrowHead2Style = PSTricksConstants.LARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.LARROW_STYLE)) arrowHead2Style = PSTricksConstants.RARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.DLARROW_STYLE)) arrowHead2Style = PSTricksConstants.DRARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.LRBRACKET_STYLE)) arrowHead2Style = PSTricksConstants.RRBRACKET_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.RRBRACKET_STYLE)) arrowHead2Style = PSTricksConstants.LRBRACKET_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.RSBRACKET_STYLE)) arrowHead2Style = PSTricksConstants.LSBRACKET_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.LSBRACKET_STYLE)) arrowHead2Style = PSTricksConstants.RSBRACKET_STYLE; String paramsR = ","+arrowHead1.getParametersCode(); //$NON-NLS-1$ String paramsL = ","+arrowHead2.getParametersCode(); //$NON-NLS-1$ if(paramsR.equals(","))paramsR = ""; //$NON-NLS-1$ //$NON-NLS-2$ if(paramsL.equals(","))paramsL = ""; //$NON-NLS-1$ //$NON-NLS-2$ if(!arrowHead1Style.equals(PSTricksConstants.NONEARROW_STYLE)) { arrowsCode = "{"+arrowHead1Style+'-'; //$NON-NLS-1$ if(!arrowHead2Style.equals(PSTricksConstants.NONEARROW_STYLE)) arrowsCode += arrowHead2Style; arrowsCode += '}'; if(!arrowHead1.isOfTheSameTypeAs(arrowHead2)) { if((arrowHead2Style.equals(PSTricksConstants.LRBRACKET_STYLE) || arrowHead2Style.equals(PSTricksConstants.RRBRACKET_STYLE) || arrowHead2Style.equals(PSTricksConstants.RSBRACKET_STYLE)|| arrowHead2Style.equals(PSTricksConstants.RSBRACKET_STYLE)) && (arrowHead1Style.equals(PSTricksConstants.BAREND_STYLE) ||arrowHead1Style.equals(PSTricksConstants.BARIN_STYLE) ||arrowHead1Style.equals(PSTricksConstants.LRBRACKET_STYLE) ||arrowHead1Style.equals(PSTricksConstants.RRBRACKET_STYLE) ||arrowHead1Style.equals(PSTricksConstants.RSBRACKET_STYLE)|| arrowHead1Style.equals(PSTricksConstants.RSBRACKET_STYLE))) add = paramsR; else add += paramsL+paramsR; } else add += paramsR; } else if(!arrowHead2Style.equals(PSTricksConstants.NONEARROW_STYLE)) { add += paramsL; arrowsCode = "{-"+arrowHead2Style+'}'; //$NON-NLS-1$ } } if(hasDoubleBoundary) { add += ",doubleline=true,doublesep="+LaTeXDrawNumber.getCutNumber((float)(doubleSep/ppc),threshold); //$NON-NLS-1$ if(doubleColor!=PSTricksConstants.DEFAULT_DOUBLE_COLOR) { String name = DviPsColors.getColourName(doubleColor); if(name==null) { name = "color"+number+'d';//$NON-NLS-1$ DviPsColors.addUserColour(doubleColor, name); } add += ",doublecolor="+name; //$NON-NLS-1$ } } if(!isFilled &&!interiorColor.equals(PSTricksConstants.DEFAULT_INTERIOR_COLOR)) { String name = DviPsColors.getColourName(interiorColor); if(name==null) { name = "color"+number+'b';//$NON-NLS-1$ DviPsColors.addUserColour(interiorColor, name); } add += ",fillcolor="+name; //$NON-NLS-1$ } return "\\psline[linewidth="+LaTeXDrawNumber.getCutNumber((thickness/ppc),threshold) //$NON-NLS-1$ +add+fillType+"]"+arrowsCode+coord; //$NON-NLS-1$ } /** * @return the arrowHead1Style */ public synchronized String getArrow1Style() { return arrowHead1.getArrowStyle(); } /** * @param arrowHeadStyle the arrowHead1Style to set */ public synchronized void setArrow1Style(String arrowHeadStyle) { if(PSTricksConstants.isValidArrowStyle(arrowHeadStyle)) arrowHead1.setArrowStyle(arrowHeadStyle); } /** * @param arrowHeadStyle the arrowHead2Style to set */ public synchronized void setArrow2Style(String arrowHeadStyle) { if(PSTricksConstants.isValidArrowStyle(arrowHeadStyle)) arrowHead2.setArrowStyle(arrowHeadStyle); } /** * @return the arrowHead2Style */ public synchronized String getArrow2Style() { return arrowHead2.getArrowStyle(); } @Override public synchronized void setThickness(float val) { super.setThickness(val); if(arrowHead1!=null) { arrowHead1.getLine().setThickness(val); arrowHead2.getLine().setThickness(val); } } @Override public boolean addPoint(LaTeXDrawPoint2D pt) { boolean ok = super.addPoint(pt); if(ok&&pts.size()>1) { Line l = new Line(pt, pts.elementAt(pts.size()-2), false); l.setThickness(thickness); l.setLinesColor(linesColor); if(arrowHead2!=null) { arrowHead2.setLine(l); arrowHead2.setPosition(pt); } } return ok; } @Override public void removePointAt(int id) { super.removePointAt(id); if(id==0&&pts.size()>1) { Line l = new Line(pts.firstElement(), pts.elementAt(1), false); l.setThickness(thickness); l.setLinesColor(linesColor); arrowHead1.setLine(l); arrowHead1.setPosition(pts.firstElement()); } else if((id==-1||id>pts.size())&&pts.size()>1) { Line l = new Line(pts.lastElement(), pts .elementAt(pts.size()-2), false); l.setThickness(thickness); l.setLinesColor(linesColor); arrowHead2.setLine(l); arrowHead2.setPosition(pts.lastElement()); } } @Override public Object clone() throws CloneNotSupportedException { JoinedLines f = (JoinedLines)super.clone(); f.arrowHead1 = (ArrowHead)arrowHead1.clone(); f.arrowHead2 = (ArrowHead)arrowHead2.clone(); Line l1 = new Line(f.pts.lastElement(), f.pts.elementAt(f.pts.size()-2), false); l1.setThickness(thickness); l1.setLinesColor(linesColor); f.arrowHead2.setLine(l1); f.arrowHead2.setPosition(f.pts.lastElement()); f.arrowHead2.setFigure(f); Line l2 = new Line(f.pts.firstElement(), f.pts.elementAt(1), false); l2.setThickness(thickness); l2.setLinesColor(linesColor); f.arrowHead1.setLine(l2); f.arrowHead1.setPosition(f.pts.firstElement()); f.arrowHead1.setFigure(f); return f; } @SuppressWarnings("unchecked") private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { canHaveShadow = true; canHaveArrow = true; isDoubleBoundaryable = true; interiorColor = (Color)ois.readObject(); lineStyle = (String)ois.readObject(); rotationAngle = ois.readDouble(); thickness = ois.readFloat(); isFilled = ois.readBoolean(); isSelected = ois.readBoolean(); isOnRotation = ois.readBoolean(); linesColor = (Color)ois.readObject(); blackDashLength = ois.readFloat(); dotSep = ois.readFloat(); whiteDashLength = ois.readFloat(); pts = (Vector)ois.readObject(); delimiters = new Vector(); for(int i = 0, size = pts.size(); i=0) //$NON-NLS-1$ { hasShadow = ois.readBoolean(); shadowAngle = ois.readDouble(); shadowSize = ois.readDouble(); shadowColor = (Color)ois.readObject(); gradientEndColor = (Color)ois.readObject(); gradientStartColor = (Color)ois.readObject(); gradientAngle = ois.readDouble(); gradientMidPoint = ois.readDouble(); } else { hasShadow = DEFAULT_SHADOW_HAS; shadowAngle = DEFAULT_SHADOW_ANGLE; shadowSize = DEFAULT_SHADOW_SIZE; shadowColor = DEFAULT_SHADOW_COLOR; gradientEndColor = PSTricksConstants.DEFAULT_GRADIENT_END_COLOR; gradientStartColor = PSTricksConstants.DEFAULT_GRADIENT_START_COLOR; gradientAngle = DEFAULT_GRADIENT_ANGLE; gradientMidPoint = DEFAULT_GRADIENT_MID_POINT; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.8")>=0) //$NON-NLS-1$ hatchingSep = ois.readDouble(); else hatchingSep = DEFAULT_HATCH_SEP; shape = getInsideOutsideOrMiddleBorders(); setThickness(thickness); } /** * @return the arrowHead1 */ public ArrowHead getArrowHead1() { return arrowHead1; } /** * @return the arrowHead2 */ public ArrowHead getArrowHead2() { return arrowHead2; } // @Override // public boolean intersects(Rectangle2D.Double r) // { // if(r==null) // return false; // // boolean again = true; // int i = 0, size = pts.size()-1; // Line2D.Double l = new Line2D.Double(); // BasicStroke wideline = new BasicStroke((thickness)); // // while(again&&i *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 06/06/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class Arc extends Circle implements Arrowable { private static final long serialVersionUID = 1L; /** The delimiter of the start angle */ protected Delimitor dStart; /** The delimiter of the end angle */ protected Delimitor dEnd; /** The angle of the start (radian)*/ protected double startAngle; /** The angle of the end (radian)*/ protected double endAngle; /** the arrowhead of the first point */ protected ArrowHead arrowHead1; /** The arrow head of the second point */ protected ArrowHead arrowHead2; /** The type of arc : wedge, arc, chord */ protected int type; /** Allows to display the points of the arc */ protected boolean showPoints; /** The value by default of the attribute DEFAULT_SHOWPOINTS */ public static final boolean DEFAULT_SHOWPOINTS = false; /** A kind of arc */ public static final String TYPE_ARC = LaTeXDrawLang.getOthersString("Arc.arc"); //$NON-NLS-1$ /** A kind of arc */ public static final String TYPE_PIE = LaTeXDrawLang.getOthersString("Arc.wedge"); //$NON-NLS-1$ /** A kind of arc */ public static final String TYPE_CHORD = LaTeXDrawLang.getOthersString("Arc.chord"); //$NON-NLS-1$ /** The label of the arc choice */ public static final String LABEL_ARCCHOICE = LaTeXDrawLang.getOthersString("Arc.arcType"); //$NON-NLS-1$ /** The start angle by default */ public static final double DEFAULT_STARTANGLE = 0; /** The end angle by default */ public static final double DEFAULT_ENDANGLE = Math.PI; /** The type of arc by default */ public static final String DEFAULT_TYPE = TYPE_ARC; /** * The constructor by default */ public Arc(boolean increaseMeter) { this(new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), Arc2D.OPEN, increaseMeter); } /** * The constructor taking the two opposed points * @param p1 The first point of the parabola * @param p2 The last point */ public Arc(LaTeXDrawPoint2D p1, LaTeXDrawPoint2D p2, int type, boolean increaseMeter) { super(p1, new LaTeXDrawPoint2D(p2.x,p1.y), new LaTeXDrawPoint2D(p1.x, p2.y), p2, increaseMeter); isBordersMovable = false; isDoubleBoundaryable = false; setType(type); dStart = new Delimitor(new LaTeXDrawPoint2D((p1.x+3*p2.x)/4,p2.y)); dEnd = new Delimitor(new LaTeXDrawPoint2D((3*p1.x+p2.x)/4,p2.y)); dStart.setColorSet3(); dEnd.setColorSet3(); endAngle = DEFAULT_ENDANGLE; startAngle = DEFAULT_STARTANGLE; bordersPosition = PSTricksConstants.BORDERS_MIDDLE; arrowHead1 = new ArrowHead(p1, new Line(p1,(LaTeXDrawPoint2D)p1.clone(),false), this); arrowHead2 = new ArrowHead(p2, new Line(p2,(LaTeXDrawPoint2D)p2.clone(),false), this); shape = getInsideOutsideOrMiddleBorders(); } /** * Allows to set the style of the first arrow of the line * @param style The new style of the first arrow of the line */ public synchronized void setArrow1Style(String style) { arrowHead1.setArrowStyle(style); } /** * Allows to set the style of the second arrow of the line * @param style The new style of the second arrow of the line */ public synchronized void setArrow2Style(String style) { arrowHead2.setArrowStyle(style); } /** * Allows to get the kind of arc * @return The kind of arc */ public synchronized int getType() { return type; } public String getTypeName() { if(type == Arc2D.OPEN) return TYPE_ARC; if(type == Arc2D.CHORD) return TYPE_CHORD; return TYPE_PIE; } @Override public void rescaleX(double formerX, double newX, double percent, LaTeXDrawRectangle bound) { if(percent==1.) return ; super.rescaleX(formerX, newX, percent, bound); updateCenterStartEndDelimitors(); shape = getInsideOutsideOrMiddleBorders(); } @Override public void rescaleY(double formerY, double newY, double percent, LaTeXDrawRectangle bound) { if(percent==1.) return ; super.rescaleY(formerY, newY, percent, bound); updateCenterStartEndDelimitors(); shape = getInsideOutsideOrMiddleBorders(); } /** * Allows to set the kind of arc * @param type The kind of arc */ public synchronized void setType(int type) { if(type!=Arc2D.OPEN && type!=Arc2D.PIE && type!=Arc2D.CHORD) throw new IllegalArgumentException(); this.type = type; canHaveArrow = type==Arc2D.OPEN; shape = getInsideOutsideOrMiddleBorders(); } /** * Allows to set the kind of arc * @param type The kind of arc */ public synchronized void setType(String type) { if(type.equals(TYPE_ARC)) this.type = Arc2D.OPEN; else if(type.equals(TYPE_CHORD)) this.type = Arc2D.CHORD; else if(type.equals(TYPE_PIE)) this.type = Arc2D.PIE; else throw new IllegalArgumentException(); canHaveArrow = this.type==Arc2D.OPEN; } @Override public synchronized void setThickness(float val) { if(!Double.isInfinite(val) && !Double.isNaN(val) && val>0) { thickness = val; double dim = 1.33*val+3.33 +1.; if(dim<6.) dim = 6; // We change the size of the delimiters when the size of // the figure change dStart.setDim(dim); dEnd.setDim(dim); arrowHead1.getLine().setThickness(val); arrowHead2.getLine().setThickness(val); if(borders!=null) borders.setThickness(val); shape = getInsideOutsideOrMiddleBorders(); } } /** * Allows to set the start angle (radian) * @param angle The new start angle */ public synchronized void setStartAngle(double angle) { startAngle = angle; shape = getInsideOutsideOrMiddleBorders(); } /** * Allows to set the end angle (radian) * @param angle The new end angle */ public synchronized void setEndAngle(double angle) { endAngle = angle; shape = getInsideOutsideOrMiddleBorders(); } /** * Allows to get the start angle * @return The start angle */ public synchronized double getStartAngle() { return startAngle%(2.*Math.PI); } /** * Allows to get the end angle * @return The end angle */ public synchronized double getEndAngle() { return endAngle%(2.*Math.PI); } @Override public void onDragged(Point formerPt, Point newPt) { if(formerPt.equals(newPt)) return; if(borders.dSelected!=null) { borders.onDragged(formerPt, newPt); shape = getInsideOutsideOrMiddleBorders(); } else if(dSelected!=null) { LaTeXDrawPoint2D newPt2 = rotateInvertPoint(newPt); if(dSelected==dStart) moveStartAngle(newPt2); else if(dSelected==dEnd) moveEndAngle(newPt2); } else // If the user has clicked on the line { shift(formerPt, newPt); shape = getInsideOutsideOrMiddleBorders(); } updateGravityCenter(); updateCenterStartEndDelimitors(); rotationAngle = borders.getRotationAngle();//update the angle(when rotation) } @Override public void draw(Graphics2D g, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering) { LaTeXDrawPoint2D NW = borders.getTheNWPoint(); LaTeXDrawPoint2D SE = borders.getTheSEPoint(); Color formerCol = g.getColor(); double cx = (NW.x+SE.x)/2., cy = (NW.y+SE.y)/2.; double c2x = Math.cos(rotationAngle)*cx - Math.sin(rotationAngle)*cy; double c2y = Math.sin(rotationAngle)*cx + Math.cos(rotationAngle)*cy; double c3x = Math.cos(-rotationAngle)*(cx-c2x) - Math.sin(-rotationAngle)*(cy-c2y); double c3y = Math.sin(-rotationAngle)*(cx-c2x) + Math.cos(-rotationAngle)*(cy-c2y); LaTeXDrawPoint2D startPt = getNonRotatedStartPoint(); LaTeXDrawPoint2D endRot = getNonRotatedEndPoint(); ArrowHead ar1=null, ar2=null; String oldStyleL = null, oldStyleR=null; startAngle%=(2*Math.PI); endAngle%=(2*Math.PI); double dx=0, dy=0; boolean changeFillStyle = false; if(rotationAngle%(Math.PI*2)!=0) { g.rotate(rotationAngle); g.translate(c3x,c3y); } if(hasShadow) { LaTeXDrawPoint2D cg = getGravityCenter(); LaTeXDrawPoint2D shadowCg = (LaTeXDrawPoint2D)cg.clone(); shadowCg.setLocation(cg.x+shadowSize, cg.y); shadowCg = Figure.rotatePoint(shadowCg, cg, shadowAngle); dx = shadowCg.x-cg.x; dy = cg.y-shadowCg.y; } double start = startAngle, end = endAngle; if(type==Arc2D.OPEN) { double radius = SE.x-NW.x; if(!arrowHead1.getArrowStyle().equals(PSTricksConstants.NONEARROW_STYLE)) { double lgth = arrowHead1.getArrowHeadLength(); if(lgth!=0) { startAngle+=(Math.atan(lgth/radius)); startAngle%=(2*Math.PI); } Line line = new Line(getTangenteAt(startAngle, ((float)startAngle)<((float)Math.PI)), false); line.getPt2().move(line.getPt1(), startPt); line.setPointAt(startPt, 0); arrowHead1.setLine(line); arrowHead1.setPosition(line.getPt1()); if(arrowHead1.getArrowStyle().equals(PSTricksConstants.DLARROW_STYLE) || arrowHead1.getArrowStyle().equals(PSTricksConstants.DRARROW_STYLE)) { oldStyleL = arrowHead1.getArrowStyle(); double angle = startAngle; if(lgth!=0) { angle+=Math.atan((lgth*3)/radius); angle%=(2*Math.PI); } line = new Line(getTangenteAt(angle, angle<=Math.PI), false); ar1 = new ArrowHead(line.getPt1(), line, this); ar1.setArrowInset(arrowHead1.getArrowInset()); ar1.setArrowLength(arrowHead1.getArrowLength()); ar1.setArrowSizeDim(arrowHead1.getArrowSizeDim()); ar1.setArrowSizeNum(arrowHead1.getArrowSizeNum()); if(arrowHead1.getArrowStyle().equals(PSTricksConstants.DLARROW_STYLE)) { ar1.setArrowStyle(PSTricksConstants.LARROW_STYLE); arrowHead1.setArrowStyle(PSTricksConstants.LARROW_STYLE); } else { ar1.setArrowStyle(PSTricksConstants.RARROW_STYLE); arrowHead1.setArrowStyle(PSTricksConstants.RARROW_STYLE); } } if(lgth!=0) { startAngle=start+Math.atan(2*lgth/radius); startAngle%=(2*Math.PI); } } if(!arrowHead2.getArrowStyle().equals(PSTricksConstants.NONEARROW_STYLE)) { double lgth = arrowHead2.getArrowHeadLength(); if(lgth!=0) endAngle-=(Math.atan(lgth/radius))%(2*Math.PI); Line line = new Line(getTangenteAt(endAngle, ((float)endAngle)>=((float)Math.PI)), false); line.getPt2().move(line.getPt1(), endRot); line.setPointAt(endRot, 0); arrowHead2.setLine(line); arrowHead2.setPosition(line.getPt1()); if(arrowHead2.getArrowStyle().equals(PSTricksConstants.DLARROW_STYLE) || arrowHead2.getArrowStyle().equals(PSTricksConstants.DRARROW_STYLE)) { oldStyleR = arrowHead2.getArrowStyle(); double angle = endAngle; if(lgth!=0) { angle-=Math.atan((lgth*3)/radius); angle%=(2*Math.PI); } line = new Line(getTangenteAt(angle, angle>=Math.PI), false); ar2 = new ArrowHead(line.getPt1(), line, this); ar2.setArrowInset(arrowHead2.getArrowInset()); ar2.setArrowLength(arrowHead2.getArrowLength()); ar2.setArrowSizeDim(arrowHead2.getArrowSizeDim()); ar2.setArrowSizeNum(arrowHead2.getArrowSizeNum()); if(arrowHead2.getArrowStyle().equals(PSTricksConstants.DLARROW_STYLE)) { ar2.setArrowStyle(PSTricksConstants.LARROW_STYLE); arrowHead2.setArrowStyle(PSTricksConstants.LARROW_STYLE); } else { ar2.setArrowStyle(PSTricksConstants.RARROW_STYLE); arrowHead2.setArrowStyle(PSTricksConstants.RARROW_STYLE); } } if(lgth!=0) { endAngle=end-Math.atan(2*lgth/radius); endAngle%=(2*Math.PI); } } } if(showPoints) { g.setStroke(new BasicStroke(thickness/2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[]{blackDashLength, whiteDashLength}, 0)); g.setColor(linesColor); g.draw(new Line2D.Double(gravityCenter.x, gravityCenter.y, startPt.x, startPt.y)); g.draw(new Line2D.Double(gravityCenter.x, gravityCenter.y, endRot.x, endRot.y)); } Shape s0 = getInsideOutsideOrMiddleBorders(); if(hasShadow) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.fill(s0); g.draw(s0); g.translate(-dx, -dy); if(!isFilled) { changeFillStyle = true; isFilled = true; } g.setColor(interiorColor); g.draw(s0); } if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); else if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[]{0,thickness+dotSep}, 0)); } else if(lineStyle.equals(PSTricksConstants.LINE_DASHED_STYLE)) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[]{blackDashLength, whiteDashLength}, 0)); } fillFigure(g, antiAlias, rendering, alphaInter, colorRendering, s0); g.setColor(linesColor); g.draw(s0); if(type==Arc2D.OPEN) { Stroke formerS = g.getStroke(); g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); if(hasShadow) { g.translate(dx, dy); arrowHead1.draw(g, interiorColor, true); arrowHead2.draw(g, interiorColor, true); g.translate(-dx, -dy); } arrowHead1.draw(g, interiorColor, false); arrowHead2.draw(g, interiorColor, false); g.setStroke(formerS); if(ar1!=null) { ar1.draw(g, interiorColor, false); arrowHead1.setArrowStyle(oldStyleL); } if(ar2!=null) { ar2.draw(g, interiorColor, false); arrowHead2.setArrowStyle(oldStyleR); } startAngle = start; endAngle = end; } if(changeFillStyle) isFilled = false; g.setColor(formerCol); if(isSelected) { if(dStart!=null && dEnd!=null) { dStart.draw(g); dEnd.draw(g); } g.translate(-c3x, -c3y); g.rotate(-rotationAngle); borders.draw(g, false, antiAlias, rendering, alphaInter, colorRendering); } else if(rotationAngle%(Math.PI*2)!=0) { g.translate(-c3x, -c3y); g.rotate(-rotationAngle); } } /** * Allows to get the position of the non-rotated end point * @return The end point */ public LaTeXDrawPoint2D getNonRotatedEndPoint() { LaTeXDrawPoint2D NW = borders.getTheNWPoint(); LaTeXDrawPoint2D SE = borders.getTheSEPoint(); return rotatePoint(new LaTeXDrawPoint2D(SE.x, (SE.y+NW.y)/2.), -endAngle); } /** * Allows to get the position of the non-rotated start point * @return The start point */ public LaTeXDrawPoint2D getNonRotatedStartPoint() { LaTeXDrawPoint2D NW = borders.getTheNWPoint(); LaTeXDrawPoint2D SE = borders.getTheSEPoint(); return rotatePoint(new LaTeXDrawPoint2D(SE.x, (SE.y+NW.y)/2.), -startAngle); } @Override public synchronized void setLastPoint(LaTeXDrawPoint2D pt) { super.setLastPoint(pt); updateCenterStartEndDelimitors(); shape = getInsideOutsideOrMiddleBorders(); } @Override public synchronized void setFirstPoint(LaTeXDrawPoint2D pt) { super.setFirstPoint(pt); updateCenterStartEndDelimitors(); shape = getInsideOutsideOrMiddleBorders(); } @Override public boolean isIn(LaTeXDrawPoint2D p) { LaTeXDrawPoint2D pt = rotateInvertPoint(p); // Is the point is in a selector if(isSelected && (borders.dNE.isIn(pt) || borders.dNW.isIn(pt) || borders.dSE.isIn(pt) || borders.dSW.isIn(pt) || dEnd.isIn(pt)|| dStart.isIn(pt))) return true; LaTeXDrawPoint2D NW = getTheNWPoint(); LaTeXDrawPoint2D SE = getTheSEPoint(); double width = SE.x - NW.x; double start2 = Math.toDegrees(startAngle); double end2 = startAngle>endAngle ? Math.toDegrees(2*Math.PI-startAngle+endAngle) : Math.toDegrees(endAngle-startAngle); Shape s = new Arc2D.Double(NW.x-thickness/2., NW.y-thickness/2., width+thickness, width+thickness, start2, end2, type); if(!s.contains(pt)) return false; if(isFilled() || hasShadow() || hasGradient()) return true; double gap = thickness/2.; s = new Arc2D.Double(NW.x+gap, NW.y+gap, width-thickness, width-thickness, start2, end2, type); if(type==Arc2D.PIE) { double radius = width/2.; LaTeXDrawPoint2D start = new LaTeXDrawPoint2D( gravityCenter.x + Math.cos(startAngle)*radius, gravityCenter.y - Math.sin(startAngle)*radius); LaTeXDrawPoint2D end = new LaTeXDrawPoint2D( gravityCenter.x + Math.cos(endAngle)*radius, gravityCenter.y - Math.sin(endAngle)*radius); Line l1 = new Line(gravityCenter, rotatePoint(start), false); l1.setThickness(thickness); if(l1.isIn(p)) return true; Line l2 = new Line(gravityCenter, rotatePoint(end), false); l2.setThickness(thickness); if(l2.isIn(p)) return true; } else if(type==Arc2D.CHORD) { double radius = width/2.; LaTeXDrawPoint2D start = new LaTeXDrawPoint2D( gravityCenter.x + Math.cos(startAngle)*radius, gravityCenter.y - Math.sin(startAngle)*radius); LaTeXDrawPoint2D end = new LaTeXDrawPoint2D( gravityCenter.x + Math.cos(endAngle)*radius, gravityCenter.y - Math.sin(endAngle)*radius); Line l1 = new Line(rotatePoint(start), rotatePoint(end), false); l1.setThickness(thickness); if(l1.isIn(p)) return true; } if(s.contains(pt)) return false; return true; } @Override public synchronized String getCodePSTricks(DrawBorders drawBorders, float ppc) { LaTeXDrawPoint2D d = drawBorders.getOriginPoint(); LaTeXDrawPoint2D NW = borders.getTheNWPoint(), SE = borders.getTheSEPoint(); String add1 = "", add2="", startCode="", addEnd="", fillType=""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ String arrowsCode="", endCode = ""; //$NON-NLS-1$//$NON-NLS-2$ boolean isFilledWasChanged = false; double threshold = 0.001; if(hasShadow) { fillType+=",shadow=true";//$NON-NLS-1$ if(Math.toDegrees(shadowAngle)!=PSTricksConstants.DEFAULT_SHADOW_ANGLE) fillType+=",shadowangle="+(float)Math.toDegrees(shadowAngle);//$NON-NLS-1$ if(((float)shadowSize) != ((float)DEFAULT_SHADOW_SIZE)) fillType+=",shadowsize="+LaTeXDrawNumber.getCutNumber((float)(shadowSize/PPC), threshold) ;//$NON-NLS-1$ if(!shadowColor.equals(PSTricksConstants.DEFAULT_SHADOW_COLOR)) { String name = DviPsColors.getColourName(shadowColor); if(name==null) { name = "color"+number+'e';//$NON-NLS-1$ DviPsColors.addUserColour(shadowColor, name); } fillType += ",shadowcolor=" + name; //$NON-NLS-1$ } if(!isFilled) { isFilled = true; isFilledWasChanged = true; } } String str = getPSTricksCodeFilling(ppc); if(str.length()>0) fillType=fillType+','+str; str = getPSTricksCodeLine(ppc); if(str.length()>0) add1=add1+','+str; double x = (NW.x+SE.x)/2. - d.x, y = d.y - (SE.y+NW.y)/2., radius = (SE.x-NW.x)/2.; if(type==Arc2D.OPEN) { startCode = "\\psarc"; //$NON-NLS-1$ String currentArrowLStyle = arrowHead1.getArrowStyle(); String currentArrowRStyle = arrowHead2.getArrowStyle(); if(currentArrowRStyle.equals(PSTricksConstants.DLARROW_STYLE)) currentArrowRStyle = PSTricksConstants.DRARROW_STYLE; else if(currentArrowRStyle.equals(PSTricksConstants.DRARROW_STYLE)) currentArrowRStyle = PSTricksConstants.DLARROW_STYLE; else if(currentArrowRStyle.equals(PSTricksConstants.RARROW_STYLE)) currentArrowRStyle = PSTricksConstants.LARROW_STYLE; else if(currentArrowRStyle.equals(PSTricksConstants.LARROW_STYLE)) currentArrowRStyle = PSTricksConstants.RARROW_STYLE; else if(currentArrowRStyle.equals(PSTricksConstants.DLARROW_STYLE)) currentArrowRStyle = PSTricksConstants.DRARROW_STYLE; else if(currentArrowRStyle.equals(PSTricksConstants.LRBRACKET_STYLE)) currentArrowRStyle = PSTricksConstants.RRBRACKET_STYLE; else if(currentArrowRStyle.equals(PSTricksConstants.RRBRACKET_STYLE)) currentArrowRStyle = PSTricksConstants.LRBRACKET_STYLE; else if(currentArrowRStyle.equals(PSTricksConstants.RSBRACKET_STYLE)) currentArrowRStyle = PSTricksConstants.LSBRACKET_STYLE; else if(currentArrowRStyle.equals(PSTricksConstants.LSBRACKET_STYLE)) currentArrowRStyle = PSTricksConstants.RSBRACKET_STYLE; String paramsR = ","+ arrowHead2.getParametersCode(); //$NON-NLS-1$ String paramsL = ","+ arrowHead1.getParametersCode(); //$NON-NLS-1$ if(paramsR.equals(",")) paramsR = ""; //$NON-NLS-1$ //$NON-NLS-2$ if(paramsL.equals(",")) paramsL = ""; //$NON-NLS-1$ //$NON-NLS-2$ if(!currentArrowLStyle.equals(PSTricksConstants.NONEARROW_STYLE)) { arrowsCode="{"+currentArrowLStyle+'-'; //$NON-NLS-1$ if(!currentArrowRStyle.equals(PSTricksConstants.NONEARROW_STYLE)) arrowsCode+=currentArrowRStyle; arrowsCode+='}'; if(!arrowHead1.isOfTheSameTypeAs(arrowHead2)) { if((currentArrowRStyle.equals(PSTricksConstants.LRBRACKET_STYLE) || currentArrowRStyle.equals(PSTricksConstants.RRBRACKET_STYLE) || currentArrowRStyle.equals(PSTricksConstants.RSBRACKET_STYLE) || currentArrowRStyle.equals(PSTricksConstants.RSBRACKET_STYLE)) && (currentArrowLStyle.equals(PSTricksConstants.BAREND_STYLE) || currentArrowLStyle.equals(PSTricksConstants.BARIN_STYLE) || currentArrowLStyle.equals(PSTricksConstants.LRBRACKET_STYLE) || currentArrowLStyle.equals(PSTricksConstants.RRBRACKET_STYLE) || currentArrowLStyle.equals(PSTricksConstants.RSBRACKET_STYLE) || currentArrowLStyle.equals(PSTricksConstants.RSBRACKET_STYLE))) add1 = paramsR; else add1+= paramsL + paramsR; }else add1+=paramsR; } else if(!currentArrowRStyle.equals(PSTricksConstants.NONEARROW_STYLE)) { add1+=paramsR; arrowsCode="{-"+currentArrowRStyle+'}'; //$NON-NLS-1$ } } else if(type==Arc2D.PIE) startCode = "\\pswedge"; //$NON-NLS-1$ else { endCode = "\n\\psline[linewidth=" + LaTeXDrawNumber.getCutNumber(thickness/ppc, threshold) +add1+ //$NON-NLS-1$ "](" +LaTeXDrawNumber.getCutNumber((float)((x+Math.cos(startAngle)*radius)/ppc), threshold)+ ',' + //$NON-NLS-1$ LaTeXDrawNumber.getCutNumber((float)((y+Math.sin(startAngle)*radius)/ppc), threshold)+ ")(" +LaTeXDrawNumber.getCutNumber((float)((x+Math.cos(endAngle)*radius)/ppc), threshold)+ ','; //$NON-NLS-1$ if(endAngle%Math.PI==0) endCode +=LaTeXDrawNumber.getCutNumber((float)(y/ppc), threshold)+ ")"; //$NON-NLS-1$ else endCode +=LaTeXDrawNumber.getCutNumber((float)((y+Math.sin(endAngle)*radius)/ppc), threshold)+ ")"; //$NON-NLS-1$ startCode = "\\psarc";//$NON-NLS-1$ } if(rotationAngle%(Math.PI*2)!=0.) { double angle = -Math.toDegrees(rotationAngle); double cx = (gravityCenter.x-d.x)/ppc; double cy = (d.y-gravityCenter.y)/ppc; double x2 = -Math.cos(-rotationAngle)*cx+ Math.sin(-rotationAngle)*cy+cx; double y2 = -Math.sin(-rotationAngle)*cx- Math.cos(-rotationAngle)*cy+cy; if(Math.abs(x2) < 0.001) x2 = 0; if(Math.abs(y2) < 0.001) y2 = 0; startCode ="\\rput{"+(float)angle+ "}("+ //$NON-NLS-1$ //$NON-NLS-2$ LaTeXDrawNumber.getCutNumber((float)x2, threshold)+','+LaTeXDrawNumber.getCutNumber((float)y2, threshold)+"){"+startCode; //$NON-NLS-1$ addEnd = "}"; //$NON-NLS-1$ } if(showPoints) add1+=",showpoints=true"; //$NON-NLS-1$ if(hasDoubleBoundary) { add1+=",doubleline=true,doublesep="+LaTeXDrawNumber.getCutNumber((float)(doubleSep/ppc), threshold); //$NON-NLS-1$ add1+=",dimen="+bordersPosition; //$NON-NLS-1$ if(doubleColor!=PSTricksConstants.DEFAULT_DOUBLE_COLOR) { String name = DviPsColors.getColourName(doubleColor); if(name==null) { name = "color"+number+'d';//$NON-NLS-1$ DviPsColors.addUserColour(linesColor, name); } add1+= ",doublecolor="+name; //$NON-NLS-1$ } } if(!isFilled && !interiorColor.equals(PSTricksConstants.DEFAULT_INTERIOR_COLOR)) { String name = DviPsColors.getColourName(interiorColor); if(name==null) { name = "color"+number+'b';//$NON-NLS-1$ DviPsColors.addUserColour(interiorColor, name); } add1 += ",fillcolor=" + name; //$NON-NLS-1$ } if(isFilledWasChanged) isFilled = false; return startCode+ "[linewidth=" + LaTeXDrawNumber.getCutNumber(thickness/ppc, threshold) + //$NON-NLS-1$ add1 + add2 + fillType + "]"+ arrowsCode + "(" + LaTeXDrawNumber.getCutNumber((float)(x/ppc), threshold)+','+ //$NON-NLS-1$ //$NON-NLS-2$ LaTeXDrawNumber.getCutNumber((float)(y/ppc), threshold) + "){"+ //$NON-NLS-1$ LaTeXDrawNumber.getCutNumber((float)(radius/ppc), threshold) +"}{"+ //$NON-NLS-1$ LaTeXDrawNumber.getCutNumber((float)Math.toDegrees(startAngle), threshold) +"}{"+LaTeXDrawNumber.getCutNumber((float)Math.toDegrees(endAngle), threshold)+'}'+endCode+ addEnd; //$NON-NLS-1$ } /** * Allows to change the position of the start angle * @param newPt The new position */ public void moveStartAngle(LaTeXDrawPoint2D newPt) { double radius = newPt.distance(gravityCenter); double angle = Math.acos((newPt.x-gravityCenter.x)/radius); if(newPt.y>gravityCenter.y) startAngle = 2*Math.PI - angle; else startAngle = angle; updateCenterStartEndDelimitors(); shape = getInsideOutsideOrMiddleBorders(); } /** * Allows to change the position of the end angle * @param newPt The new position */ public void moveEndAngle(LaTeXDrawPoint2D newPt) { double radius = newPt.distance(gravityCenter); double angle = Math.acos((newPt.x-gravityCenter.x)/radius); if(newPt.y>gravityCenter.y) endAngle = 2*Math.PI - angle; else endAngle = angle; updateCenterStartEndDelimitors(); shape = getInsideOutsideOrMiddleBorders(); } @Override public void onClick(Point p) { LaTeXDrawPoint2D pt = rotateInvertPoint(p); if(dStart.isIn(pt)) dSelected = dStart; else if(dEnd.isIn(pt)) dSelected = dEnd; isSelected = true; borders.onClick(p); } @Override public void shift(double shiftX, double shiftY) { if(shiftX==0 && shiftY==0) return ; super.shift(shiftX, shiftY); updateCenterStartEndDelimitors(); shape = getInsideOutsideOrMiddleBorders(); } /** * Allows the update the centre, the start delimiter * and the end delimiter * */ public void updateCenterStartEndDelimitors() { LaTeXDrawPoint2D second = borders.getPoint(1); LaTeXDrawPoint2D first = borders.getPoint(0), fourth = borders.getPoint(3); double xStart, xEnd, yStart, yEnd; double radius = Math.abs(first.x-second.x)/2.; gravityCenter.x = (first.x+second.x)/2; gravityCenter.y = (first.y+fourth.y)/2; xStart = gravityCenter.x + Math.cos(startAngle)*radius/2.; yStart = gravityCenter.y - Math.sin(startAngle)*radius/2.; dStart.getCenter().setLocation(xStart, yStart); xEnd = gravityCenter.x + Math.cos(endAngle)*radius/2.; yEnd = gravityCenter.y - Math.sin(endAngle)*radius/2.; dEnd.getCenter().setLocation(xEnd, yEnd); } /** * Allows to create a choice containing all kinds of arc * @return The choice */ public static JComboBox createArcChoice(AbstractParametersFrame f) { JComboBox arcChoice = new JComboBox(); arcChoice.setName(LABEL_ARCCHOICE); arcChoice.addItem(Arc.TYPE_ARC); arcChoice.addItem(Arc.TYPE_CHORD); arcChoice.addItem(Arc.TYPE_PIE); arcChoice.addItemListener(f); return arcChoice; } /** * Allows to get the style of the left arrow of the line * @return The style of the left arrow of the line */ public synchronized String getArrow1Style() { return arrowHead1.getArrowStyle(); } /** * Allows to get the style of the right arrow of the line * @return The style of the left arrow of the line */ public synchronized String getArrow2Style() { return arrowHead2.getArrowStyle(); } @Override public Object clone() throws CloneNotSupportedException { Arc a = (Arc) super.clone(); a.dEnd = (Delimitor) dEnd.clone(); a.dStart = (Delimitor) dStart.clone(); a.type = type; a.endAngle = endAngle; a.startAngle = startAngle; a.updateCenterStartEndDelimitors(); a.arrowHead1 = (ArrowHead)arrowHead1.clone(); a.arrowHead2 = (ArrowHead)arrowHead2.clone(); return a; } private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { canHaveShadow = true; interiorColor = (Color) ois.readObject(); lineStyle = (String) ois.readObject(); rotationAngle = ois.readDouble(); thickness = ois.readFloat(); isFilled = ois.readBoolean(); isSelected = ois.readBoolean(); isOnRotation = ois.readBoolean(); linesColor = (Color) ois.readObject(); blackDashLength = ois.readFloat(); dotSep = ois.readFloat(); whiteDashLength = ois.readFloat(); borders = (LaTeXDrawRectangle) ois.readObject(); endAngle = ois.readDouble(); startAngle = ois.readDouble(); dEnd = (Delimitor) ois.readObject(); dStart = (Delimitor) ois.readObject(); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.5")>=0) //$NON-NLS-1$ { hasDoubleBoundary = ois.readBoolean(); doubleColor = (Color)ois.readObject(); doubleSep = ois.readDouble(); if(!(LaTeXDrawFrame.getVersionOfFile().compareTo("1.6")>=0)) //$NON-NLS-1$ ois.readBoolean(); hatchingAngle = ois.readDouble(); hatchingColor = (Color)ois.readObject(); hatchingStyle = (String)ois.readObject(); hatchingWidth = ois.readFloat(); arrowHead1 = (ArrowHead)ois.readObject(); arrowHead2 = (ArrowHead)ois.readObject(); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.6")>=0) //$NON-NLS-1$ showPoints = ois.readBoolean(); arrowHead2.setArrowInset(arrowHead1.getArrowInset()); arrowHead2.setArrowLength(arrowHead1.getArrowLength()); arrowHead2.setArrowSizeDim(arrowHead1.getArrowSizeDim()); arrowHead2.setArrowSizeNum(arrowHead1.getArrowSizeNum()); arrowHead2.setBracketNum(arrowHead1.getBracketNum()); arrowHead2.setDotSizeDim(arrowHead1.getDotSizeDim()); arrowHead2.setDotSizeNum(arrowHead1.getDotSizeNum()); arrowHead2.setRBracketNum(arrowHead1.getRBracketNum()); arrowHead2.setTBarSizeDim(arrowHead1.getTBarSizeDim()); arrowHead2.setTBarSizeNum(arrowHead1.getTBarSizeNum()); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.6") < 0)//$NON-NLS-1$ { if(hatchingStyle.equals(DECREPETED_FILL_CROSS)) hatchingStyle = PSTricksConstants.TOKEN_FILL_CROSSHATCH; else if(hatchingStyle.equals(DECREPETED_FILL_HORIZ)) hatchingStyle = PSTricksConstants.TOKEN_FILL_HLINES; else if(hatchingStyle.equals(DECREPETED_FILL_VERT)) hatchingStyle = PSTricksConstants.TOKEN_FILL_VLINES; else if(hatchingStyle.equals(DECREPETED_FILL_NO)) hatchingStyle = PSTricksConstants.TOKEN_FILL_NONE; } } else { hasDoubleBoundary = DEFAULT_HAS_DOUBLE_BOUNDARY; doubleColor = DEFAULT_DOUBLE_COLOR; doubleSep = DEFAULT_DOUBLESEP; hatchingAngle = DEFAULT_HATCH_ANGLE; hatchingColor = DEFAULT_HATCH_COL; hatchingStyle = DEFAULT_HATCH_STYLE; hatchingWidth = DEFAULT_HATCH_WIDTH; arrowHead1 = new ArrowHead(this); arrowHead2 = new ArrowHead(this); } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.7")>=0) //$NON-NLS-1$ { hasShadow = ois.readBoolean(); shadowAngle = ois.readDouble(); shadowSize = ois.readDouble(); shadowColor = (Color)ois.readObject(); gradientEndColor = (Color)ois.readObject(); gradientStartColor = (Color)ois.readObject(); gradientAngle = ois.readDouble(); gradientMidPoint = ois.readDouble(); } else { if(startAngle>endAngle) { double tmp = startAngle; ArrowHead tmpAH = arrowHead1; startAngle = endAngle; endAngle = tmp; arrowHead1 = arrowHead2; arrowHead2 = tmpAH; } hasShadow = DEFAULT_SHADOW_HAS; shadowAngle = DEFAULT_SHADOW_ANGLE; shadowSize = DEFAULT_SHADOW_SIZE; shadowColor = DEFAULT_SHADOW_COLOR; gradientEndColor = PSTricksConstants.DEFAULT_GRADIENT_END_COLOR; gradientStartColor = PSTricksConstants.DEFAULT_GRADIENT_START_COLOR; gradientAngle = DEFAULT_GRADIENT_ANGLE; gradientMidPoint = DEFAULT_GRADIENT_MID_POINT; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.8")>=0) //$NON-NLS-1$ { hatchingSep = ois.readDouble(); type = ois.readInt();// fixing #1555339 } else { hatchingSep = DEFAULT_HATCH_SEP; type = Arc2D.OPEN;// fixing #1555339 } updateGravityCenter(); updateStyleOfDelimitors(); updateCenterStartEndDelimitors(); shape = getInsideOutsideOrMiddleBorders(); } /** * @return Returns the showPoints. */ public boolean isShowPoints() { return showPoints; } /** * @param showPoints The showPoints to set. */ public synchronized void setShowPoints(boolean showPoints) { this.showPoints = showPoints; } /** * @return Returns the arrowHead1. */ public ArrowHead getArrowHead1() { return arrowHead1; } /** * @return Returns the arrowHead2. */ public ArrowHead getArrowHead2() { return arrowHead2; } @Override public Shape[] getDbleBoundariesOutside(Shape classicBord) { return getDbleBoundariesMiddle(classicBord); } @Override public Shape[] getDbleBoundariesInside(Shape classicBord) { return getDbleBoundariesMiddle(classicBord); } @Override public Shape[] getDbleBoundariesMiddle(Shape classicBord) { /* * * Dx = (doubleSep/2.+A'x2+A'y2-Ay2-Ax2+2bAy-2bAy) * /(2*(A'x-Ax-aAy+aA'y) * * */ return null; } @Override public Shape[] getDbleBoundariesOutInOrMiddle(Shape classicBord) { return getDbleBoundariesMiddle(classicBord); } @Override public Shape getOutsideBorders() { return getMiddleBorders(); } @Override public Shape getInsideBorders() { return getMiddleBorders(); } @Override public Shape getMiddleBorders() { LaTeXDrawPoint2D NW = getTheNWPoint(), SE = getTheSEPoint(); double width = Math.max(Math.abs(NW.x - SE.x), 1); double start = Math.toDegrees(startAngle); double end = startAngle>endAngle ? Math.toDegrees(2*Math.PI-startAngle+endAngle) : Math.toDegrees(endAngle-startAngle); return new Arc2D.Double(NW.x, NW.y, width, width, start, end, type); } @Override public Shape getInsideOutsideOrMiddleBorders() { return getMiddleBorders(); } @Override public boolean canHaveArrow() { return type==Arc2D.OPEN; } @Override public void mirrorHorizontal(LaTeXDrawPoint2D origin) { double tmp = startAngle; ArrowHead tmpAH = arrowHead1; startAngle = Math.PI*2 - endAngle; endAngle = Math.PI*2 - tmp; arrowHead1 = arrowHead2; arrowHead2 = tmpAH; super.mirrorHorizontal(origin); updateCenterStartEndDelimitors(); } @Override public void mirrorVertical(LaTeXDrawPoint2D origin) { double tmp = startAngle; ArrowHead tmpAH = arrowHead1; startAngle = Math.PI*3 - endAngle; endAngle = Math.PI*3 - tmp; arrowHead1 = arrowHead2; arrowHead2 = tmpAH; super.mirrorVertical(origin); updateCenterStartEndDelimitors(); } @Override public void updateToGrid(MagneticGrid grid) { super.updateToGrid(grid); updateCenterStartEndDelimitors(); } /** * @return The coordinate of the start point of the arc. * @since 1.9 */ public LaTeXDrawPoint2D getStartPoint(boolean rotation) { double radius = getRadius(); LaTeXDrawPoint2D pt = new LaTeXDrawPoint2D(gravityCenter.x+Math.cos(startAngle)*radius, gravityCenter.y-Math.sin(startAngle)*radius); if(rotation) return rotateInvertPoint(pt); return pt; } /** * @return The coordinate of the end point of the arc. * @since 1.9 */ public LaTeXDrawPoint2D getEndPoint(boolean rotation) { double radius = getRadius(); LaTeXDrawPoint2D pt = new LaTeXDrawPoint2D(gravityCenter.x+Math.cos(endAngle)*radius, gravityCenter.y-Math.sin(endAngle)*radius); if(rotation) return rotateInvertPoint(pt); return pt; } @Override public boolean intersected(Rectangle2D.Double r) { if(r==null) return false; BasicStroke wideline = new BasicStroke(thickness); Shape outline = wideline.createStrokedShape(shape); boolean ok = outline.intersects(r); if(!ok && type==Arc2D.OPEN && (isFilled() || isHatched() || hasShadow() || hasGradient())) { Line2D.Double l = new Line2D.Double(getStartPoint(true), getEndPoint(true)); if(l.intersects(r)) ok = true; } return ok; } @Override public int getSelectedDelimitorOrientation() { if(dSelected!=null && (dSelected==dStart || dSelected==dEnd)) return DELIMITOR_ORIENTATION_NONE; return super.getSelectedDelimitorOrientation(); } @Override public int hashCode() { return super.hashCode()^3^type; } public boolean hasTwoLeftArrows() { return true; } } latexdraw-2.0.8+1.orig/latexDraw/figures/DrawBorders.java0000644000000000000000000001204511347255510020162 0ustar package latexDraw.figures; import java.awt.Color; import java.awt.Point; import java.io.IOException; import java.io.ObjectInputStream; import latexDraw.util.LaTeXDrawPoint2D; /** * A DrawBorders allows the user to define the position of the origin * of his drawing (the point (0,0)) and to define too the dimensions * (the borders) of his drawing.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    > */ public class DrawBorders extends LaTeXDrawRectangle { private static final long serialVersionUID = 1L; /** Correspond to the origin point (0,0) */ private LaTeXDrawPoint2D originPoint; /** The colour of the rectangle */ public static final Color color = Color.DARK_GRAY; /** * The constructor by default */ public DrawBorders(boolean increaseMeter) { this(new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), false, false, increaseMeter); } /** * The constructor using 2 points * @param NWpt The North-West point of the rectangle * @param SEpt The South-East point of the rectangle */ public DrawBorders(LaTeXDrawPoint2D NWpt, LaTeXDrawPoint2D SEpt, boolean autoAdjust, boolean inSelection, boolean increaseMeter) { super(NWpt,new LaTeXDrawPoint2D(SEpt.x, NWpt.y), new LaTeXDrawPoint2D(NWpt.x, SEpt.y), SEpt, increaseMeter); isBordersMovable = false; isDashableOrDotable = false; canHaveShadow = false; isDoubleBoundaryable = false; originPoint = new LaTeXDrawPoint2D(NWpt.x, (NWpt.y+SEpt.y)/2); isSelected = autoAdjust && inSelection; setLinesColor(color); } /** * Allows to get the bottom left point of the drawing (South-West point) * @return The bottom left point of the drawing */ public LaTeXDrawPoint2D getTheSWPoint() { LaTeXDrawPoint2D p1 = getPoint(0), p2 = getPoint(1); LaTeXDrawPoint2D p3 = getPoint(2), p4 = getPoint(3); if(p1.xp3.y) return p1; return p3; } if(p2.y>p4.y) return p2; return p4; } /** * Allows to get the top right point of the drawing (North-East point) * @return The top right point of the drawing */ public LaTeXDrawPoint2D getTheNEPoint() { LaTeXDrawPoint2D p1 = getPoint(0), p2 = getPoint(1); LaTeXDrawPoint2D p3 = getPoint(2), p4 = getPoint(3); if(p1.x>p2.x) { if(p1.y *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/25/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class AkinPoints extends LaTeXDrawPolygon { private static final long serialVersionUID = 1L; /** The default value of interval. @since 1.9*/ public static final int DEFAULT_INTERVAL = 5; /** The akin points are drawn as curves. @since 1.9*/ public static final short TYPE_CURVES = 1; /** The akin points are drawn as lines. @since 1.9*/ public static final short TYPE_LINES = 0; /** The type by default of the akin points. @since 1.9*/ public static final short DEFAULT_TYPE = TYPE_CURVES; public static final String LABEL_TYPE_CHOICE = "typeChoice";//$NON-NLS-1$ public static final boolean DEFAULT_OPEN = true; /** Define if the shape is closed or not. @since 1.9 */ protected boolean open; /** Define the interval between the each point to use. @since 1.9*/ protected int interval; /** Define the type of the akin points: lines or curves. @since 1.9*/ protected int type; /** * The constructor by default */ public AkinPoints(boolean increaseMeter) { this(new LaTeXDrawPoint2D(), increaseMeter); } /** * The constructor using one point. * @param pt The first point. */ public AkinPoints(LaTeXDrawPoint2D pt, boolean increaseMeter) { super(increaseMeter); open = DEFAULT_OPEN; type = DEFAULT_TYPE; interval = DEFAULT_INTERVAL; isBordersMovable = false; isDashableOrDotable = true; isDoubleBoundaryable = false; canBeFilled = true; borders = new LaTeXDrawRectangle((LaTeXDrawPoint2D)pt.clone(), (LaTeXDrawPoint2D)pt.clone(), false); addPoint(pt); updateShape(); } /** * Create a list of choice in order to select the type of shape we want. * @return The created list. * @since 1.9 */ public static LaTeXDrawComboBox createTypeChoice() { LaTeXDrawComboBox typeChoice = new LaTeXDrawComboBox(); typeChoice.setRenderer(new LabelListCellRenderer()); typeChoice.setName(LABEL_TYPE_CHOICE); typeChoice.setActionCommand(LABEL_TYPE_CHOICE); JLabel l = new JLabel(String.valueOf(TYPE_CURVES)); l.setIcon(LaTeXDrawResources.curvesFreehandIcon); typeChoice.addItem(l); l = new JLabel(String.valueOf(TYPE_LINES)); l.setIcon(LaTeXDrawResources.linesFreehandIcon); typeChoice.addItem(l); return typeChoice; } /** * Allows to add a point to the polygon * @param pt The point to be added */ @Override public boolean addPoint(LaTeXDrawPoint2D pt) { boolean add = true; if(!pts.isEmpty()) { // The problem with akin points, is that some akin points // can be equal and consequently, the code becomes heavier; // so we look the last point and of it's equal to the new point // we don't insert this new point. LaTeXDrawPoint2D p = pts.lastElement(); if(((int)p.x)==((int)pt.x) && ((int)p.y)==((int)pt.y)) add = false; } if(add) { pts.add(pt); if(borders!=null) updateBorders(); updateShape(); return true; } return false; } @Override public boolean addPointAt(LaTeXDrawPoint2D pt, int id) { if(id == -1) id = pts.size()-1; if(id<0 || id>pts.size()) throw new IllegalArgumentException(String.valueOf(id)); if(pt!=null) { if(pts.isEmpty()) pts.add(pt); else pts.add(id, pt); if(borders!=null) updateBorders(pt); updateShape(); return true; } return false; } @Override public void draw(Graphics2D g, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering) { if(pts==null || pts.isEmpty()) return ; if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); else if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[]{0,thickness+dotSep}, 0)); else if(lineStyle.equals(PSTricksConstants.LINE_DASHED_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[]{blackDashLength, whiteDashLength}, 0)); Color formerCol = g.getColor(); if(hasShadow) { Stroke formerS = g.getStroke(); double dx=0, dy=0; LaTeXDrawPoint2D cg = getGravityCenter(); LaTeXDrawPoint2D shadowCg = (LaTeXDrawPoint2D)cg.clone(); shadowCg.setLocation(cg.x+shadowSize, cg.y); shadowCg = Figure.rotatePoint(shadowCg, cg, shadowAngle); dx = shadowCg.x-cg.x; dy = cg.y-shadowCg.y; g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.draw(shape); if(isFilled() || hasGradient() || isHatched()) g.fill(shape); g.translate(-dx, -dy); g.setColor(interiorColor); g.draw(shape); g.setStroke(formerS); } fillFigure(g, antiAlias, rendering, alphaInter, colorRendering, shape); g.setColor(linesColor); g.draw(shape); g.setColor(formerCol); if(isSelected && borders!=null) borders.draw(g, false, antiAlias, rendering, alphaInter, colorRendering); } @Override public boolean isIn(LaTeXDrawPoint2D pt) { if(isSelected && (borders.dNE.isIn(pt) || borders.dNW.isIn(pt) || borders.dSE.isIn(pt) || borders.dSW.isIn(pt) || borders.dS.isIn(pt) || borders.dN.isIn(pt) || borders.dE.isIn(pt) || borders.dW.isIn(pt))) return true; Stroke wideline = new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); Shape s = wideline.createStrokedShape(shape); if(s.contains(pt)) return true; if(isFilled() || hasGradient() || isHatched()) if(shape.contains(pt)) return true; return false; } @Override public void onClick(Point pt) { isSelected = true; if(borders!=null) borders.onClick(pt); } @Override public void setLastPoint(double x, double y) { /* We cannot set the last point of akin points. */ } @Override public String getCodePSTricks(DrawBorders drawBorders, float ppc) { if(getNbPoints()<2) return null; LaTeXDrawPoint2D d = drawBorders.getOriginPoint(); String coord = "", add="", fillCode=""; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ int i, size = getNbPoints(); double threshold = 0.001; if(hasShadow) { add+=",shadow=true";//$NON-NLS-1$ if(Math.toDegrees(shadowAngle)!=PSTricksConstants.DEFAULT_SHADOW_ANGLE) add+=",shadowangle="+(float)Math.toDegrees(shadowAngle);//$NON-NLS-1$ if(((float)shadowSize) != ((float)DEFAULT_SHADOW_SIZE)) add+=",shadowsize="+LaTeXDrawNumber.getCutNumber((float)(shadowSize/PPC), threshold);//$NON-NLS-1$ if(!shadowColor.equals(PSTricksConstants.DEFAULT_SHADOW_COLOR)) { String name = DviPsColors.getColourName(shadowColor); if(name==null) { name = "color"+number+'e';//$NON-NLS-1$ DviPsColors.addUserColour(shadowColor, name); } add += ",shadowcolor=" + name; //$NON-NLS-1$ } } if(!linesColor.equals(PSTricksConstants.DEFAULT_LINE_COLOR)) { String name = DviPsColors.getColourName(linesColor); if(name==null) { name = "color"+number;//$NON-NLS-1$ DviPsColors.addUserColour(linesColor, "color"+number); //$NON-NLS-1$ } add += ",linecolor="+name; //$NON-NLS-1$ } String str = getPSTricksCodeFilling(ppc); if(str.length()>0) fillCode=','+str; if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) add += ",linestyle="+lineStyle+",dotsep="+ //$NON-NLS-1$ //$NON-NLS-2$ LaTeXDrawNumber.getCutNumber(dotSep/ppc, threshold)+ "cm"; //$NON-NLS-1$ else if(lineStyle.equals(PSTricksConstants.LINE_DASHED_STYLE)) add += ",linestyle="+lineStyle+",dash=" + //$NON-NLS-1$ //$NON-NLS-2$ LaTeXDrawNumber.getCutNumber(blackDashLength/ppc, threshold) + "cm "+ //$NON-NLS-1$ LaTeXDrawNumber.getCutNumber(whiteDashLength/ppc, threshold) + "cm";//$NON-NLS-1$ if(type==TYPE_CURVES) { float prevx=0; float prevy=0; float curx = (float)pts.firstElement().x; float cury = (float)pts.firstElement().y; float midx=0; float midy=0; coord = "\\moveto(" +LaTeXDrawNumber.getCutNumber((float)((curx-d.x)/ppc), threshold)+","+//$NON-NLS-1$//$NON-NLS-2$ LaTeXDrawNumber.getCutNumber((float)((d.y-cury)/ppc), threshold)+")\n";//$NON-NLS-1$ if(pts.size()>interval) { prevx = curx; prevy = cury; curx = (float)pts.elementAt(interval).x; cury = (float)pts.elementAt(interval).y; midx = (curx + prevx) / 2.0f; midy = (cury + prevy) / 2.0f; coord += "\\lineto(" +LaTeXDrawNumber.getCutNumber((float)((midx-d.x)/ppc), threshold)+","+//$NON-NLS-1$//$NON-NLS-2$ LaTeXDrawNumber.getCutNumber((float)((d.y-midy)/ppc), threshold)+")\n";//$NON-NLS-1$ } for(i=interval*2; i(); for(int i=0, size = pts.size();i=0) //$NON-NLS-1$ { hasDoubleBoundary = ois.readBoolean(); doubleColor = (Color)ois.readObject(); doubleSep = ois.readDouble(); } else { hasDoubleBoundary = DEFAULT_HAS_DOUBLE_BOUNDARY; doubleColor = DEFAULT_DOUBLE_COLOR; doubleSep = DEFAULT_DOUBLESEP; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.7")>=0) //$NON-NLS-1$ { hasShadow = ois.readBoolean(); shadowAngle = ois.readDouble(); shadowSize = ois.readDouble(); shadowColor = (Color)ois.readObject(); } else { hasShadow = DEFAULT_SHADOW_HAS; shadowAngle = DEFAULT_SHADOW_ANGLE; shadowSize = DEFAULT_SHADOW_SIZE; shadowColor = DEFAULT_SHADOW_COLOR; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.9")>=0) //$NON-NLS-1$ { interval = ois.readInt(); type = ois.readInt(); open = ois.readBoolean(); } else { interval = DEFAULT_INTERVAL; type = DEFAULT_TYPE; open = DEFAULT_OPEN; } shape = createShape2D(); } @Override public void updateToGrid(MagneticGrid grid) { super.updateToGrid(grid); int i=0; while(i0) { this.interval = interval; updateShape(); updateBorders(); } else throw new IllegalArgumentException("The interval must be greater than 0.");//$NON-NLS-1$ } /** * @return the type. * @since 1.9 */ public int getType() { return type; } /** * @param type the type to set. * @since 1.9 */ public void setType(int type) { if(type==TYPE_CURVES || type==TYPE_LINES) { this.type = type; updateShape(); updateBorders(); } } @Override public Shape createShape2D() { GeneralPath gp = new GeneralPath(); int i, size = pts.size(); if(getType()==TYPE_CURVES) { float prevx = (float)pts.lastElement().x; float prevy = (float)pts.lastElement().y; float curx = (float)pts.firstElement().x; float cury = (float)pts.firstElement().y; float midx = (curx + prevx) / 2.0f; float midy = (cury + prevy) / 2.0f; gp.moveTo(curx, cury); if(pts.size()>interval) { prevx = curx; prevy = cury; curx = (float)pts.elementAt(interval).x; cury = (float)pts.elementAt(interval).y; midx = (curx + prevx) / 2.0f; midy = (cury + prevy) / 2.0f; gp.lineTo(midx, midy); } for(i=interval*2; i =pts.size() || id<-1) throw new IllegalArgumentException(); if(id==-1) id = pts.size()-1; pts.remove(id); if(borders!=null) updateBorders(); updateShape(); } @Override public int hashCode() { return super.hashCode()/4; } @Override public void updateBorders() { int i, size = pts.size(); double NWx, NWy, SEy, SEx; if(getType()==TYPE_CURVES) { float prevx = (float)pts.lastElement().x; float prevy = (float)pts.lastElement().y; float curx = (float)pts.firstElement().x; float cury = (float)pts.firstElement().y; float midx = (curx + prevx) / 2.0f; float midy = (cury + prevy) / 2.0f; NWx = SEx = curx; NWy = SEy = cury; if(pts.size()>interval) { prevx = curx; prevy = cury; curx = (float)pts.elementAt(interval).x; cury = (float)pts.elementAt(interval).y; midx = (curx + prevx) / 2.0f; midy = (cury + prevy) / 2.0f; if(midxSEx) SEx = midx; if(midySEy) SEy = midy; } for(i=interval*2; i SEx) SEx = midx; if(midySEy) SEy = midy; } if((i-interval+1)SEx) SEx = pts.lastElement().x; if(pts.lastElement().ySEy) SEy = pts.lastElement().y; } } else { LaTeXDrawPoint2D p = pts.firstElement(); NWx = SEx = p.x; SEy = NWy = p.y; for(i=interval; iSEx) SEx = p.x; if(p.ySEy) SEy = p.y; } if((i-interval)SEx) SEx = pts.lastElement().x; if(pts.lastElement().ySEy) SEy = pts.lastElement().y; } if(borders==null) borders = new LaTeXDrawRectangle(new LaTeXDrawPoint2D(NWx,NWy), new LaTeXDrawPoint2D(SEx,SEy),false); else { borders.setLastPoint(SEx, SEy); borders.setFirstPoint(NWx, NWy); } updateGravityCenter(); } @Override public boolean shadowFillsShape() { return false; } @Override public String toString() { String str = super.toString(); return str + "{pts=" + pts + ", type=" + getType() + ", inter=" + getInterval() + ", open=" + isOpen() + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ } } latexdraw-2.0.8+1.orig/latexDraw/figures/Figure.java0000644000000000000000000020662411347255510017175 0ustar package latexDraw.figures; import static java.lang.Math.PI; import static java.lang.Math.atan; import static java.lang.Math.toDegrees; import java.awt.*; import java.awt.geom.GeneralPath; import java.awt.geom.Line2D; import java.awt.geom.Path2D; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.io.Serializable; import javax.swing.JLabel; import latexDraw.figures.properties.Arrowable; import latexDraw.figures.properties.Drawable; import latexDraw.lang.LaTeXDrawLang; import latexDraw.psTricks.DviPsColors; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.components.Delimitor; import latexDraw.ui.components.LaTeXDrawComboBox; import latexDraw.ui.components.LabelListCellRenderer; import latexDraw.ui.components.MagneticGrid; import latexDraw.util.LaTeXDrawException; import latexDraw.util.LaTeXDrawPoint2D; import latexDraw.util.LaTeXDrawResources; /** * This class defines what it is, in general, a figure.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version.
    *
    * LaTeXDraw is distributed without any warranty; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details.
    *
    * 03/17/2007
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public abstract class Figure implements Serializable, Cloneable, Drawable { private static final long serialVersionUID = 1L; /** The number by default of pixels per cm. */ public static final int PPC = 50; /** Corresponds to the thickness of the borders of the figure (in pixels). */ protected float thickness; /** Corresponds to the selected delimiter (if there is a one selected) */ protected Delimitor dSelected; /** Allows to know if the figure is selected */ protected boolean isSelected; /** Allows to know if the figure can be filled by a colour */ protected boolean canBeFilled; /** Allows to know if the figure is filled by a colour */ protected boolean isFilled; /** Allows to know if the thickness of the figure can be changed */ protected boolean isThicknessable; /** Allows to know if the borders of the figure are movable */ protected boolean isBordersMovable; /** The colour of the borders */ protected Color linesColor; /** The colour of the interior of the figure */ protected Color interiorColor; /** The number of the figure. */ protected int number; /** The meter of figures */ private static int meter = 0; /** Allows to know if the figure is customisable or not */ protected boolean isCustomizable; /** Allows to know if the bounds are double */ protected boolean hasDoubleBoundary; /** Allows to know if the figure can have double boundary */ protected boolean isDoubleBoundaryable; /** The colour of the double boundary */ protected Color doubleColor; /** The position of the double boundary */ protected String bordersPosition; /** Allows to know if the figure can be dotted or dashed */ protected boolean isDashableOrDotable; /** The colour of the hatch */ protected Color hatchingColor; /** The angle of the hatch (in rad). */ protected double hatchingAngle; /** The width of the lines of the hatch (in pixels). */ protected float hatchingWidth; /** Allows to know if the figure is resizable or not */ protected boolean isResizable; /** The kind of hatch used by the figure */ protected String hatchingStyle; /** True if the figure has a shadow. */ protected boolean hasShadow; /** The size of the shadow (in pixels). */ protected double shadowSize; /** The angle of the shadow (in rad). */ protected double shadowAngle; /** The colour of the shadow. */ protected Color shadowColor; /** Define if the figure can have a shadow. */ protected boolean canHaveShadow; /** The angle of the gradient (in rad). */ protected double gradientAngle; /** The position of the midpoint, as a fraction of the distance from top to bottom. Should be between 0 and 1. */ protected double gradientMidPoint; /** The first colour of the gradient. */ protected Color gradientStartColor; /** The second colour of the gradient. */ protected Color gradientEndColor; /** The position of the midpoint, as a fraction of the distance from top to bottom. Should be between 0 and 1. */ public static final double DEFAULT_GRADIENT_MID_POINT = 1; /** The angle of the gradient in radian. */ public static final double DEFAULT_GRADIENT_ANGLE = Math.toRadians(PSTricksConstants.DEFAULT_GRADIENT_ANGLE); /** The value by default of hasShadow. */ public static final boolean DEFAULT_SHADOW_HAS = PSTricksConstants.DEFAULT_SHADOW; /** The value by default of shadowSize (in pixels). */ public static final double DEFAULT_SHADOW_SIZE = PSTricksConstants.DEFAULT_SHADOW_SIZE*PPC; /** The value by default of shadowAngle (in rad). */ public static final double DEFAULT_SHADOW_ANGLE = Math.toRadians(PSTricksConstants.DEFAULT_SHADOW_ANGLE); /** The value by default of shadowAngle. */ public static final Color DEFAULT_SHADOW_COLOR = PSTricksConstants.DEFAULT_SHADOW_COLOR; /** The position by default of the double boundary */ public static final String DEFAULT_BORDERS_POSITION = PSTricksConstants.BORDERS_INSIDE; /** The colour of the double boundary of the figure by default */ public static final Color DEFAULT_DOUBLE_COLOR = PSTricksConstants.DEFAULT_DOUBLE_COLOR; /** The value by default of the attribute hasDoubleBoudary */ public static final boolean DEFAULT_HAS_DOUBLE_BOUNDARY = false; /** The angle of the lines of the hatch by default */ public static final double DEFAULT_HATCH_ANGLE = 0.; /** The size of the separation between the hatching by default. */ public static final double DEFAULT_HATCH_SEP = PSTricksConstants.DEFAULT_HATCH_SEP*PPC; /** A figure is customisable by default ? */ public static final boolean DEFAULT_IS_CUSTOMISABLE = true; /** The borders of the figure are movable by default */ public static final boolean DEFAULT_IS_BORDERS_MOVABLE = true; /** The colour by default of the borders of the figure */ public static final Color DEFAULT_BORDERS_COL = Color.BLACK; /** The colour by default of the interior of the figure */ public static final Color DEFAULT_INTERIOR_COL = Color.WHITE; /** The colour by default of the hatch of the figure */ public static final Color DEFAULT_HATCH_COL = Color.BLACK; /** The value by default of the attribute isThicknessable */ public static final boolean DEFAULT_IS_THICKNESSABLE = true; /** value of the thickness by default (in pixels). */ public static final float DEFAULT_THICKNESS = 2; /** The style of the lines of the figure */ protected String lineStyle; /** The style of lines by default */ public static final String DEFAULT_LINE_STYLE = PSTricksConstants.LINE_NONE_STYLE; /** If a figure is filled by default */ public static final boolean DEFAULT_IS_FILLED = false; /** The label of the ComboBox containing all kinds of hatches */ public static final String LABEL_HATCH_CHOICE = "Hatch choice"; //$NON-NLS-1$ /** The label of the field which allows to change the width of the hatch */ public static final String LABEL_HATCH_WIDTH = "Hatch width"; //$NON-NLS-1$ /** The label of the hatch used by default */ public static final String DEFAULT_HATCH_STYLE = PSTricksConstants.TOKEN_FILL_NONE; /** The value by default of the width of the hatch (in pixels). */ public static final float DEFAULT_HATCH_WIDTH = DEFAULT_THICKNESS; /** The value by default of the attribute isResizable */ public static final boolean DEFAULT_ISRESIZABLE = true; /** The value by default of the attribute isHatched */ public static final boolean DEFAULT_IS_HATCHED = false; /** The label of double boundary choice */ public static final String LABEL_BORDERS_POSITION_CHOICE = LaTeXDrawLang.getOthersString("Figure.boundPos"); //$NON-NLS-1$ /** The centre of the rotation */ protected LaTeXDrawPoint2D gravityCenter; /** The angle of rotation (in rad) */ public double rotationAngle; /** Allows to know if the figure is on rotation */ protected boolean isOnRotation; /** The size of the separation between the double line in pixels */ protected double doubleSep; /** The value by default of the attribute doubleLine */ public static final boolean DEFAULT_DOUBLELINE = false; /** The value by default of the attribute doubleSep (in pixels). */ public static final double DEFAULT_DOUBLESEP = 6; /** The angle of rotation by default */ public static final double DEFAULT_ROTATION_ANGLE = 0.; public static final float DEFAULT_BLACK_DASH_LGTH = 8; public static final float DEFAULT_WHITE_DASH_LGTH = 8; /** The separator between dots by default (in pixels). */ public static final float DEFAULT_DOT_SEP = 8; /** The length of the black dash of a line (in pixels). */ protected float blackDashLength; /** The length of the white dash of a line (in pixels). */ protected float whiteDashLength; /** The separation between two dots in a dotted line (in pixels). */ protected float dotSep; /** The borders of the figure */ protected LaTeXDrawRectangle borders; /** The shape of the figure */ protected transient Shape shape; /** The size of the separation between the hatching (in pixels). */ protected double hatchingSep; /** Define if the shape can have arrows. */ protected boolean canHaveArrow; /** The token used for Horizontal hatch in LaTeXDraw 1.5.1.1, 1.5.1 and 1.5.
    * Useful to read file ldp of these versions of LaTeXDraw.*/ public static final String DECREPETED_FILL_HORIZ = "Horizontal hatch";//$NON-NLS-1$ /** The token used for Vertical hatch in LaTeXDraw 1.5.1.1, 1.5.1 and 1.5.
    * Useful to read file ldp of these versions of LaTeXDraw.*/ public static final String DECREPETED_FILL_VERT = "Vertical hatch";//$NON-NLS-1$ /** The token used for Cross hatch in LaTeXDraw 1.5.1.1, 1.5.1 and 1.5.
    * Useful to read file ldp of these versions of LaTeXDraw.*/ public static final String DECREPETED_FILL_CROSS = "Cross hatch";//$NON-NLS-1$ /** The token used for No hatch in LaTeXDraw 1.5.1.1, 1.5.1 and 1.5.
    * Useful to read file ldp of these versions of LaTeXDraw.*/ public static final String DECREPETED_FILL_NO = "No hatch";//$NON-NLS-1$ public static final short DELIMITOR_ORIENTATION_NONE = -1; public static final short DELIMITOR_ORIENTATION_WEST = 0; public static final short DELIMITOR_ORIENTATION_EAST = 2; public static final short DELIMITOR_ORIENTATION_NORTH = 3; public static final short DELIMITOR_ORIENTATION_SOUTH = 8; public static final short DELIMITOR_ORIENTATION_NW = 4; public static final short DELIMITOR_ORIENTATION_SW = 5; public static final short DELIMITOR_ORIENTATION_NE = 6; public static final short DELIMITOR_ORIENTATION_SE = 7; public static final short DELIMITOR_ROTATION = 9; /** * The constructor. * @param increaseMeter If the figure must increase the meter of figure {@literal number}. */ protected Figure(boolean increaseMeter) { canHaveArrow = false; hatchingSep = DEFAULT_HATCH_SEP; isBordersMovable = DEFAULT_IS_BORDERS_MOVABLE; bordersPosition = DEFAULT_BORDERS_POSITION; doubleColor = DEFAULT_DOUBLE_COLOR; isResizable = DEFAULT_ISRESIZABLE; doubleSep = DEFAULT_DOUBLESEP; isDashableOrDotable = true; isDoubleBoundaryable = true; isCustomizable = DEFAULT_IS_CUSTOMISABLE; isOnRotation = false; isThicknessable = DEFAULT_IS_THICKNESSABLE; rotationAngle = DEFAULT_ROTATION_ANGLE; isSelected = false; interiorColor = DEFAULT_INTERIOR_COL; linesColor = DEFAULT_BORDERS_COL; hatchingColor = DEFAULT_BORDERS_COL; hatchingStyle = DEFAULT_HATCH_STYLE; isFilled = DEFAULT_IS_FILLED; canBeFilled = true; dSelected = null; number = increaseMeter ? meter++ : -1; blackDashLength = DEFAULT_BLACK_DASH_LGTH; whiteDashLength = DEFAULT_WHITE_DASH_LGTH; lineStyle = PSTricksConstants.LINE_NONE_STYLE; dotSep = DEFAULT_DOT_SEP; thickness = DEFAULT_THICKNESS; hatchingWidth = DEFAULT_HATCH_WIDTH; gravityCenter = new LaTeXDrawPoint2D(); isResizable = true; shadowAngle = DEFAULT_SHADOW_ANGLE; shadowColor = DEFAULT_SHADOW_COLOR; shadowSize = DEFAULT_SHADOW_SIZE; hasShadow = DEFAULT_SHADOW_HAS; canHaveShadow = true; gradientAngle = DEFAULT_GRADIENT_ANGLE; gradientEndColor = PSTricksConstants.DEFAULT_GRADIENT_END_COLOR; gradientStartColor = PSTricksConstants.DEFAULT_GRADIENT_START_COLOR; gradientMidPoint = DEFAULT_GRADIENT_MID_POINT; } /** * Creates a figure from one another (but do not create the gravity centre, the border and the shape). * @param f The figure to copy. * @param sameNumber True is the new figure must have the same number as the other. * @throws IllegalArgumentException If f is null. */ protected Figure(Figure f, boolean sameNumber) { if(f==null) throw new IllegalArgumentException(); canBeFilled = f.canBeFilled; canHaveShadow = f.canHaveShadow; isBordersMovable= f.isBordersMovable; isCustomizable = f.isCustomizable; isDashableOrDotable = f.isDashableOrDotable; isDoubleBoundaryable= f.isDoubleBoundaryable; isFilled = f.isFilled; isOnRotation = f.isOnRotation; isResizable = f.isResizable; isSelected = f.isSelected; interiorColor = f.interiorColor; isThicknessable = f.isThicknessable; blackDashLength = f.blackDashLength; bordersPosition = f.bordersPosition; dotSep = f.dotSep; doubleColor = f.doubleColor; doubleSep = f.doubleSep; gradientAngle = f.gradientAngle; gradientEndColor= f.gradientEndColor; gradientMidPoint= f.gradientMidPoint; gradientStartColor=f.gradientStartColor; hasDoubleBoundary=f.hasDoubleBoundary; hasShadow = f.hasShadow; hatchingAngle = f.hatchingAngle; hatchingColor = f.hatchingColor; hatchingStyle = f.hatchingStyle; hatchingWidth = f.hatchingWidth; hatchingSep = f.hatchingSep; linesColor = f.linesColor; lineStyle = f.lineStyle; number = sameNumber ? f.number : meter++; rotationAngle = f.rotationAngle; shadowAngle = f.shadowAngle; shadowColor = f.shadowColor; shadowSize = f.shadowSize; thickness = f.thickness; whiteDashLength = f.whiteDashLength; } /** * Allows to know if the new position is a valid borders position. * @param pos The position to check. * @return True is the position is valid. */ public static boolean isValidBordersPosition(String pos) { return pos.equals(PSTricksConstants.BORDERS_INSIDE) || pos.equals(PSTricksConstants.BORDERS_MIDDLE) || pos.equals(PSTricksConstants.BORDERS_OUTSIDE); } /** * @return True if the figure is in rotation. */ public boolean isOnRotation() { return isOnRotation; } /** * @return True if the figure is hatched. */ public synchronized boolean isHatched() { return !hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_NONE) && !hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_SOLID) && !hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_GRADIENT) ; } /** * Allows to set if the figure must be in rotation or not. * @param on True : the figure must be on rotation. */ public synchronized void setOnRotation(boolean on) { if(borders != null) borders.setOnRotation(on); isOnRotation = on; updateStyleOfDelimitors(); } /** * Allows to change the style of the delimiters following the actions to do (rotation, ...). */ public void updateStyleOfDelimitors() { if(borders != null) borders.updateStyleOfDelimitors(); } /** * Allows to create a Java Swing shape from the figure. * @return The Java Swing shape. */ public abstract Shape createShape2D(); /** * Allows to create a java swing shape from the figure (without any rotation). * @return The java swing shape. */ public abstract Shape createNonRotatedShape2D(); @Override public Object clone() throws CloneNotSupportedException { Figure f = (Figure)super.clone(); f.dSelected = null; f.isOnRotation = isOnRotation; f.rotationAngle = rotationAngle; f.isSelected = isSelected; f.interiorColor = interiorColor; f.linesColor = linesColor; f.isFilled = isFilled; f.canBeFilled = canBeFilled; f.number = meter++; f.blackDashLength = blackDashLength; f.whiteDashLength = whiteDashLength; f.lineStyle = lineStyle; f.dotSep = dotSep; f.thickness = thickness; f.gravityCenter = (LaTeXDrawPoint2D)gravityCenter.clone(); f.doubleColor = doubleColor; f.doubleSep = doubleSep; f.hasDoubleBoundary = hasDoubleBoundary; f.hatchingAngle = hatchingAngle; f.hatchingColor = hatchingColor; f.hatchingStyle = hatchingStyle; f.hatchingWidth = hatchingWidth; f.isBordersMovable = isBordersMovable; f.isCustomizable = isCustomizable; f.isDashableOrDotable = isDashableOrDotable; f.isDoubleBoundaryable = isDoubleBoundaryable; f.isResizable = isResizable; f.isThicknessable = isThicknessable; f.bordersPosition = bordersPosition; f.hasShadow = hasShadow; f.shadowAngle = shadowAngle; f.shadowColor = shadowColor; f.shadowSize = shadowSize; f.canHaveShadow = canHaveShadow; f.gradientAngle = gradientAngle; f.gradientEndColor = gradientEndColor; f.gradientStartColor = gradientStartColor; f.gradientMidPoint = gradientMidPoint; f.hatchingSep = hatchingSep; return f; } /** * Allows to know if the figure can be filled or not. * @return True if the figure can be filled. */ public boolean canBeFilled() { return canBeFilled; } /** * Allows to know if the figure can be hatched or not * @return True if the figure can be hatched (for most of figures, if it can be filled, it can be hatched) */ public boolean canBeHatched() { return canBeFilled; } /** * Allows to get the number of the figure * @return The number of the figure */ public synchronized int getNumber() { return number; } /** * Allows to get a point of the borders * @param id The position of the point (-1 : return the last point, in fact the south-east point) * @return The point */ public synchronized LaTeXDrawPoint2D getBordersPoint(int id) { if(borders == null) return null; if(id == -1) return borders.getPoint(borders.getNbPoints()-1); if(id<0 || id>LaTeXDrawRectangle.NB_POINTS_FRAME-1) throw new IllegalArgumentException(); return borders.getPoint(id); } /** * Allows to get the angle of rotation (in rad). * @return The angle of rotation. */ public synchronized double getRotationAngle() { return rotationAngle; } /** * Allows to set the angle of rotation * @param theta The new angle of rotation in radian. */ public synchronized void setRotationAngle(double theta) { if(!Double.isInfinite(theta) && !Double.isNaN(theta)) { rotationAngle = theta%(PI*2.); if(borders != null) borders.setRotationAngle(rotationAngle); } } /** * Allows to set the variable isSelected * @param state The new value of isSelected */ public synchronized void setSelected(boolean state) { if(!state) { onRelease(); onDelimitorRelease(); } else { isSelected = state; if(borders != null) borders.setSelected(state); } } /** * Allows to set the colour of the borders of the figure * @param c The new colour of the borders */ public synchronized void setLinesColor(Color c) { if(c!=null) linesColor = c; } /** * Allows to set the colour of the interior of the figure * @param c The new colour of the interior */ public synchronized void setInteriorColor(Color c) { if(c!=null) interiorColor = c; } /** * Allows to set the style of the lines of the figure * @param style The new style of the lines of the figure * @throws IllegalArgumentException If the style is invalid. */ public synchronized void setLineStyle(String style) { if(isValidStyle(style)) lineStyle = style; else throw new IllegalArgumentException(); } /** * Allows to change the kid of hatch of the figure. * @param style The new style. * @throws IllegalArgumentException If the style is invalid. */ public synchronized void setHatchingStyle(String style) { if(PSTricksConstants.isValidFillStyle(style)) hatchingStyle = style; else throw new IllegalArgumentException(); } /** * Allows to set the attribute isFilled * @param state The new value of */ public synchronized void setIsFilled(boolean state) { isFilled = state; } /** * Allows to set the colour of the hatch of the figure * @param color The new colour of the hatch */ public synchronized void setHatchingColor(Color color) { if(canBeFilled() && color!=null) hatchingColor = color; } /** * Allows to set the width of the hatch. * @param width The new width of the hatch. */ public synchronized void setHatchingWidth(float width) { if(width>0 && !Double.isInfinite(width) && !Double.isNaN(width)) hatchingWidth = width; } /** * Allows to set the thickness of the figure * @param value The new */ public synchronized void setThickness(float value) { if(value<=0 || Float.isInfinite(value) || Float.isNaN(value)) return ; if(borders != null) borders.setThickness(value); thickness = value; } /** * Defines the actions to do when the figure is dragged. * @param formerPt The former position of the cursor. * @param newPt The new position of the cursor. * @throws Exception */ public abstract void onDragged(Point formerPt, Point newPt) throws Exception; /** * Allows to draw the figure. * @param g The graphic * @param antiAlias The antialiasing value * @param rendering The rendering value * @param alphaInter The alpha interpolation value * @param colorRendering The colour rendering value */ public abstract void draw(Graphics2D g, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering); /** * Allows to set the last point of the figure * @param pt The new point */ public void setLastPoint(LaTeXDrawPoint2D pt) { setLastPoint(pt.x, pt.y); } /** * Allows to set the last point of the figure * @param x The X-coordinates of the new point * @param y The Y-coordinates of the new point */ public abstract void setLastPoint(double x, double y); /** * @return The last point, null if there is no last point. */ public abstract LaTeXDrawPoint2D getLastPoint(); /** * Allows to set the first point of the figure * @param pt The new point */ public void setFirstPoint(LaTeXDrawPoint2D pt) { setFirstPoint(pt.x, pt.y); } /** * Allows to set the first point of the figure * @param x The X-coordinates of the new point * @param y The Y-coordinates of the new point */ public abstract void setFirstPoint(double x, double y); /** * Allows to gap the figure * @param shiftX The X-coordinates gap * @param shiftY The Y-coordinates gap */ public abstract void shift(double shiftX, double shiftY); /** * Allows to gap the figure. * @param formerPt The former position of the figure. * @param newPt The new position of the figure. * @throws IllegalArgumentException If one of the point is null. */ public void shift(LaTeXDrawPoint2D formerPt, LaTeXDrawPoint2D newPt) { if(formerPt==null || newPt==null) throw new IllegalArgumentException(); shift(newPt.x - formerPt.x, newPt.y - formerPt.y); } /** * Allows to gap the figure * * @param formerPt The former position of the figure * @param newPt The new position of the figure */ public void shift(Point formerPt, Point newPt) { shift(newPt.x - formerPt.x, newPt.y - formerPt.y); } /** * Allows to rescale the polygon in width * @param formerX The old value of the X-coordinate to change * @param newX The X-coordinate of the point which rescale the figure. It's * Useful for determinate of which side (east or west) we must enlarge thecfigure * @param percent The new width of the figure in percent * @param bound The reference for moving points (the borders of the figure * or, for example, the borders of the drawing containing the figure) */ public abstract void rescaleX(double formerX, double newX, double percent, LaTeXDrawRectangle bound); /** * Allows to rescale the polygon in width * @param formerY The former value of the y * @param newY The Y-coordinate of the point which rescale the polygon. It's * Useful for determinate of which side (east or west) we must enlarge the polygon * @param percent The new width of the polygon in percent * @param bound The reference for moving points (the borders of the figure * or, for example, the borders of the drawing containing the figure) */ public abstract void rescaleY(double formerY, double newY, double percent, LaTeXDrawRectangle bound); /** * Allows to rotate, following the angle of rotation, the given point. * @param p The point to rotate. * @return The new point rotated. */ public LaTeXDrawPoint2D rotatePoint(LaTeXDrawPoint2D p) { return rotatePoint(p, gravityCenter, rotationAngle); } /** * Allows to rotate a point with the gravity centre of the figure. * @param p The point to rotate. * @param theta The angle of rotation. * @return The rotated point. */ public synchronized LaTeXDrawPoint2D rotatePoint(LaTeXDrawPoint2D p, double theta) { return rotatePoint(p, getGravityCenter(), theta); } /** * Allows to rotate a point with as reference an other point. * @param p The point to rotate. * @param gravityC The point of reference. * @param theta The angle of rotation (in rad). * @return The rotated point. */ public static LaTeXDrawPoint2D rotatePoint(LaTeXDrawPoint2D p, LaTeXDrawPoint2D gravityC, double theta) { LaTeXDrawPoint2D pt = new LaTeXDrawPoint2D(); double cosTheta; double sinTheta; if(theta<0.) theta = 2.*PI + theta; if((theta%(2.*PI))==0.) return (LaTeXDrawPoint2D)p.clone(); if(Math.abs(theta%(2.*PI)-PI/2.)<0.000001) { cosTheta = 0.; sinTheta = 1.; } else { if(Math.abs(theta%(2.*PI)-PI)<0.000001) { cosTheta = -1.; sinTheta = 0.; } else { if(Math.abs(theta%(2.*PI)-(3.*PI/2.))<0.000001) { cosTheta = 0.; sinTheta = -1.; } else { cosTheta = Math.cos(theta); sinTheta = Math.sin(theta); } } } pt.x = cosTheta * (p.x - gravityC.x) - sinTheta * (p.y - gravityC.y) + gravityC.x; pt.y = sinTheta * (p.x - gravityC.x) + cosTheta * (p.y - gravityC.y) + gravityC.y; return pt; } /** * Allows to rotate, following the negation of angle of rotation, the given point. * @param p The point to rotate. * @return The new point rotated. */ public LaTeXDrawPoint2D rotateInvertPoint(LaTeXDrawPoint2D p) { LaTeXDrawPoint2D pt = new LaTeXDrawPoint2D(); double angle = -rotationAngle; double cosTheta; double sinTheta; if(angle<0) angle = 2.*PI + angle; angle = angle%(2.*PI); if(angle==0.) return (LaTeXDrawPoint2D)p.clone(); if(Math.abs(angle-(PI/2.))<0.000001) { cosTheta = 0.; sinTheta = 1.; } else { if(Math.abs(angle-PI)<0.000001) { cosTheta = -1.; sinTheta = 0.; } else { if(Math.abs(angle-(3.*PI/2.))<0.000001) { cosTheta = 0.; sinTheta = -1.; } else { cosTheta = Math.cos(angle); sinTheta = Math.sin(angle); } } } pt.x = cosTheta * (p.x - gravityCenter.x) - sinTheta * (p.y - gravityCenter.y) + gravityCenter.x; pt.y = sinTheta * (p.x - gravityCenter.x) + cosTheta * (p.y - gravityCenter.y) + gravityCenter.y; return pt; } /** * Allows to rotate, following the angle of rotation, the given point. * @param p The point to rotate. * @return The new point rotated. */ public LaTeXDrawPoint2D rotatePoint(Point p) { return rotatePoint(new LaTeXDrawPoint2D(p.x, p.y)); } /** * Allows to rotate, following the negation of the angle of rotation, the given point. * @param p The point to rotate. * @return The new point rotated. */ public LaTeXDrawPoint2D rotateInvertPoint(Point p) { return rotateInvertPoint(new LaTeXDrawPoint2D(p.x, p.y)); } /** * Actions to do when the figure is released. */ public synchronized void onDelimitorRelease() { updateStyleOfDelimitors(); dSelected = null; if(borders != null) borders.onDelimitorRelease(); } /** * Fills a figure. * @param g The graphics. * @param antiAlias The antialiasing value. * @param rendering The rendering value. * @param alphaInter The alpha interpolation value. * @param colorRendering The colour rendering value. * @param s The pattern of the figure to fill. */ protected void fillFigure(Graphics2D g, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering, Shape s) { Color formerColor = g.getColor(); GeneralPath p = new GeneralPath(s); p.setWindingRule(Path2D.WIND_NON_ZERO); try { if(!hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_NONE)) { if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_SOLID)) { g.setColor(interiorColor); g.fill(shape); g.setColor(formerColor); return; } if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_GRADIENT)) { LaTeXDrawPoint2D NW = getTheNWPoint(); LaTeXDrawPoint2D SE = getTheSEPoint(); LaTeXDrawPoint2D pt1 = new LaTeXDrawPoint2D((NW.x+SE.x)/2., NW.y); LaTeXDrawPoint2D pt2 = new LaTeXDrawPoint2D((NW.x+SE.x)/2., SE.y); double angle = gradientAngle%(2*PI); double gradMidPt = gradientMidPoint; if(angle<0) angle = 2*PI + angle; if(angle>=PI) { gradMidPt = 1 - gradientMidPoint; angle = angle-PI; } if(angle!=0) { if((angle%(PI/2.))==0) { pt1 = new LaTeXDrawPoint2D(NW.x, (NW.y+SE.y)/2.); pt2 = new LaTeXDrawPoint2D(SE.x, (NW.y+SE.y)/2.); if(gradMidPt<0.5) pt1.x = pt2.x - Point2D.distance(pt2.x, pt2.y, SE.x,(NW.y+SE.y)/2.); pt2.x = (NW.x+(SE.x-NW.x)*gradMidPt); } else { LaTeXDrawPoint2D cg = getGravityCenter(); Line l2, l; pt1 = Figure.rotatePoint(pt1, cg, -angle); pt2 = Figure.rotatePoint(pt2, cg, -angle); l = new Line(pt1, pt2, false); if(angle>=0 && angle<(PI/2.)) l2 = l.getPerpendicularLine(NW, false); else l2 = l.getPerpendicularLine(new LaTeXDrawPoint2D(NW.x,SE.y), false); pt1 = l.getIntersection(l2); double distance = Point2D.distance(cg.x, cg.y, pt1.x, pt1.y); l.setPointAt(pt1, 0); LaTeXDrawPoint2D[] pts = l.findPoints(pt1, 2*distance*gradMidPt); pt2 = pts[0]; if(gradMidPt<0.5) pt1 = Figure.rotatePoint(pt1, gravityCenter, PI); } }//if(angle!=0) else { if(gradMidPt<0.5) pt1.y = pt2.y - Point2D.distance(pt2.x, pt2.y, (NW.x+SE.x)/2.,SE.y); pt2.y = (NW.y+(SE.y-NW.y)*gradMidPt); } g.setPaint(new GradientPaint( (float)pt1.x, (float)pt1.y, gradientStartColor, (float)pt2.x, (float)pt2.y, gradientEndColor,true)); g.fill(p); g.setColor(formerColor); return; } Shape oldClip = g.getClip(); Rectangle2D bounds = s.getBounds2D(); g.setClip(s); if(isFilled() || hasShadow()) { g.setColor(interiorColor); g.fill(bounds); } if(isHatched()) { Stroke oldStroke = g.getStroke(); if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_VLINES) || hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_VLINES_F)) paintHatchings2(g, hatchingAngle, bounds); else if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_HLINES) || hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_HLINES_F)) paintHatchings2(g, hatchingAngle>0?hatchingAngle-Math.PI/2.:hatchingAngle+Math.PI/2., bounds); else if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_CROSSHATCH) || hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_CROSSHATCH_F)) { paintHatchings2(g, hatchingAngle, bounds); paintHatchings2(g, hatchingAngle>0?hatchingAngle-Math.PI/2.:hatchingAngle+Math.PI/2., bounds); } g.setStroke(oldStroke); } g.setClip(oldClip); } else if(isFilled) { g.setColor(interiorColor); g.fill(p); } }catch(LaTeXDrawException e) { e.printStackTrace(); } g.setColor(formerColor); } /** * Paints the hatchings. * @param g The graphics to paint. * @param angle The angle of the hatchings (in radian). * @param clip The clip box. */ private void paintHatchings2(Graphics2D g, double angle, Rectangle2D clip) { if(g==null || clip==null) return ; double angle2 = angle%(Math.PI*2.); float halphPI = (float)(Math.PI/2.); if(angle2>0) { if((float)angle2>3f*halphPI) angle2 = angle2-Math.PI*2.; else if((float)angle2>halphPI) angle2 = angle2-Math.PI; } else if((float)angle2<-3f*halphPI) angle2 = angle2+Math.PI*2.; else if((float)angle2<-halphPI) angle2 = angle2+Math.PI; Line2D.Double line = new Line2D.Double(); double val = hatchingWidth+hatchingSep; float fAngle = (float)angle2; g.setStroke(new BasicStroke(hatchingWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.setPaint(getHatchingColor()); if(fAngle==0f) { line.y1 = clip.getMinY(); line.y2 = clip.getMaxY(); double maxX = clip.getMaxX(); for(double x = clip.getMinX(); x0f) { line.y1 = clip.getMinY(); maxX = clip.getMaxX() + (clip.getMaxY()-(clip.getMinY()<0?clip.getMinY():0)) * Math.tan(angle2); } else { line.y1 = clip.getMaxY(); maxX = clip.getMaxX() - clip.getMaxY() * Math.tan(angle2); } line.x1 = clip.getMinX(); line.x2 = line.x1; line.y2 = line.y1; if(((float)incX)<=0f) return ; while(line.x2 < maxX) { line.x2 += incX; line.y1 += incY; g.draw(line); } } } /** * Allows to know if the point pt is in (or on) the figure. * @param pt The point * @return true: if the point is in or on the figure. */ public boolean isIn(Point pt) { return isIn(new LaTeXDrawPoint2D(pt.x, pt.y)); } /** * Allows to know if the point pt is in(or on) the figure. * @param pt The point * @return true : if the point is in or on the figure. */ public abstract boolean isIn(LaTeXDrawPoint2D pt); /** * @return True if the figure is filled by a colour. */ public synchronized boolean isFilled() { return isFilled; } /** * @return True if a delimiter is selected. */ public synchronized boolean isADelimitorSelected() { return dSelected != null; } /** * Allows to know if the figure intersects the given shape. * @param r The shape. * @return True if the figure intersects the shape. */ public boolean intersected(Rectangle2D.Double r) { if(r==null) return false; Shape s = createShape2D(); Shape sTooSmall = getTooSmallShape(s); if(sTooSmall!=null) s = sTooSmall; BasicStroke wideline = new BasicStroke(thickness); Shape outline = wideline.createStrokedShape(s); return outline.intersects(r) && !outline.contains(r); } /** * Allows to check if the style is possible. * @param style The style to check. * @return True if the style is valid. */ public static boolean isValidStyle(String style) { if(style.equals(PSTricksConstants.LINE_NONE_STYLE)|| style.equals(PSTricksConstants.LINE_DASHED_STYLE) || style.equals(PSTricksConstants.LINE_DOTTED_STYLE)) return true; return false; } /** * Allows to create a list of the different position of the borders. * @return The list. */ public static LaTeXDrawComboBox createBordersPositionChoice() { LaTeXDrawComboBox dbPositionChoice = new LaTeXDrawComboBox(); dbPositionChoice.setRenderer(new LabelListCellRenderer()); JLabel label = new JLabel(PSTricksConstants.BORDERS_OUTSIDE); label.setName(PSTricksConstants.BORDERS_OUTSIDE); label.setIcon(LaTeXDrawResources.innerIcon); dbPositionChoice.addItem(label); label = new JLabel(PSTricksConstants.BORDERS_INSIDE); label.setName(PSTricksConstants.BORDERS_INSIDE); label.setIcon(LaTeXDrawResources.outerIcon); dbPositionChoice.addItem(label); label = new JLabel(PSTricksConstants.BORDERS_MIDDLE); label.setName(PSTricksConstants.BORDERS_MIDDLE); label.setIcon(LaTeXDrawResources.middleIcon); dbPositionChoice.addItem(label); dbPositionChoice.setName(Figure.LABEL_BORDERS_POSITION_CHOICE); dbPositionChoice.setActionCommand(Figure.LABEL_BORDERS_POSITION_CHOICE); dbPositionChoice.setSelectedItem(Figure.DEFAULT_BORDERS_POSITION); return dbPositionChoice; } /** * Allows to create a list of the different style of line. * @return The list. */ public static LaTeXDrawComboBox createStyleLineChoice() { LaTeXDrawComboBox lineChoice = new LaTeXDrawComboBox(); lineChoice.setRenderer(new LabelListCellRenderer()); JLabel label = new JLabel(PSTricksConstants.LINE_NONE_STYLE); label.setName(PSTricksConstants.LINE_NONE_STYLE); label.setIcon(LaTeXDrawResources.lineStyleNoneIcon); lineChoice.addItem(label); label = new JLabel(PSTricksConstants.LINE_DASHED_STYLE); label.setName(PSTricksConstants.LINE_DASHED_STYLE); label.setIcon(LaTeXDrawResources.lineStyleDashedIcon); lineChoice.addItem(label); label = new JLabel(PSTricksConstants.LINE_DOTTED_STYLE); label.setName(PSTricksConstants.LINE_DOTTED_STYLE); label.setIcon(LaTeXDrawResources.lineStyleDottedIcon); lineChoice.addItem(label); lineChoice.setSelectedItem(PSTricksConstants.LINE_NONE_STYLE); return lineChoice; } /** * Allows to create a list containing all kinds of hatch. * @return A JComboBox. */ public static LaTeXDrawComboBox createFillChoice() { LaTeXDrawComboBox list = new LaTeXDrawComboBox(); list.setRenderer(new LabelListCellRenderer()); list.setName(LABEL_HATCH_CHOICE); list.setActionCommand(LABEL_HATCH_CHOICE); JLabel l = new JLabel(PSTricksConstants.TOKEN_FILL_NONE); l.setName(PSTricksConstants.TOKEN_FILL_NONE); l.setIcon(LaTeXDrawResources.hatchNoneIcon); list.addItem(l); l = new JLabel(PSTricksConstants.TOKEN_FILL_CROSSHATCH); l.setName(PSTricksConstants.TOKEN_FILL_CROSSHATCH); l.setIcon(LaTeXDrawResources.hatchCrossIcon); list.addItem(l); l = new JLabel(PSTricksConstants.TOKEN_FILL_HLINES); l.setName(PSTricksConstants.TOKEN_FILL_HLINES); l.setIcon(LaTeXDrawResources.hatchHorizIcon); list.addItem(l); l = new JLabel(PSTricksConstants.TOKEN_FILL_VLINES); l.setName(PSTricksConstants.TOKEN_FILL_VLINES); l.setIcon(LaTeXDrawResources.hatchVertIcon); list.addItem(l); l = new JLabel(PSTricksConstants.TOKEN_FILL_GRADIENT); l.setName(PSTricksConstants.TOKEN_FILL_GRADIENT); l.setIcon(LaTeXDrawResources.gradientIcon); list.addItem(l); return list; } /** * Allows to obtain the point most to the North and on the West of the figure. * @return the point most to the North and on the West of the figure. */ public LaTeXDrawPoint2D getTheNWPoint() { if(borders != null) return borders.getTheNWPoint(); return null; } /** * Allows to get the south-east point by taking into account the angle of rotation. * @return The south-east point of the rotated rectangle. */ public LaTeXDrawPoint2D getTheSERotatedPoint() { if(borders != null) return borders.getTheSERotatedPoint(); return null; } /** * Allows to get the north-west point by taking into account the angle of rotation. * @return The north-west point of the rotated rectangle. */ public LaTeXDrawPoint2D getTheNWRotatedPoint() { if(borders != null) return borders.getTheNWRotatedPoint(); return null; } /** * Allows to get a clone of the centre of gravity of the figure. * @return The centre of gravity of the figure. */ public synchronized LaTeXDrawPoint2D getGravityCenter() { updateGravityCenter(); return (LaTeXDrawPoint2D)gravityCenter.clone(); } /** * Allows to get the LaTeX code of the figure. * @return the LaTeX code of the figure. */ public abstract String getCodePSTricks(DrawBorders drawBorders, float ppc); /** * Allows to get the colour of the borders of the figure. * @return The colour of the borders of the figure. */ public synchronized Color getLinesColor() { return linesColor; } /** * @return The borders of the figure. */ public synchronized LaTeXDrawRectangle getBorders() { return borders; } /** * @return The colour of the interior of the figure. */ public synchronized Color getInteriorColor() { return interiorColor; } /** * @return The style of the lines of the figure. */ public synchronized String getLineStyle() { return lineStyle; } /** * @return The kind of hatch. */ public synchronized String getHatchingStyle() { return hatchingStyle; } /** * @return The colour of the hatch. */ public synchronized Color getHatchingColor() { return hatchingColor; } /** * @return The width of the lines of the hatch. */ public synchronized float getHatchingWidth() { return hatchingWidth; } /** * @return The thickness of the figure. */ public synchronized float getThickness() { return thickness; } /** * Corresponds to what to do when the user click on the figure. * @param pt The clicked point. */ public void onClick(Point pt) { isSelected = true; if (borders != null) borders.onClick(pt); } /** * Corresponds to what to do when the user release the mouse. */ public synchronized void onRelease() { setOnRotation(false); isSelected = false; dSelected = null; if(borders != null) borders.onRelease(); } /** * Allows to obtain the point most to the South and on the East of the figure. * @return the point most to the South and on the East of the figure. */ public LaTeXDrawPoint2D getTheSEPoint() { if(borders != null) return borders.getTheSEPoint(); return null; } /** * @return True if the figure is selected. */ public synchronized boolean isSelected() { return isSelected; } /** * Allows to update the centre of gravity of the figure (Useful for rotation). */ public synchronized void updateGravityCenter() { if(borders==null) return ; borders.updateGravityCenter(); LaTeXDrawPoint2D gc = borders.getGravityCenter(); if(gravityCenter!=null) { if(gc!=null) gravityCenter.setLocation(gc); } else gravityCenter = gc; } /** * @return Returns the isCustomizable. */ public synchronized boolean isCustomizable() { return isCustomizable; } /** * @return Returns the isThicknessable. */ public synchronized boolean isThicknessable() { return isThicknessable; } /** * @return Returns the doubleSep. */ public synchronized double getDoubleSep() { return doubleSep; } /** * @param doubleSep The doubleSep to set. */ public synchronized void setDoubleSep(double doubleSep) { if(!Double.isInfinite(doubleSep) && !Double.isNaN(doubleSep)) this.doubleSep = doubleSep; } /** * @return Returns the hasDoubleBoundary. */ public synchronized boolean hasDoubleBoundary() { return hasDoubleBoundary; } /** * @param hasDoubleBoundary The hasDoubleBoundary to set. */ public synchronized void setHasDoubleBoundary(boolean hasDoubleBoundary) { this.hasDoubleBoundary = hasDoubleBoundary; updateShape(); } /** * @return Returns the isDashableOrDotable. */ public synchronized boolean isDashableOrDotable() { return isDashableOrDotable; } /** * @return Returns the isDoubleBoundaryable. */ public synchronized boolean isDoubleBoundaryable() { return isDoubleBoundaryable; } /** * @param isCustomizable The isCustomizable to set. */ public synchronized void setCustomizable(boolean isCustomizable) { this.isCustomizable = isCustomizable; } /** * @return Returns the isResizable. */ public synchronized boolean isResizable() { return isResizable; } /** * @param isResizable The isResizable to set. */ public synchronized void setResizable(boolean isResizable) { this.isResizable = isResizable; } /** * @return Returns the doubleColor. */ public synchronized Color getDoubleColor() { return doubleColor; } /** * @param doublecolor The doubleColor to set. */ public synchronized void setDoubleColor(Color doublecolor) { if(doublecolor!=null) this.doubleColor = doublecolor; } /** * @return Returns the doubleLinePosition. */ public synchronized String getBordersPosition() { return bordersPosition; } /** * @param doubleLinePosition The doubleLinePosition to set. */ public synchronized void setBordersPosition(String doubleLinePosition) { if(isValidBordersPosition(doubleLinePosition) && isBordersMovable) { this.bordersPosition = doubleLinePosition; updateShape(); } } /** * Allows to get the north-westiest point of the bounds of the figure (the * bounds consider the thickness of the figure and the position of the borders). * @return The north-westiest point of the bounds of the figure */ public LaTeXDrawPoint2D getTheNWBoundPoint() { Rectangle2D bounds = createShape2D().getBounds2D(); if(bounds == null) return null; if(hasShadow) { double dx=0, dy=0; LaTeXDrawPoint2D cg = getGravityCenter(); LaTeXDrawPoint2D shadowCg = (LaTeXDrawPoint2D)cg.clone(); shadowCg.setLocation(cg.x+shadowSize, cg.y); shadowCg = Figure.rotatePoint(shadowCg, cg, shadowAngle); dx = shadowCg.x-cg.x; dy = cg.y-shadowCg.y; Rectangle2D.Double bounds2 = new Rectangle2D.Double(bounds.getX()+dx,bounds.getY()+dy, bounds.getWidth(), bounds.getHeight()); bounds2.add(bounds); bounds = bounds2; } return new LaTeXDrawPoint2D(bounds.getX()-thickness/2., bounds.getY()-thickness/2.); } /** * Allows to get the north-westiest point of the bounds of the figure (the * bounds consider the thickness of the figure and the position of the * borders), without any rotation of the figure. It doesn't take account of the shadow. */ public LaTeXDrawPoint2D getTheNWNonRotatedBoundPoint() { Rectangle2D bounds = createNonRotatedShape2D().getBounds2D(); if(bounds == null) return null; return new LaTeXDrawPoint2D(bounds.getMinX() - thickness / 2., bounds.getMinY() - thickness / 2.); } /** * Allows to get the south-eastiest point of the bounds of the figure (the * bounds consider the thickness of the figure and the position of the * borders), without any rotation of the figure. It doesn't take account of the shadow. * @return The south-eastiest point of the bounds of the figure. */ public LaTeXDrawPoint2D getTheSENonRotatedBoundPoint() { Rectangle2D bounds = createNonRotatedShape2D().getBounds2D(); if (bounds == null) return null; return new LaTeXDrawPoint2D(bounds.getMaxX() + thickness / 2., bounds.getMaxY() + thickness / 2.); } /** * Allows to get the south-eastiest point of the bounds of the figure (the * bounds consider the thickness of the figure and the position of the borders). * @return The south-eastiest point of the bounds of the figure. */ public LaTeXDrawPoint2D getTheSEBoundPoint() { Rectangle2D bounds = createShape2D().getBounds2D(); if(bounds == null) return null; if(hasShadow) { double dx=0, dy=0; LaTeXDrawPoint2D cg = getGravityCenter(); LaTeXDrawPoint2D shadowCg = (LaTeXDrawPoint2D)cg.clone(); shadowCg.setLocation(cg.x+shadowSize, cg.y); shadowCg = Figure.rotatePoint(shadowCg, cg, shadowAngle); dx = shadowCg.x-cg.x; dy = cg.y-shadowCg.y; Rectangle2D.Double bounds2 = new Rectangle2D.Double(bounds.getX()+dx,bounds.getY()+dy, bounds.getWidth(), bounds.getHeight()); bounds2.add(bounds); bounds = bounds2; } return new LaTeXDrawPoint2D(bounds.getX() + thickness / 2. + bounds.getWidth(), bounds.getY() + thickness / 2. + bounds.getHeight()); } /** * @return True if the borders of the figure can move. */ public synchronized boolean isBordersMovable() { return isBordersMovable; } /** * Allows to change the number of the figure. */ public synchronized void changeMeter() { number = meter++; } /** * Allows to compute the angle of the point pt. * @param pt The point of reference. * @param gravityC The centre of gravity of the trigonometric circle. * @return The angle. */ public static double computeAngle(Point pt, LaTeXDrawPoint2D gravityC) { double c = gravityC.y-pt.y; double b = gravityC.x-pt.x; return atan(c/b); } /** * Allows to compute the angle of rotation between two points. * using the gravity centre of the figure. * @param formerPt The first point. * @param newPt The second point. * @return The rotation point. * @throws IllegalArgumentException If formerPt or newPt are null. */ public double computeRotationAngle(Point formerPt, Point newPt) throws IllegalArgumentException { double thetaOld = Figure.computeAngle(formerPt, gravityCenter); double thetaNew = Figure.computeAngle(newPt, gravityCenter); if((thetaNew-thetaOld)>(PI/2.) || (thetaNew-thetaOld)<-(PI/2.)) return thetaNew+thetaOld; return thetaNew-thetaOld; } /** * Allows to rotate the figure around its gravity centre. * @param formerPt The former point. * @param newPt The new point. * @throws IllegalArgumentException If formerPt or newPt is null. */ public void rotate(Point formerPt, Point newPt) throws IllegalArgumentException { setRotationAngle(rotationAngle+computeRotationAngle(formerPt, newPt)); } /** * Allows rotate the figure around the point gravityC. * @param gravityC The point of reference of the rotation. * @param angle The angle of the rotation. */ public void rotate(LaTeXDrawPoint2D gravityC, double angle) { if(!gravityC.equals(gravityCenter)) {// We must rotate the position of the figure LaTeXDrawPoint2D rotGC = rotatePoint(gravityCenter, gravityC, angle); shift(gravityCenter, rotGC); updateGravityCenter(); } setRotationAngle(rotationAngle+angle); } /** * @return the blackDashLength. */ public synchronized float getBlackDashLength() { return blackDashLength; } /** * @param blackDashLength the blackDashLength to set. */ public synchronized void setBlackDashLength(float blackDashLength) { if(blackDashLength>0 && !Float.isInfinite(blackDashLength) && !Float.isNaN(blackDashLength)) this.blackDashLength = blackDashLength; } /** * @return the hatchingAngle. */ public synchronized double getHatchingAngle() { return hatchingAngle; } /** * @param hatchingAngle the hatchingAngle to set. */ public synchronized void setHatchingAngle(double hatchingAngle) { if(!Double.isInfinite(hatchingAngle) && !Double.isNaN(hatchingAngle)) this.hatchingAngle = hatchingAngle%(Math.PI*2.); } /** * @return the whiteDashLength. */ public synchronized float getWhiteDashLength() { return whiteDashLength; } /** * @param whiteDashLength the whiteDashLength to set. */ public synchronized void setWhiteDashLength(float whiteDashLength) { if(whiteDashLength>0 && !Float.isInfinite(whiteDashLength) && !Float.isNaN(whiteDashLength)) this.whiteDashLength = whiteDashLength; } /** * @return the dotSep. */ public synchronized float getDotSep() { return dotSep; } /** * @param dotSep the dotSep to set. */ public synchronized void setDotSep(float dotSep) { if(dotSep>0 && !Float.isInfinite(dotSep) && !Float.isNaN(dotSep)) this.dotSep = dotSep; } /** * Allows to update the shape of the figure. */ public abstract void updateShape(); /** * Allows to know if the figure is too small to be rescaled. * @return True if the figure is too small to be rescaled. */ public abstract boolean isTooSmallToBeRescaled(); /** * @return the hasShadow. * @since 1.7 */ public synchronized boolean hasShadow() { return hasShadow; } /** * @param hasShadow the hasShadow to set. * @since 1.7 */ public synchronized void setHasShadow(boolean hasShadow) { this.hasShadow = hasShadow; } /** * @return The shadowAngle (in rad). * @since 1.7 */ public synchronized double getShadowAngle() { return shadowAngle; } /** * @param shadowAngle the shadowAngle to set in radian. * @since 1.7 */ public synchronized void setShadowAngle(double shadowAngle) { if(!Double.isInfinite(shadowAngle) && !Double.isNaN(shadowAngle)) this.shadowAngle = shadowAngle%(2*Math.PI); } /** * @return the shadowColor. * @since 1.7 */ public synchronized Color getShadowColor() { return shadowColor; } /** * @param shadowColor the shadowColor to set. * @since 1.7 */ public synchronized void setShadowColor(Color shadowColor) { if(shadowColor!=null) this.shadowColor = shadowColor; } /** * @return the shadowSize. * @since 1.7 */ public synchronized double getShadowSize() { return shadowSize; } /** * @param shadowSize the shadowSize to set. * @since 1.7 */ public synchronized void setShadowSize(double shadowSize) { if(!Double.isInfinite(shadowSize) && !Double.isNaN(shadowSize)) this.shadowSize = shadowSize; } /** * @return the canHaveShadow. * @since 1.7 */ public boolean canHaveShadow() { return canHaveShadow; } /** * Allows to create a shape corresponding to the shadow of the figure. * @return The shadow. * @since 1.7 */ public Shape createShadowShape() { if(!canHaveShadow || !hasShadow) return shape; Rectangle2D shadowS = createShape2D().getBounds2D(); double dx=0, dy=0; LaTeXDrawPoint2D cg = getGravityCenter(); LaTeXDrawPoint2D shadowCg = (LaTeXDrawPoint2D)cg.clone(); shadowCg.setLocation(cg.x+shadowSize, cg.y); shadowCg = Figure.rotatePoint(shadowCg, cg, shadowAngle); dx = shadowCg.x-cg.x; dy = cg.y-shadowCg.y; Rectangle2D.Double bounds2 = new Rectangle2D.Double(shadowS.getX()+dx-thickness/2., shadowS.getY()+dy-thickness/2., shadowS.getWidth()+thickness, shadowS.getHeight()+thickness); return bounds2; } /** * @return the gradientAngle. * @since 1.7 */ public synchronized double getGradientAngle() { return gradientAngle; } /** * @param gradientAngle the gradientAngle to set (in radian). * @since 1.7 */ public synchronized void setGradientAngle(double gradientAngle) { if(!Double.isInfinite(gradientAngle) && !Double.isNaN(gradientAngle)) this.gradientAngle = gradientAngle; } /** * @return the gradientEndColor. * @since 1.7 */ public synchronized Color getGradientEndColor() { return gradientEndColor; } /** * @param gradientEndColor the gradientEndColor to set. * @since 1.7 */ public synchronized void setGradientEndColor(Color gradientEndColor) { if(gradientEndColor!=null) this.gradientEndColor = gradientEndColor; } /** * @return the gradientMidPoint. * @since 1.7 */ public synchronized double getGradientMidPoint() { return gradientMidPoint; } /** * @param gradientMidPoint the gradientMidPoint to set. * @since 1.7 */ public synchronized void setGradientMidPoint(double gradientMidPoint) { if(gradientMidPoint>=0 && gradientMidPoint<=1) this.gradientMidPoint = gradientMidPoint; } /** * @return the gradientStartColor. * @since 1.7 */ public synchronized Color getGradientStartColor() { return gradientStartColor; } /** * @param gradientStartColor the gradientStartColor to set. * @since 1.7 */ public synchronized void setGradientStartColor(Color gradientStartColor) { if(gradientStartColor!=null) this.gradientStartColor = gradientStartColor; } /** * @return The PSTricks code for the filling of the figure. * @since 1.7 */ public String getPSTricksCodeFilling(float ppc) { String str="fillstyle=";//$NON-NLS-1$ if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_NONE)) { if(isFilled) str += "solid"; //$NON-NLS-1$ else str = "";//$NON-NLS-1$ } else if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_GRADIENT)) { str+= "gradient,gradlines=2000";//$NON-NLS-1$ if(!gradientStartColor.equals(PSTricksConstants.DEFAULT_GRADIENT_START_COLOR)) { String name = DviPsColors.getColourName(gradientStartColor); if(name==null) { name = "color"+number+'g';//$NON-NLS-1$ DviPsColors.addUserColour(gradientStartColor, name); } str += ",gradbegin=" + name; //$NON-NLS-1$ } if(!gradientEndColor.equals(PSTricksConstants.DEFAULT_GRADIENT_END_COLOR)) { String name = DviPsColors.getColourName(gradientEndColor); if(name==null) { name = "color"+number+'f';//$NON-NLS-1$ DviPsColors.addUserColour(gradientEndColor, name); } str += ",gradend=" + name; //$NON-NLS-1$ } if(gradientMidPoint!=PSTricksConstants.DEFAULT_GRADIENT_MID_POINT) str+=",gradmidpoint="+(float)gradientMidPoint;//$NON-NLS-1$ if(gradientAngle!=PSTricksConstants.DEFAULT_GRADIENT_ANGLE) str+=",gradangle="+(float)toDegrees(gradientAngle);//$NON-NLS-1$ } else { if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_CROSSHATCH)) str += "crosshatch"; //$NON-NLS-1$ else if (hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_HLINES)) str += "hlines"; //$NON-NLS-1$ else str += "vlines"; //$NON-NLS-1$ if(isFilled) str += "*"; //$NON-NLS-1$ str += ",hatchwidth=" + (getHatchingWidth()/ppc) + ",hatchangle=" + //$NON-NLS-1$ //$NON-NLS-2$ (float)Math.toDegrees(hatchingAngle); if(((float)hatchingSep)!=((float)DEFAULT_HATCH_SEP)) str+=",hatchsep="+(float)(hatchingSep/PPC); //$NON-NLS-1$ if(!hatchingColor.equals(PSTricksConstants.DEFAULT_HATCHING_COLOR)) { String name = DviPsColors.getColourName(hatchingColor); if(name==null) { name = "color"+number+'c';//$NON-NLS-1$ DviPsColors.addUserColour(hatchingColor, name); } str += ",hatchcolor=" + name; //$NON-NLS-1$ } } if(isFilled) { if(!interiorColor.equals(PSTricksConstants.DEFAULT_INTERIOR_COLOR)) { String name = DviPsColors.getColourName(interiorColor); if(name==null) { name = "color"+number+'b';//$NON-NLS-1$ DviPsColors.addUserColour(interiorColor, name); } str += ",fillcolor=" + name; //$NON-NLS-1$ } } return str; } /** * @return The PSTricks code for the shape of the lines of the figure. * @since 1.7 */ public String getPSTricksCodeLine(float ppc) { String str = "";//$NON-NLS-1$ boolean coma = false; if(!linesColor.equals(PSTricksConstants.DEFAULT_LINE_COLOR)) { String name = DviPsColors.getColourName(linesColor); if(name==null) { name = "color"+number;//$NON-NLS-1$ DviPsColors.addUserColour(linesColor, name); } str += "linecolor=" + name; //$NON-NLS-1$ coma = true; } if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) str += (coma ? "," : "")+ "linestyle=" + lineStyle + ",dotsep=" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ (getDotSep() / ppc) + "cm"; //$NON-NLS-1$ else if (lineStyle.equals(PSTricksConstants.LINE_DASHED_STYLE)) str += (coma ? "," : "") +"linestyle=" + lineStyle + ",dash=" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ (getBlackDashLength() / ppc) + "cm " + //$NON-NLS-1$ (getWhiteDashLength() / ppc) + "cm"; //$NON-NLS-1$ return str; } /** * @return True if the current style of the interior of the figure is a gradient. * @since 1.7 */ public synchronized boolean hasGradient() { return hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_GRADIENT); } /** * @return The borders of the figure (taking account of the thickness, the double borders, ...). * @since 1.7 */ public LaTeXDrawRectangle getBoundBorders() { LaTeXDrawPoint2D NW = getTheNWBoundPoint(), SE = getTheSEBoundPoint(); return new LaTeXDrawRectangle(NW, SE, false); } /** * @return the hatchingSep. * @since 1.8 */ public synchronized double getHatchingSep() { return hatchingSep; } /** * @param hatchSep the hatchingSep to set. * @since 1.8 */ public synchronized void setHatchingSep(double hatchSep) { if(hatchSep>0 && !Double.isInfinite(hatchSep) && !Double.isNaN(hatchSep)) this.hatchingSep = hatchSep; } /** * @return the canHaveArrow. */ public boolean canHaveArrow() { return canHaveArrow; } /** * Returns horizontally the figure. * @since 1.8 * @param origin The location of the horizontal axe. */ public abstract void mirrorHorizontal(LaTeXDrawPoint2D origin); /** * Returns vertically the figure. * @since 1.8 * @param origin The location of the vertical axe. */ public abstract void mirrorVertical(LaTeXDrawPoint2D origin); /** * Updates the coordinates of the figure to the grid given in parameter.
    * Nothing will be done if the magnetic grid is not activated. * @since 1.9 * @param grid The magnetic grid. */ public abstract void updateToGrid(MagneticGrid grid); /** * Checks if the parameters of the figures are equals. * @param f The figure to compare. * @param considerShadow True if the parameters of the shadows must be considered. * @param considerArrow True if the parameters of the arrows must be considered. * @return True if the parameters are equals. * @since 1.9 */ public boolean isParametersEquals(Figure f, boolean considerShadow, boolean considerArrow) { boolean lineOk = !f.isDashableOrDotable || !isDashableOrDotable || (lineStyle.equals(f.lineStyle) && thickness==f.thickness && (lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE) || (lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE) && dotSep==f.dotSep) || (lineStyle.equals(PSTricksConstants.LINE_DASHED_STYLE) && blackDashLength==f.blackDashLength && whiteDashLength==f.whiteDashLength))); boolean filledOk = !f.canBeFilled || !canBeFilled || (isFilled==f.isFilled && interiorColor.equals(f.interiorColor)); boolean dblbndOk = !f.isDoubleBoundaryable || f.isDoubleBoundaryable || (f.hasDoubleBoundary==hasDoubleBoundary && doubleColor.equals(f.doubleColor) && doubleSep==f.doubleSep); boolean arrowOk = !considerArrow || !f.canHaveArrow || !canHaveArrow || (((Arrowable)f).getArrowHead1().equals(((Arrowable)this).getArrowHead1()) && ((Arrowable)f).getArrowHead2().equals(((Arrowable)this).getArrowHead2())); boolean hatchOk = (!f.canBeFilled || !canBeFilled || ((f.hatchingStyle.equals(hatchingStyle) && (!isHatched() || (f.hatchingAngle==hatchingAngle && f.hatchingColor.equals(hatchingColor) && ((float)f.hatchingSep)==((float)hatchingSep) && f.hatchingWidth==hatchingWidth))) && (hasGradient()==f.hasGradient() &&(!hasGradient() || (gradientAngle==f.gradientAngle && gradientEndColor.equals(f.gradientEndColor) && gradientMidPoint==f.gradientMidPoint && gradientStartColor.equals(f.gradientStartColor)))))); boolean shadowOk = !considerShadow || !f.canHaveShadow || !canHaveArrow || (hasShadow==f.hasShadow && shadowAngle==f.shadowAngle && shadowColor.equals(f.shadowColor) && ((float)shadowSize)==((float)f.shadowSize)); return linesColor.equals(f.linesColor) && lineOk && filledOk && dblbndOk && shadowOk && hatchOk && arrowOk ; } /** * @return True is a delimiter is selected. * @since 1.9 */ public boolean isDelimitorSelected() { return dSelected!=null || (borders==null ? false : borders.isDelimitorSelected()); } /** * @return The position of the selected delimiter. * @since 1.9 */ public int getSelectedDelimitorOrientation() { if(isOnRotation()) return DELIMITOR_ROTATION; return DELIMITOR_ORIENTATION_NONE; } /** * Sometimes a rectangle is too small to be drawn; this method check if the given shape is too small * and if it is the case, it return a visible shape based on the given shape. * @param s The shape to check. * @return A visible check if the given shape is too small or null if it is not the case. * @since 1.9 */ protected Shape getTooSmallShape(Shape s) { Rectangle2D bds = s.getBounds2D(); if(bds.getHeight()<=0) { if(bds.getWidth()<=0) return new Line2D.Double(bds.getMinX(), bds.getMinY(), bds.getMinX()+1, bds.getMinY()+1); return new Line2D.Double(bds.getMinX(), bds.getMaxY(), bds.getMaxX(), bds.getMaxY()); } if(bds.getWidth()<=0) return new Line2D.Double(bds.getMaxX(), bds.getMinY(), bds.getMaxX(), bds.getMaxY()); return null; } /** * Gives a gradient to the shape. * @since 1.9 */ protected void setHasGradient() { hatchingStyle = PSTricksConstants.TOKEN_FILL_GRADIENT; } @Override public int hashCode() { return (int)thickness+(int)doubleSep+(linesColor.hashCode()^interiorColor.hashCode()^ hatchingStyle.hashCode()^lineStyle.hashCode()); } /** * Given a right-rectangle ABC right in A, it computes the gap created by the corner of the triangle in B * based on an initial gap. * @param a The point A. * @param b The point B. * @param c The point C. * @param gap The initial gap (for example, the thickness, the double border gap,...). * @return The gap created by the corner of the point B. * @since 2.0.0 */ public static double getCornerGap(Point2D a, Point2D b, Point2D c, double gap) { if(a==null || b==null || c==null) return 0.; return gap / Triangle.getAltitude(a, b, c) * a.distance(b); } /** * @return True if when the shape has a shadow, then it is filled. * @since 2.0.0 */ public boolean shadowFillsShape() { return true; } /** * @return the shape. * @since 2.0.0 */ public synchronized Shape getShape() { return shape; } /** * @param number the number to set. * @since 2.0.0 */ public synchronized void setNumber(int number) { this.number = number; } public void setNewNumber() { setNumber(meter++); } @Override public String toString() { return getClass().getName() + "#" + getNumber() + "[thick=" + getThickness() + ", bordCol=" + getLinesColor() + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ", intCol=" + getInteriorColor() + ", dbleCol=" + getDoubleColor() + ", shadCol=" + getShadowColor() + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ", isFilled=" + isFilled() + ", hasShad=" + hasShadow() + ", hasDble=" + hasDoubleBoundary() + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ", shadSize=" + getShadowSize() + ", shadAngle=" + getShadowAngle() + ", gradAngle=" + getGradientAngle() + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ", gradMP=" + getGradientMidPoint() + ", gradCol1=" + getGradientStartColor() + ", gradCol2=" + getGradientEndColor() + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ", bordPos=" + getBordersPosition() + ", blackDash=" + getBlackDashLength() + ", dotSep=" + getDotSep() + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ", dbleSep=" + getDoubleSep() + ", hatchAngle=" + getHatchingAngle() + ", hatchSep=" + getHatchingSep() + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ", hatchStyle=" + getHatchingStyle() + ", hatchWidth=" + getHatchingWidth() + ", lineStyle=" + getLineStyle() + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ", rotAngle=" + getRotationAngle() + ", whiteDash=" + getWhiteDashLength() + ", gc=" + getGravityCenter() + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ", isHatched=" + isHatched() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ } } latexdraw-2.0.8+1.orig/latexDraw/figures/Axe.java0000644000000000000000000013054211347255510016464 0ustar package latexDraw.figures; import java.awt.*; import java.awt.geom.Line2D; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.ObjectInputStream; import javax.swing.JComboBox; import latexDraw.figures.properties.Arrowable; import latexDraw.lang.LaTeXDrawLang; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.components.LaTeXDrawComboBox; import latexDraw.ui.components.MagneticGrid; import latexDraw.util.LaTeXDrawNumber; import latexDraw.util.LaTeXDrawPoint2D; /** * This class defines axes.
    *
    * TODO: it seems to have an redefinition of psaxes in the pstricks-add package, but this class * define only the psaxes of the pst-plot package. It possible to add the possibility to choose * which definition we want to use.

    * Ox and Oy parameters can be float, but it occurs problems; for this reason these parameters will * be only integer in LaTeXDraw. cf. http://tug.org/mailman/htdig/pstricks/1998/000227.html
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 31/09/06
    * @author Arnaud BLOUIN
    * @since 1.8
    * @version 2.0.0
    */ public class Axe extends GridShape implements Arrowable { private static final long serialVersionUID = 1L; /** The increment of each axe; Dx and Dy in PSTricks. */ protected LaTeXDrawPoint2D increment; /** The distance between each label; if 0, the default value will be used; dx and oy in PSTricks (in cm). */ protected LaTeXDrawPoint2D distLabels; /** Define which labels must be displayed. */ protected int labelsDisplayed; /** Define the origin must be shown. */ protected boolean showOrigin; /** Define how the ticks must be shown. (use the LABELS_DISPLAYED_XXX constants to define its value).*/ protected int ticksDisplayed; /** Define the style of the ticks. */ protected int ticksStyle; /** The size of the ticks. */ protected double ticksSize; /** The style of the axes. */ protected int axesStyle; /** The first arrow. */ protected ArrowHead arrowHead1; /** The second arrow. */ protected ArrowHead arrowHead2; public static final String ACTION_CMD_AXE_STYLE_CHOICE = "axeStyleCmd"; //$NON-NLS-1$ public static final String ACTION_CMD_TICKS_STYLE_CHOICE = "ticksStyleCmd";//$NON-NLS-1$ /** The value of axesStyle when the axes have the axes shape. */ public static final short AXES_STYLE_AXES_VALUE = 0; /** The value of axesStyle when the axes have the frame shape. */ public static final short AXES_STYLE_FRAME_VALUE = 1; /** The value of axesStyle when the axes must not be shown. */ public static final short AXES_STYLE_NONE_VALUE = 2; /** The value of ticksStyle when the ticks must be fully shown. */ public static final short TICKS_STYLE_FULL_VALUE = 0; /** The value of ticksStyle when only the top of the ticks must be shown. */ public static final short TICKS_STYLE_TOP_VALUE = 1; /** The value of ticksStyle when only the bottom of the ticks must be shown. */ public static final short TICKS_STYLE_BOTTOM_VALUE = 2; /** The value of labelsDisplayed when all the labels must be displayed. */ public static final short LABELS_DISPLAYED_ALL_VALUE = 0; /** The value of labelsDisplayed when only the X labels must be displayed. */ public static final short LABELS_DISPLAYED_X_VALUE = 1; /** The value of labelsDisplayed when only the Y labels must be displayed. */ public static final short LABELS_DISPLAYED_Y_VALUE = 2; /** The value of labelsDisplayed when no labels must be displayed. */ public static final short LABELS_DISPLAYED_NON_VALUE = 3; public static final int DEFAULT_LABELSSIZE = 20; public static final String LABEL_STYLE_NONE = LaTeXDrawLang.getString1_8("Axe.0"); //$NON-NLS-1$ public static final String LABEL_STYLE_AXE = LaTeXDrawLang.getString1_8("Axe.1"); //$NON-NLS-1$ public static final String LABEL_STYLE_FRAME = LaTeXDrawLang.getString1_8("Axe.2"); //$NON-NLS-1$ public static final String LABEL_STYLE_TICKS_FULL = LaTeXDrawLang.getString1_8("Axe.3"); //$NON-NLS-1$ public static final String LABEL_STYLE_TICKS_TOP = LaTeXDrawLang.getString1_8("Axe.4"); //$NON-NLS-1$ public static final String LABEL_STYLE_TICKS_BOTTOM = LaTeXDrawLang.getString1_8("Axe.5"); //$NON-NLS-1$ /** The interval between the labels and the axes. */ public static final double GAP_LABEL = 5.; /** * The constructor using two arguments. * @param pos The current position of the origin of the axes. */ public Axe(LaTeXDrawPoint2D pos, boolean increaseMeter) { super(pos, increaseMeter); canHaveArrow = true; isCustomizable = true; isDashableOrDotable = true; isThicknessable = true; showOrigin = PSTricksConstants.DEFAULT_SHOW_ORIGIN; ticksSize = PSTricksConstants.DEFAULT_TICKS_SIZE*Figure.PPC; distLabels = new LaTeXDrawPoint2D(PSTricksConstants.DEFAULT_DIST_X_LABEL, PSTricksConstants.DEFAULT_DIST_Y_LABEL); increment = new LaTeXDrawPoint2D(PSTricksConstants.DEFAULT_DX, PSTricksConstants.DEFAULT_DY); arrowHead1 = new ArrowHead(new LaTeXDrawPoint2D(pos), new Line(new LaTeXDrawPoint2D(pos), new LaTeXDrawPoint2D(pos), false), this); arrowHead2 = new ArrowHead(new LaTeXDrawPoint2D(pos), new Line(new LaTeXDrawPoint2D(pos), new LaTeXDrawPoint2D(pos), false), this); BufferedImage bufferImage = new BufferedImage(2, 2, BufferedImage.TYPE_INT_RGB); Graphics2D g = bufferImage.createGraphics(); font = new Font(g.getFont().getName(), Font.PLAIN, DEFAULT_LABELSSIZE); setAxesStyleToken(PSTricksConstants.DEFAULT_AXES_STYLE); setTicksDisplayedToken(PSTricksConstants.DEFAULT_TICKS_DISPLAYED); setTicksStyleToken(PSTricksConstants.DEFAULT_TICKS_STYLE); setLabelsDisplayedToken(PSTricksConstants.DEFAULT_LABELS_DISPLAYED); updateFonts(); updateShape(); g.dispose(); bufferImage.flush(); g = null; bufferImage = null; } @Override public void updateBorders() { if(borders==null) borders = new LaTeXDrawRectangle(false); double minX, maxX, minY, maxY, add1X=0, add2X=0, add1Y=0, add2Y=0; double ticks = ticksSize; int ticksS = getTicksStyle(); boolean ticksTop = ticksS==TICKS_STYLE_TOP_VALUE || ticksS==TICKS_STYLE_FULL_VALUE; boolean ticksBot = ticksS==TICKS_STYLE_BOTTOM_VALUE || ticksS==TICKS_STYLE_FULL_VALUE; if(gridEnd.x=0 && isYLabelWest) add1X = Math.max(fontMetrics.stringWidth(String.valueOf(minY)), fontMetrics.stringWidth(String.valueOf(maxY)))+(ticksBot?ticks:0); if(maxX<=0) add2X = Math.max(fontMetrics.stringWidth(String.valueOf(minY)), fontMetrics.stringWidth(String.valueOf(maxY)))+(ticksBot?ticks:0); if(minY>=0 && isXLabelSouth) add2Y = fontMetrics.getHeight()+GAP_LABEL+(ticksBot?ticks:0); if(maxY<=0) add1Y = fontMetrics.getHeight()+GAP_LABEL+(ticksTop?ticks:0); borders.setFirstPoint(position.x+Math.min(0, minX)*PPC-add1X, position.y-Math.max(0, maxY)*PPC-add1Y); borders.setLastPoint(position.x+Math.max(0, maxX)*PPC+add2X, position.y-Math.min(0, minY)*PPC+add2Y); gravityCenter = borders.getGravityCenter(); updateShape(); } @Override public void draw(Graphics2D g, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering) { Color formerColor = g.getColor(); Font formerFont = g.getFont(); double minX, maxX, minY, maxY, maxX3, minX3, maxY3, minY3; double gapX = distLabels.x==0. ? PPC : (distLabels.x/increment.x)*PPC, i; double gapY = distLabels.y==0. ? PPC : (distLabels.y/increment.y)*PPC; LaTeXDrawPoint2D NW = borders.getTheNWPoint(); LaTeXDrawPoint2D SE = borders.getTheSEPoint(); double cx = (NW.x+SE.x)/2., cy = (NW.y+SE.y)/2.; double c2x = Math.cos(rotationAngle)*cx - Math.sin(rotationAngle)*cy; double c2y = Math.sin(rotationAngle)*cx + Math.cos(rotationAngle)*cy; double c3x = Math.cos(-rotationAngle)*(cx-c2x) - Math.sin(-rotationAngle)*(cy-c2y); double c3y = Math.sin(-rotationAngle)*(cx-c2x) + Math.cos(-rotationAngle)*(cy-c2y); double lgth; boolean ticksBot = ticksStyle==TICKS_STYLE_BOTTOM_VALUE || ticksStyle==TICKS_STYLE_FULL_VALUE; int j; if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); else if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[]{0,thickness+dotSep}, 0)); else if(lineStyle.equals(PSTricksConstants.LINE_DASHED_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[]{blackDashLength, whiteDashLength}, 0)); g.setColor(linesColor); g.setFont(font); if(rotationAngle%(Math.PI*2)!=0) { g.rotate(rotationAngle); g.translate(c3x,c3y); } if(gridEnd.x0 ? 0 : minX3; maxX3 = maxX<0 ? 0 : maxX3; minY3 = minY>0 ? 0 : minY3; maxY3 = maxY<0 ? 0 : maxY3; switch(axesStyle) { case AXES_STYLE_AXES_VALUE: boolean arrowOk = (float)minX!=(float)maxX || (float)maxX!=(float)minY || (float)minY!=(float)maxY; Line xLine = new Line(new LaTeXDrawPoint2D(position.x+gridStart.x*PPC, position.y), new LaTeXDrawPoint2D(position.x+gridEnd.x*PPC, position.y), true); Line yLine = new Line(new LaTeXDrawPoint2D(position.x, position.y-gridEnd.y*PPC), new LaTeXDrawPoint2D(position.x, position.y-gridStart.y*PPC), true); xLine.setLinesColor(linesColor); xLine.setLineStyle(lineStyle); xLine.setThickness(thickness); yLine.setLinesColor(linesColor); yLine.setLineStyle(lineStyle); yLine.setThickness(thickness); if(!arrowHead1.getArrowStyle().equals(PSTricksConstants.NONEARROW_STYLE) && arrowOk) { String arrowStyle = arrowHead1.getArrowStyle(); lgth = arrowHead1.getArrowHeadLength(); boolean isArrow = arrowHead1.needReduceLine(); if((minX!=0 && isYLabelWest) || (maxX!=0 && !isYLabelWest) || maxY==minY) { if(isArrow && !isYLabelWest) { if(arrowStyle.equals(PSTricksConstants.RARROW_STYLE)) arrowStyle = PSTricksConstants.LARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.LARROW_STYLE)) arrowStyle = PSTricksConstants.RARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.DLARROW_STYLE)) arrowStyle = PSTricksConstants.DRARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.DRARROW_STYLE)) arrowStyle = PSTricksConstants.DLARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.RRBRACKET_STYLE)) arrowStyle = PSTricksConstants.LRBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.LRBRACKET_STYLE)) arrowStyle = PSTricksConstants.RRBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.RSBRACKET_STYLE)) arrowStyle = PSTricksConstants.LSBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.LSBRACKET_STYLE)) arrowStyle = PSTricksConstants.RSBRACKET_STYLE; } if(isArrow) if(isYLabelWest) xLine.getPt1().x-=lgth; else xLine.getPt2().x+=lgth; if(isYLabelWest) xLine.setArrow1Style(arrowStyle); else xLine.setArrow2Style(arrowStyle); } if((minY!=0 && isXLabelSouth) || (maxY!=0 && !isXLabelSouth) || maxX==minX) { arrowStyle = arrowHead1.getArrowStyle(); if(isArrow && isXLabelSouth) { if(arrowStyle.equals(PSTricksConstants.RARROW_STYLE)) arrowStyle = PSTricksConstants.LARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.LARROW_STYLE)) arrowStyle = PSTricksConstants.RARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.DLARROW_STYLE)) arrowStyle = PSTricksConstants.DRARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.DRARROW_STYLE)) arrowStyle = PSTricksConstants.DLARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.RRBRACKET_STYLE)) arrowStyle = PSTricksConstants.LRBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.LRBRACKET_STYLE)) arrowStyle = PSTricksConstants.RRBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.RSBRACKET_STYLE)) arrowStyle = PSTricksConstants.LSBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.LSBRACKET_STYLE)) arrowStyle = PSTricksConstants.RSBRACKET_STYLE; } if(isArrow) if(isXLabelSouth) yLine.getPt2().y+=lgth; else yLine.getPt1().y-=lgth; if(isXLabelSouth) yLine.setArrow2Style(arrowStyle); else yLine.setArrow1Style(arrowStyle); } } if(!arrowHead2.getArrowStyle().equals(PSTricksConstants.NONEARROW_STYLE) && arrowOk) { String arrowStyle = arrowHead2.getArrowStyle(); lgth = arrowHead2.getArrowHeadLength(); boolean isArrow = arrowHead2.needReduceLine(); if((maxY!=0 && isXLabelSouth) || (minY!=0 && !isXLabelSouth) || maxY==minY) { if(isArrow && !isXLabelSouth) { if(arrowStyle.equals(PSTricksConstants.RARROW_STYLE)) arrowStyle = PSTricksConstants.LARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.LARROW_STYLE)) arrowStyle = PSTricksConstants.RARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.DLARROW_STYLE)) arrowStyle = PSTricksConstants.DRARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.DRARROW_STYLE)) arrowStyle = PSTricksConstants.DLARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.RRBRACKET_STYLE)) arrowStyle = PSTricksConstants.LRBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.LRBRACKET_STYLE)) arrowStyle = PSTricksConstants.RRBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.RSBRACKET_STYLE)) arrowStyle = PSTricksConstants.LSBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.LSBRACKET_STYLE)) arrowStyle = PSTricksConstants.RSBRACKET_STYLE; } if(maxY==minY && minY==0) { if(isArrow) if(maxX>0) xLine.getPt1().y-=lgth; else xLine.getPt2().y+=lgth; if(maxX>0) xLine.setArrow1Style(arrowStyle); else xLine.setArrow2Style(arrowStyle); } else { if(isArrow) if(isXLabelSouth) yLine.getPt1().y-=lgth; else yLine.getPt2().y+=lgth; if(isXLabelSouth) yLine.setArrow1Style(arrowStyle); else yLine.setArrow2Style(arrowStyle); } } if((maxX!=0 && isYLabelWest) || (minX!=0 && !isYLabelWest) || maxX==minX) { arrowStyle = arrowHead2.getArrowStyle(); if(isArrow && isYLabelWest) { if(arrowStyle.equals(PSTricksConstants.RARROW_STYLE)) arrowStyle = PSTricksConstants.LARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.LARROW_STYLE)) arrowStyle = PSTricksConstants.RARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.DLARROW_STYLE)) arrowStyle = PSTricksConstants.DRARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.DRARROW_STYLE)) arrowStyle = PSTricksConstants.DLARROW_STYLE; else if(arrowStyle.equals(PSTricksConstants.RRBRACKET_STYLE)) arrowStyle = PSTricksConstants.LRBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.LRBRACKET_STYLE)) arrowStyle = PSTricksConstants.RRBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.RSBRACKET_STYLE)) arrowStyle = PSTricksConstants.LSBRACKET_STYLE; else if(arrowStyle.equals(PSTricksConstants.LSBRACKET_STYLE)) arrowStyle = PSTricksConstants.RSBRACKET_STYLE; } if(maxX==minX && minX==0) { if(isArrow) if(maxY>0) yLine.getPt2().x+=lgth; else xLine.getPt1().x-=lgth; if(maxY>0) yLine.setArrow2Style(arrowStyle); else yLine.setArrow1Style(arrowStyle); } else { if(isArrow) if(isYLabelWest) xLine.getPt2().x+=lgth; else xLine.getPt1().x-=lgth; if(isYLabelWest) xLine.setArrow2Style(arrowStyle); else xLine.setArrow1Style(arrowStyle); } } } xLine.draw(g, antiAlias, rendering, alphaInter, colorRendering); // We draw the axes yLine.draw(g, antiAlias, rendering, alphaInter, colorRendering); break; case AXES_STYLE_FRAME_VALUE: if(gridEnd.x>0 || gridEnd.y>0) { double xMax = position.x+gridEnd.x*PPC; double yMax = position.y-gridEnd.y*PPC; LaTeXDrawRectangle r = new LaTeXDrawRectangle( new LaTeXDrawPoint2D(position.x, gridEnd.y>0?yMax:position.y), new LaTeXDrawPoint2D(gridEnd.x>0?xMax:position.x, position.y), false); r.setBordersPosition(PSTricksConstants.BORDERS_MIDDLE); r.setLinesColor(linesColor); r.setLineStyle(lineStyle); r.setThickness(thickness); r.draw(g, antiAlias, rendering, alphaInter, colorRendering); } break; } double endX = distLabels.x!=0. ? maxX3 : maxX3/increment.x; double endY = distLabels.y!=0. ? maxY3 : maxY3/increment.y; double startX = distLabels.x!=0. ? minX3 : minX3/increment.x; double startY = distLabels.y!=0. ? minY3 : minY3/increment.y; if(ticksDisplayed!=LABELS_DISPLAYED_NON_VALUE)// We draw the ticks { if(ticksStyle==TICKS_STYLE_FULL_VALUE || (ticksStyle==TICKS_STYLE_TOP_VALUE && maxY>0) || (ticksStyle==TICKS_STYLE_BOTTOM_VALUE && maxY<=0)) if(ticksDisplayed==LABELS_DISPLAYED_X_VALUE || ticksDisplayed==LABELS_DISPLAYED_ALL_VALUE) { for(j=1; j<=endX; j++) g.draw(new Line2D.Double(position.x+j*gapX*increment.x, position.y, position.x+j*gapX*increment.x, position.y-ticksSize-thickness/2.)); for(j=-1; j>=startX; j--) g.draw(new Line2D.Double(position.x+j*gapX*increment.x, position.y, position.x+j*gapX*increment.x, position.y-ticksSize-thickness/2.)); } if(ticksStyle==TICKS_STYLE_FULL_VALUE || (ticksStyle==TICKS_STYLE_TOP_VALUE && maxX>0) || (ticksStyle==TICKS_STYLE_BOTTOM_VALUE && maxX<=0)) if(ticksDisplayed==LABELS_DISPLAYED_Y_VALUE || ticksDisplayed==LABELS_DISPLAYED_ALL_VALUE) { for(j=1; j<=endY; j++) g.draw(new Line2D.Double(position.x, position.y-j*gapY*increment.y, position.x+ticksSize+thickness/2., position.y-j*gapY*increment.y)); for(j=-1; j>=startY; j--) g.draw(new Line2D.Double(position.x, position.y-j*gapY*increment.y, position.x+ticksSize+thickness/2., position.y-j*gapY*increment.y)); } if(ticksStyle==TICKS_STYLE_FULL_VALUE || (ticksStyle==TICKS_STYLE_BOTTOM_VALUE && maxY>0) || (ticksStyle==TICKS_STYLE_TOP_VALUE && maxY<=0)) if(ticksDisplayed==LABELS_DISPLAYED_X_VALUE || ticksDisplayed==LABELS_DISPLAYED_ALL_VALUE) { for(j=1; j<=endX; j++) g.draw(new Line2D.Double(position.x+j*gapX*increment.x, position.y, position.x+j*gapX*increment.x, position.y+ticksSize+thickness/2.)); for(j=-1; j>=startX; j--) g.draw(new Line2D.Double(position.x+j*gapX*increment.x, position.y, position.x+j*gapX*increment.x, position.y+ticksSize+thickness/2.)); } if(ticksStyle==TICKS_STYLE_FULL_VALUE || (ticksStyle==TICKS_STYLE_BOTTOM_VALUE && maxX>0) || (ticksStyle==TICKS_STYLE_TOP_VALUE && maxX<=0)) if(ticksDisplayed==LABELS_DISPLAYED_Y_VALUE || ticksDisplayed==LABELS_DISPLAYED_ALL_VALUE) { for(j=1; j<=endY; j++) g.draw(new Line2D.Double(position.x, position.y-j*gapY*increment.y, position.x-ticksSize-thickness/2., position.y-j*gapY*increment.y)); for(j=-1; j>=startY; j--) g.draw(new Line2D.Double(position.x, position.y-j*gapY*increment.y, position.x-ticksSize-thickness/2., position.y-j*gapY*increment.y)); } } g.setColor(Color.BLACK); if(labelsDisplayed==LABELS_DISPLAYED_ALL_VALUE || labelsDisplayed==LABELS_DISPLAYED_X_VALUE) {// We show the labels on the X-axe. float height = fontMetrics.getAscent(); double gap = ((ticksDisplayed==LABELS_DISPLAYED_ALL_VALUE|| ticksDisplayed==LABELS_DISPLAYED_X_VALUE)&& ((isXLabelSouth && (ticksStyle==TICKS_STYLE_BOTTOM_VALUE || ticksStyle==TICKS_STYLE_FULL_VALUE)) || (!isXLabelSouth && (ticksStyle==TICKS_STYLE_TOP_VALUE || ticksStyle==TICKS_STYLE_FULL_VALUE)))? ticksSize:0)+thickness/2.+GAP_LABEL; double sep = maxY<=0 || !isXLabelSouth? -gap-GAP_LABEL : gap+height; String str; if(((isXLabelSouth && gridStart.y>=0) || (!isXLabelSouth && gridEnd.y<=0)) && (gridStart.x!=gridEnd.x || gridStart.x!=0) && gridStart.y<=0 && showOrigin) g.drawString(String.valueOf((int)origin.x), (int)(position.x-fontMetrics.stringWidth(String.valueOf((int)origin.x))/2.), (int)(position.y+sep)); for(i=increment.x, j=1; j<=endX; i+=increment.x, j++) { str = (((int)increment.x)==increment.x?String.valueOf((int)(i+origin.x)) : String.valueOf(i+origin.x)); g.drawString(str, (int)(position.x+j*gapX*increment.x-fontMetrics.stringWidth(str)/2.), (int)(position.y+sep)); } for(i=-increment.x, j=-1; j>=startX; i-=increment.x, j--) { str = (((int)increment.x)==increment.x?String.valueOf((int)(i+origin.x)): String.valueOf(i+origin.x)); g.drawString(str, (int)(position.x+j*gapX*increment.x-fontMetrics.stringWidth(str)/2.), (int)(position.y+sep)); } } if(labelsDisplayed==LABELS_DISPLAYED_ALL_VALUE || labelsDisplayed==LABELS_DISPLAYED_Y_VALUE) {// We show the labels on the Y-axe. float height = fontMetrics.getAscent(); String str; if(maxX>0 && isYLabelWest) { double gap = (ticksBot && (ticksDisplayed==LABELS_DISPLAYED_ALL_VALUE || ticksDisplayed==LABELS_DISPLAYED_Y_VALUE)?ticksSize:0)+thickness/2.; if(gridStart.x==0 && (gridStart.y!=gridEnd.y || gridStart.y!=0) && showOrigin) g.drawString(String.valueOf((int)origin.y), (int)(position.x-gap-g.getFontMetrics().stringWidth(String.valueOf((int)origin.y))-GAP_LABEL), (int)(position.y+height/2.)); for(i=increment.y, j=1; j<=endY; i+=increment.y, j++) { str = ((int)increment.y)==increment.y?String.valueOf((int)(i+origin.y)):String.valueOf(i+origin.y); g.drawString(str, (int)(position.x-gap-fontMetrics.stringWidth(str)-GAP_LABEL), (int)(position.y+height/2.-j*gapY*increment.y)); } for(i=-increment.y, j=-1; j>=startY; i-=increment.y, j--) { str = ((int)increment.y)==increment.y?String.valueOf((int)(i+origin.y)):String.valueOf(i+origin.y); g.drawString(str, (int)(position.x-gap-fontMetrics.stringWidth(str)-GAP_LABEL), (int)(position.y+height/2.-j*gapY*increment.y)); } } else { double gap = ((!ticksBot || ticksStyle==TICKS_STYLE_FULL_VALUE) && (ticksDisplayed==LABELS_DISPLAYED_ALL_VALUE|| ticksDisplayed==LABELS_DISPLAYED_Y_VALUE)?ticksSize:0)+thickness/2.; if((!isYLabelWest && gridEnd.x<=0) || (isYLabelWest && gridStart.x>=0) && (gridStart.y!=gridEnd.y || gridStart.y!=0) && showOrigin) g.drawString(String.valueOf((int)origin.y), (int)(position.x+gap+GAP_LABEL), (int)(position.y+height/2.)); for(i=increment.y, j=1; j<=endY; i+=increment.y, j++) g.drawString(((int)increment.y)==increment.y?String.valueOf((int)(i+origin.y)):String.valueOf(i+origin.y), (int)(position.x+gap+GAP_LABEL), (int)(position.y+height/2.-j*gapY*increment.y)); for(i=-increment.y, j=-1; j>=startY; i-=increment.y, j--) g.drawString(((int)increment.y)==increment.y?String.valueOf((int)(i+origin.y)):String.valueOf(i+origin.y), (int)(position.x+gap+GAP_LABEL), (int)(position.y+height/2.-j*gapY*increment.y)); } } if(rotationAngle%(Math.PI*2)!=0) { g.translate(-c3x, -c3y); g.rotate(-rotationAngle); } g.setColor(formerColor); g.setFont(formerFont); if(isSelected) borders.draw(g, false, antiAlias, rendering, alphaInter, colorRendering); } @Override public String getCodePSTricks(DrawBorders drawBorders, float ppc) { double startX, startY, endX, endY, x, y; LaTeXDrawPoint2D d = drawBorders.getOriginPoint(); String start = "", end = "", arrowsCode = "";//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ String arrowHead1Style = arrowHead1.getArrowStyle(), add = "";//$NON-NLS-1$ String arrowHead2Style = arrowHead2.getArrowStyle(); double threshold = 0.001; if(isXLabelSouth) { startY = gridStart.y; endY = gridEnd.y; }else { startY = gridEnd.y; endY = gridStart.y; } if(isYLabelWest) { startX = gridStart.x; endX = gridEnd.x; }else { startX = gridEnd.x; endX = gridStart.x; } String coord = "("+(int)startX+","+(int)startY+")("+ //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$ (int)endX+","+(int)endY+")"; //$NON-NLS-1$ //$NON-NLS-2$ coord = "(" + 0 + "," + 0 + ")" + coord; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ if(position.x!=0 || position.y!=0) { double posX = position.x, posY = position.y; if(Math.abs(position.x) < 0.001) posX = 0; if(Math.abs(position.x) < 0.001) posY = 0; end +="}"; //$NON-NLS-1$ start = "\\rput(" + LaTeXDrawNumber.getCutNumber((float)((posX-d.x)/ppc), threshold) + "," + //$NON-NLS-1$ //$NON-NLS-2$ LaTeXDrawNumber.getCutNumber((float)((d.y-posY)/ppc), threshold) + "){" + start; //$NON-NLS-1$ } if(rotationAngle % (Math.PI*2) != 0.) { updateBorders(); updateGravityCenter(); double angle = -Math.toDegrees(rotationAngle); double cx = (gravityCenter.x - position.x) / ppc; double cy = (position.y - gravityCenter.y) / ppc; x = -Math.cos(-rotationAngle) * cx + Math.sin(-rotationAngle) * cy + cx; y = -Math.sin(-rotationAngle) * cx - Math.cos(-rotationAngle) * cy + cy; start = start+"\\rput{" + (float)angle + "}(" + LaTeXDrawNumber.getCutNumber((float)x, threshold) + ',' + LaTeXDrawNumber.getCutNumber((float)y, threshold) + "){"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ end = end+"}"; //$NON-NLS-1$ } if(!arrowHead1Style.equals(PSTricksConstants.NONEARROW_STYLE) || !arrowHead2Style.equals(PSTricksConstants.NONEARROW_STYLE)) { if(arrowHead2Style.equals(PSTricksConstants.DLARROW_STYLE)) arrowHead2Style = PSTricksConstants.DRARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.DRARROW_STYLE)) arrowHead2Style = PSTricksConstants.DLARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.RARROW_STYLE)) arrowHead2Style = PSTricksConstants.LARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.LARROW_STYLE)) arrowHead2Style = PSTricksConstants.RARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.DLARROW_STYLE)) arrowHead2Style = PSTricksConstants.DRARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.LRBRACKET_STYLE)) arrowHead2Style = PSTricksConstants.RRBRACKET_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.RRBRACKET_STYLE)) arrowHead2Style = PSTricksConstants.LRBRACKET_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.RSBRACKET_STYLE)) arrowHead2Style = PSTricksConstants.LSBRACKET_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.LSBRACKET_STYLE)) arrowHead2Style = PSTricksConstants.RSBRACKET_STYLE; String paramsR = ","+ arrowHead1.getParametersCode(); //$NON-NLS-1$ String paramsL = ","+ arrowHead2.getParametersCode(); //$NON-NLS-1$ if(paramsR.equals(",")) paramsR = ""; //$NON-NLS-1$ //$NON-NLS-2$ if(paramsL.equals(",")) paramsL = ""; //$NON-NLS-1$ //$NON-NLS-2$ if(!arrowHead1Style.equals(PSTricksConstants.NONEARROW_STYLE)) { arrowsCode="{"+arrowHead1Style+'-'; //$NON-NLS-1$ if(!arrowHead2Style.equals(PSTricksConstants.NONEARROW_STYLE)) arrowsCode+=arrowHead2Style; arrowsCode+='}'; if(!arrowHead1.isOfTheSameTypeAs(arrowHead2)) { if((arrowHead2Style.equals(PSTricksConstants.LRBRACKET_STYLE) || arrowHead2Style.equals(PSTricksConstants.RRBRACKET_STYLE) || arrowHead2Style.equals(PSTricksConstants.RSBRACKET_STYLE) || arrowHead2Style.equals(PSTricksConstants.RSBRACKET_STYLE)) && (arrowHead1Style.equals(PSTricksConstants.BAREND_STYLE) || arrowHead1Style.equals(PSTricksConstants.BARIN_STYLE) || arrowHead1Style.equals(PSTricksConstants.LRBRACKET_STYLE) || arrowHead1Style.equals(PSTricksConstants.RRBRACKET_STYLE) || arrowHead1Style.equals(PSTricksConstants.RSBRACKET_STYLE) || arrowHead1Style.equals(PSTricksConstants.RSBRACKET_STYLE))) add = paramsR; else add+= paramsL + paramsR; }else add+=paramsR; } else if(!arrowHead2Style.equals(PSTricksConstants.NONEARROW_STYLE)) { add+=paramsR; arrowsCode="{-"+arrowHead2Style+'}'; //$NON-NLS-1$ } } String str = getPSTricksCodeLine(ppc); if(str.length()>0) add=add+','+str; if(!getAxesStyleToken().equals(PSTricksConstants.DEFAULT_AXES_STYLE)) add+=",axesstyle="+getAxesStyleToken();//$NON-NLS-1$ if(!getTicksStyleToken().equals(PSTricksConstants.DEFAULT_TICKS_STYLE)) add+=",tickstyle="+getTicksStyleToken();//$NON-NLS-1$ if(!getLabelsDisplayedToken().equals(PSTricksConstants.DEFAULT_LABELS_DISPLAYED)) add+=",labels="+getLabelsDisplayedToken();//$NON-NLS-1$ if(!getTicksDisplayedToken().equals(PSTricksConstants.DEFAULT_LABELS_DISPLAYED)) add+=",ticks="+getTicksDisplayedToken();//$NON-NLS-1$ if(((float)ticksSize/ppc)!=((float)PSTricksConstants.DEFAULT_TICKS_SIZE)) add+=",ticksize="+LaTeXDrawNumber.getCutNumber((float)(ticksSize/ppc), threshold)+"cm";//$NON-NLS-1$//$NON-NLS-2$ if(distLabels.x!=0.) add+=",dx="+(float)distLabels.x+"cm";//$NON-NLS-1$//$NON-NLS-2$ if(distLabels.y!=0.) add+=",dy="+(float)distLabels.y+"cm";//$NON-NLS-1$//$NON-NLS-2$ if(increment.x!=PSTricksConstants.DEFAULT_DX) add+=",Dx="+(((int)increment.x)==increment.x?String.valueOf((int)increment.x): //$NON-NLS-1$ String.valueOf((float)increment.x)); if(increment.y!=PSTricksConstants.DEFAULT_DY) add+=",Dy="+(((int)increment.y)==increment.y?String.valueOf((int)increment.y): //$NON-NLS-1$ String.valueOf((float)increment.y)); if(origin.x!=PSTricksConstants.DEFAULT_OX) add+=",Ox="+(int)origin.x;//$NON-NLS-1$ if(origin.y!=PSTricksConstants.DEFAULT_OY) add+=",Oy="+(int)origin.y;//$NON-NLS-1$ if(showOrigin!=PSTricksConstants.DEFAULT_SHOW_ORIGIN) add+=",showorigin="+showOrigin;//$NON-NLS-1$ return start +"\\psaxes[linewidth="+ LaTeXDrawNumber.getCutNumber((thickness/ppc), threshold) + //$NON-NLS-1$ add + "]" + arrowsCode + coord + end;//$NON-NLS-1$ } @Override public Object clone() throws CloneNotSupportedException { Axe g = (Axe)super.clone(); g.axesStyle = axesStyle; g.ticksDisplayed = ticksDisplayed; g.ticksSize = ticksSize; g.ticksStyle = ticksStyle; g.increment = (LaTeXDrawPoint2D)increment.clone(); g.showOrigin = showOrigin; g.distLabels = (LaTeXDrawPoint2D)distLabels.clone(); g.labelsDisplayed = labelsDisplayed; g.arrowHead1 = (ArrowHead)arrowHead1.clone(); g.arrowHead2 = (ArrowHead)arrowHead2.clone(); return g; } private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { gridEnd = (LaTeXDrawPoint2D)ois.readObject(); gridStart = (LaTeXDrawPoint2D)ois.readObject(); position = (LaTeXDrawPoint2D)ois.readObject(); origin = (LaTeXDrawPoint2D)ois.readObject(); isXLabelSouth = ois.readBoolean(); isYLabelWest = ois.readBoolean(); borders = (LaTeXDrawRectangle)ois.readObject(); font = (Font)ois.readObject(); increment = (LaTeXDrawPoint2D)ois.readObject(); ticksSize = ois.readDouble(); showOrigin = ois.readBoolean(); ticksDisplayed = ois.readInt(); ticksStyle = ois.readInt(); labelsDisplayed = ois.readInt(); distLabels = (LaTeXDrawPoint2D)ois.readObject(); axesStyle = ois.readInt(); arrowHead1 = (ArrowHead)ois.readObject(); arrowHead2 = (ArrowHead)ois.readObject(); updateFonts(); updateShape(); } /** * @return the increment. */ public synchronized LaTeXDrawPoint2D getIncrement() { return increment; } /** * @param increment the X increment to set. */ public synchronized void setIncrementX(double increment) { this.increment.x = increment; } /** * @param increment the Y increment to set. */ public synchronized void setIncrementY(double increment) { this.increment.y = increment; } /** * @return the distLabels.x. */ public synchronized double getDistLabelsX() { return distLabels.x; } /** * @return the distLabels.y. */ public synchronized double getDistLabelsY() { return distLabels.y; } /** * @param distLabelsX the distLabels.x to set. */ public synchronized void setDistLabelsX(double distLabelsX) { distLabels.x = distLabelsX; } /** * @param distLabelsY the distLabels.y to set. */ public void setDistLabelsY(double distLabelsY) { distLabels.y = distLabelsY; } /** * @return the labelsDisplayed. */ public int getLabelsDisplayed() { return labelsDisplayed; } /** * Allows to get the token of 'labelsDisplayed' (null if there is a problem). * @return The token. */ public String getLabelsDisplayedToken() { if(labelsDisplayed==LABELS_DISPLAYED_ALL_VALUE) return PSTricksConstants.TOKEN_LABELS_DISPLAYED_ALL; if(labelsDisplayed==LABELS_DISPLAYED_NON_VALUE) return PSTricksConstants.TOKEN_LABELS_DISPLAYED_NON; if(labelsDisplayed==LABELS_DISPLAYED_X_VALUE) return PSTricksConstants.TOKEN_LABELS_DISPLAYED_X; if(labelsDisplayed==LABELS_DISPLAYED_Y_VALUE) return PSTricksConstants.TOKEN_LABELS_DISPLAYED_Y; return null; } /** * @param labelsDisplayed the labelsDisplayed to set. */ public synchronized void setLabelsDisplayed(short labelsDisplayed) { this.labelsDisplayed = labelsDisplayed; } /** * @param labelsDisplayed the labelsDisplayed to set. */ public synchronized void setLabelsDisplayedToken(String labelsDisplayed) { if(labelsDisplayed.equals(PSTricksConstants.TOKEN_LABELS_DISPLAYED_ALL)) this.labelsDisplayed = LABELS_DISPLAYED_ALL_VALUE; else if(labelsDisplayed.equals(PSTricksConstants.TOKEN_LABELS_DISPLAYED_NON)) this.labelsDisplayed = LABELS_DISPLAYED_NON_VALUE; else if(labelsDisplayed.equals(PSTricksConstants.TOKEN_LABELS_DISPLAYED_X)) this.labelsDisplayed = LABELS_DISPLAYED_X_VALUE; else if(labelsDisplayed.equals(PSTricksConstants.TOKEN_LABELS_DISPLAYED_Y)) this.labelsDisplayed = LABELS_DISPLAYED_Y_VALUE; } /** * @return the showOrigin. */ public synchronized boolean isShowOrigin() { return showOrigin; } /** * @param showOrigin the showOrigin to set. */ public synchronized void setShowOrigin(boolean showOrigin) { this.showOrigin = showOrigin; } /** * @return the ticksDisplayed. */ public synchronized int getTicksDisplayed() { return ticksDisplayed; } /** * Allows to get the token of 'ticksDisplayed' (null if there is a problem). * @return The token. */ public synchronized String getTicksDisplayedToken() { if(ticksDisplayed==LABELS_DISPLAYED_ALL_VALUE) return PSTricksConstants.TOKEN_LABELS_DISPLAYED_ALL; if(ticksDisplayed==LABELS_DISPLAYED_NON_VALUE) return PSTricksConstants.TOKEN_LABELS_DISPLAYED_NON; if(ticksDisplayed==LABELS_DISPLAYED_X_VALUE) return PSTricksConstants.TOKEN_LABELS_DISPLAYED_X; if(ticksDisplayed==LABELS_DISPLAYED_Y_VALUE) return PSTricksConstants.TOKEN_LABELS_DISPLAYED_Y; return null; } /** * @param ticksDisplayed the ticksDisplayed to set. */ public synchronized void setTicksDisplayed(short ticksDisplayed) { this.ticksDisplayed = ticksDisplayed; } /** * @param ticksDisplayed the ticksDisplayed to set. */ public synchronized void setTicksDisplayedToken(String ticksDisplayed) { if(ticksDisplayed.equals(PSTricksConstants.TOKEN_LABELS_DISPLAYED_ALL)) this.ticksDisplayed = LABELS_DISPLAYED_ALL_VALUE; else if(ticksDisplayed.equals(PSTricksConstants.TOKEN_LABELS_DISPLAYED_NON)) this.ticksDisplayed = LABELS_DISPLAYED_NON_VALUE; else if(ticksDisplayed.equals(PSTricksConstants.TOKEN_LABELS_DISPLAYED_X)) this.ticksDisplayed = LABELS_DISPLAYED_X_VALUE; else if(ticksDisplayed.equals(PSTricksConstants.TOKEN_LABELS_DISPLAYED_Y)) this.ticksDisplayed = LABELS_DISPLAYED_Y_VALUE; } /** * @return the ticksStyle. */ public synchronized int getTicksStyle() { return ticksStyle; } /** * @param ticksStyle the ticksStyle to set. */ public synchronized void setTicksStyle(short ticksStyle) { this.ticksStyle = ticksStyle; } /** * @param ticksStyle the ticksStyle to set. */ public synchronized void setTicksStyleToken(String ticksStyle) { if(ticksStyle.equals(PSTricksConstants.TOKEN_TICKS_STYLE_BOTTOM)) this.ticksStyle = TICKS_STYLE_BOTTOM_VALUE; else if(ticksStyle.equals(PSTricksConstants.TOKEN_TICKS_STYLE_FULL)) this.ticksStyle = TICKS_STYLE_FULL_VALUE; else if(ticksStyle.equals(PSTricksConstants.TOKEN_TICKS_STYLE_TOP)) this.ticksStyle = TICKS_STYLE_TOP_VALUE; } /** * Allows to get the token of the ticks style (null if there is a problem). * @return The token. */ public synchronized String getTicksStyleToken() { if(ticksStyle==TICKS_STYLE_BOTTOM_VALUE) return PSTricksConstants.TOKEN_TICKS_STYLE_BOTTOM; if(ticksStyle==TICKS_STYLE_FULL_VALUE) return PSTricksConstants.TOKEN_TICKS_STYLE_FULL; if(ticksStyle==TICKS_STYLE_TOP_VALUE) return PSTricksConstants.TOKEN_TICKS_STYLE_TOP; return null; } /** * @return the ticksSize. */ public synchronized double getTicksSize() { return ticksSize; } /** * @param ticksSize the ticksSize to set. */ public synchronized void setTicksSize(double ticksSize) { this.ticksSize = ticksSize; } /** * @return the axesStyle. */ public synchronized int getAxesStyle() { return axesStyle; } /** * Allows to get the token of the axes style (null if there is a problem). * @return The token. */ public synchronized String getAxesStyleToken() { if(axesStyle==AXES_STYLE_AXES_VALUE) return PSTricksConstants.TOKEN_AXES_STYLE_AXES; if(axesStyle==AXES_STYLE_FRAME_VALUE) return PSTricksConstants.TOKEN_AXES_STYLE_FRAME; if(axesStyle==AXES_STYLE_NONE_VALUE) return PSTricksConstants.TOKEN_AXES_STYLE_NONE; return null; } /** * @param axesStyle the axesStyle to set. */ public synchronized void setAxesStyle(short axesStyle) { this.axesStyle = axesStyle; } /** * @param axesStyle the axesStyle to set. */ public synchronized void setAxesStyleToken(String axesStyle) { if(axesStyle.equals(PSTricksConstants.TOKEN_AXES_STYLE_AXES)) this.axesStyle = AXES_STYLE_AXES_VALUE; else if(axesStyle.equals(PSTricksConstants.TOKEN_AXES_STYLE_FRAME)) this.axesStyle = AXES_STYLE_FRAME_VALUE; else if(axesStyle.equals(PSTricksConstants.TOKEN_AXES_STYLE_NONE)) this.axesStyle = AXES_STYLE_NONE_VALUE; } @Override public void updateBorders(FontMetrics fm) { updateBorders(); } public String getArrow1Style() { return arrowHead1.getArrowStyle(); } public String getArrow2Style() { return arrowHead2.getArrowStyle(); } public ArrowHead getArrowHead1() { return arrowHead1; } public ArrowHead getArrowHead2() { return arrowHead2; } public void setArrow1Style(String style) { arrowHead1.setArrowStyle(style); } public void setArrow2Style(String style) { arrowHead2.setArrowStyle(style); } /** * @return A combobox allowing to choice the style of the axes. */ public static JComboBox createAxeStyleChoice() { JComboBox choice = new LaTeXDrawComboBox(); choice.addItem(LABEL_STYLE_AXE); choice.addItem(LABEL_STYLE_FRAME); choice.addItem(LABEL_STYLE_NONE); choice.setActionCommand(ACTION_CMD_AXE_STYLE_CHOICE); choice.setName(ACTION_CMD_AXE_STYLE_CHOICE); choice.setMinimumSize(new Dimension(70,30)); choice.setPreferredSize(new Dimension(70,30)); choice.setMaximumSize(new Dimension(70,30)); return choice; } /** * @return A combobox allowing to choice the style of the ticks. */ public static JComboBox createTicksStyleChoice() { JComboBox choice = new LaTeXDrawComboBox(); choice.addItem(LABEL_STYLE_TICKS_FULL); choice.addItem(LABEL_STYLE_TICKS_TOP); choice.addItem(LABEL_STYLE_TICKS_BOTTOM); choice.setActionCommand(ACTION_CMD_TICKS_STYLE_CHOICE); choice.setName(ACTION_CMD_TICKS_STYLE_CHOICE); choice.setMinimumSize(new Dimension(70,30)); choice.setPreferredSize(new Dimension(70,30)); choice.setMaximumSize(new Dimension(70,30)); return choice; } @Override public void updateToGrid(MagneticGrid grid) { position.setLocation(grid.getTransformedPointToGrid(position, false)); updateBorders(); updateShape(); } @Override public int hashCode() { return super.hashCode()^4; } public boolean hasTwoLeftArrows() { return true; } } latexdraw-2.0.8+1.orig/latexDraw/figures/Circle.java0000644000000000000000000003716111347255510017153 0ustar package latexDraw.figures; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Shape; import java.awt.geom.Ellipse2D; import java.io.IOException; import java.io.ObjectInputStream; import latexDraw.psTricks.DviPsColors; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.util.LaTeXDrawNumber; import latexDraw.util.LaTeXDrawPoint2D; /** * This class defines a circle.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class Circle extends Ellipse { private static final long serialVersionUID = 1L; /** * @param f The figure to copy. * @param sameNumber True if the figure will have the same number of the copy. */ public Circle(Figure f, boolean sameNumber) { super(f, sameNumber); double b = Math.abs(borders.getPoint(0).y-borders.getPoint(2).y)/2.; double a = Math.abs(borders.getPoint(0).x-borders.getPoint(1).x)/2.; double radius = Math.max(b, a); LaTeXDrawPoint2D cg = borders.getGravityCenter(); borders = new Square(new LaTeXDrawPoint2D(cg.x-radius, cg.y-radius), new LaTeXDrawPoint2D(cg.x+radius, cg.y-radius), new LaTeXDrawPoint2D(cg.x-radius, cg.y+radius), new LaTeXDrawPoint2D(cg.x+radius, cg.y+radius), false); updateGravityCenter(); updateShape(); } /** * The constructor by default */ public Circle(boolean increaseMeter) { this(new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D() , increaseMeter); } /** * The constructor using two points * @param pt1 The top left point of the rectangle containing the ellipse * @param pt2 The bottom right point of the rectangle containing the ellipse */ public Circle(LaTeXDrawPoint2D pt1, LaTeXDrawPoint2D pt2, LaTeXDrawPoint2D pt3, LaTeXDrawPoint2D pt4, boolean increaseMeter) { super(pt1, pt2, pt3, pt4, increaseMeter); borders = new Square(pt1, pt2, pt3, pt4, false); gravityCenter = borders.getGravityCenter(); updateGravityCenter(); shape = getInsideOutsideOrMiddleBorders(); } @Override public String getCodePSTricks(DrawBorders drawBorders, float ppc) { LaTeXDrawPoint2D d = drawBorders.getOriginPoint(); LaTeXDrawPoint2D pt1 = borders.getPoint(0), pt2 = borders.getPoint(1); LaTeXDrawPoint2D pt3 = borders.getPoint(2); String add = "", addBegin="", addEnd="", fillType=""; //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$//$NON-NLS-4$ boolean isFilledWasChanged = false; double x = (pt1.x+pt2.x)/2. - d.x, y = d.y - (pt1.y+pt3.y)/2. ; double width = Math.abs(pt1.x-pt2.x); double threshold = 0.001; if(hasShadow) { fillType+=",shadow=true";//$NON-NLS-1$ if(Math.toDegrees(shadowAngle)!=PSTricksConstants.DEFAULT_SHADOW_ANGLE) fillType+=",shadowangle="+(float)Math.toDegrees(shadowAngle);//$NON-NLS-1$ if(((float)shadowSize)!=((float)DEFAULT_SHADOW_SIZE)) fillType+=",shadowsize="+LaTeXDrawNumber.getCutNumber((float)(shadowSize/PPC), threshold);//$NON-NLS-1$ if(!shadowColor.equals(PSTricksConstants.DEFAULT_SHADOW_COLOR)) { String name = DviPsColors.getColourName(shadowColor); if(name==null) { name = "color"+number+'e';//$NON-NLS-1$ DviPsColors.addUserColour(shadowColor, name); } fillType += ",shadowcolor=" + name; //$NON-NLS-1$ } if(!isFilled) { isFilled = true; isFilledWasChanged = true; } } String str = getPSTricksCodeFilling(ppc); if(str.length()>0) fillType=fillType+','+str; str = getPSTricksCodeLine(ppc); if(str.length()>0) add=add+','+str; if(rotationAngle%(Math.PI*2)!=0.) { double angle = -Math.toDegrees(rotationAngle); double cx = (gravityCenter.x-d.x)/ppc; double cy = (d.y-gravityCenter.y)/ppc; double x2 = -Math.cos(-rotationAngle)*cx+ Math.sin(-rotationAngle)*cy+cx; double y2 = -Math.sin(-rotationAngle)*cx- Math.cos(-rotationAngle)*cy+cy; addBegin +="\\rput{"+(float)angle+ "}("+LaTeXDrawNumber.getCutNumber((float)x2,threshold)+','+LaTeXDrawNumber.getCutNumber((float)y2,threshold)+"){"; //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-3$ addEnd = "}"; //$NON-NLS-1$ } add+=",dimen="+bordersPosition; //$NON-NLS-1$ if(hasDoubleBoundary) { add+=",doubleline=true,doublesep="+LaTeXDrawNumber.getCutNumber((float)(doubleSep/ppc), threshold); //$NON-NLS-1$ if(doubleColor!=PSTricksConstants.DEFAULT_DOUBLE_COLOR) { String name = DviPsColors.getColourName(doubleColor); if(name==null) { name = "color"+number+'d';//$NON-NLS-1$ DviPsColors.addUserColour(doubleColor, name); } add+= ",doublecolor="+name; //$NON-NLS-1$ } } if(isFilledWasChanged) isFilled = false; return addBegin+"\\pscircle[linewidth=" + LaTeXDrawNumber.getCutNumber(thickness/ppc, threshold) + //$NON-NLS-1$ add + fillType + "](" //$NON-NLS-1$ + LaTeXDrawNumber.getCutNumber((float)(x/ppc),threshold) + ',' + LaTeXDrawNumber.getCutNumber((float)(y/ppc),threshold) + "){" //$NON-NLS-1$ + LaTeXDrawNumber.getCutNumber((float)((width/2)/ppc),threshold) + '}'+addEnd; } @Override public boolean isIn(LaTeXDrawPoint2D p) { LaTeXDrawPoint2D pt = rotateInvertPoint(p); if(isSelected && (borders.dNE.isIn(pt) || borders.dNW.isIn(pt) || borders.dSE.isIn(pt) || borders.dSW.isIn(pt))) return true; LaTeXDrawPoint2D NW = getTheNWNonRotatedBoundPoint(); LaTeXDrawPoint2D SE = getTheSENonRotatedBoundPoint(); Ellipse2D.Double s = new Ellipse2D.Double(NW.x, NW.y, Math.abs(NW.x - SE.x), Math.abs(NW.y - SE.y)); if(!s.contains(pt)) return false; if(isFilled || hasShadow || hasGradient()) return true; Shape s2; if (hasDoubleBoundary) s2 = new Ellipse2D.Double(NW.x + thickness * 2 + doubleSep, NW.y + thickness * 2 + doubleSep, Math.abs(NW.x - SE.x)- 4 * thickness - 2 * doubleSep, Math.abs(NW.y- SE.y) - 4 * thickness - 2 * doubleSep); else s2 = new Ellipse2D.Double(NW.x + thickness, NW.y + thickness, Math.abs(NW.x - SE.x) - 2 * thickness, Math.abs(NW.y- SE.y)- 2 * thickness); return !s2.contains(pt); } @Override public void draw(Graphics2D g, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering) { LaTeXDrawPoint2D NW = borders.getTheNWPoint(), SE = borders.getTheSEPoint(); Color formerCol = g.getColor(); double cx = (NW.x+SE.x)/2., cy = (NW.y+SE.y)/2.; double c2x = Math.cos(rotationAngle)*cx - Math.sin(rotationAngle)*cy; double c2y = Math.sin(rotationAngle)*cx + Math.cos(rotationAngle)*cy; double c3x = Math.cos(-rotationAngle)*(cx-c2x) - Math.sin(-rotationAngle)*(cy-c2y); double c3y = Math.sin(-rotationAngle)*(cx-c2x) + Math.cos(-rotationAngle)*(cy-c2y); double dx=0, dy=0; boolean changeFillStyle = false; if(rotationAngle%(Math.PI*2)!=0) { g.rotate(rotationAngle); g.translate(c3x,c3y); } if(hasShadow) { LaTeXDrawPoint2D cg = getGravityCenter(); LaTeXDrawPoint2D shadowCg = (LaTeXDrawPoint2D)cg.clone(); shadowCg.setLocation(cg.x+shadowSize, cg.y); shadowCg = Figure.rotatePoint(shadowCg, cg, shadowAngle); dx = shadowCg.x-cg.x; dy = cg.y-shadowCg.y; } if(hasDoubleBoundary) { Shape s0 = shape; Shape s[] = getDbleBoundariesOutInOrMiddle(s0); Shape s1, s2, s3; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) { s1 = s0; s2 = s[0]; s3 = s[1]; } else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) { s1 = s[0]; s2 = s0; s3 = s[1]; } else { s1 = s[0]; s2 = s[1]; s3 = s0; } if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); if(hasShadow) { g.translate(dx, dy); g.setColor(shadowColor); g.fill(s1); g.draw(s1); g.translate(-dx, -dy); if(!isFilled) { changeFillStyle = true; isFilled = true; } } g.setColor(doubleColor); g.setStroke(new BasicStroke((float)(doubleSep + thickness), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.draw(s2); fillFigure(g, antiAlias, rendering, alphaInter, colorRendering,s3); g.setColor(linesColor); g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.draw(s1); g.draw(s3); } else { if(hasShadow) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.fill(s1); g.draw(s1); g.translate(-dx, -dy); g.setColor(interiorColor); g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.draw(s2); if(!isFilled) { changeFillStyle = true; isFilled = true; } } if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[] { 0, (float)(thickness*2+doubleSep + dotSep) }, 0)); else g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[] { blackDashLength, whiteDashLength }, 0)); fillFigure(g, antiAlias, rendering, alphaInter, colorRendering, s2); g.setColor(linesColor); g.draw(s2); g.setStroke(new BasicStroke((float)doubleSep, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.setColor(doubleColor); g.draw(s2); } } else { Shape shape2 = shape; if(hasShadow) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.fill(shape); g.draw(shape); g.translate(-dx, -dy); if(!isFilled) { changeFillStyle = true; isFilled = true; } g.setColor(interiorColor); g.draw(shape); } if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); else if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[] { 0, thickness + dotSep }, 0)); else g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[] { blackDashLength, whiteDashLength }, 0)); fillFigure(g, antiAlias, rendering, alphaInter, colorRendering, shape2); g.setColor(linesColor); g.draw(shape); } g.setColor(formerCol); if(changeFillStyle) isFilled = false; if(rotationAngle%(Math.PI*2)!=0) { g.translate(-c3x, -c3y); g.rotate(-rotationAngle); } if(isSelected) borders.draw(g, false, antiAlias, rendering, alphaInter, colorRendering); } @Override public Object clone() throws CloneNotSupportedException { return super.clone(); } private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { canHaveShadow = true; interiorColor = (Color) ois.readObject(); lineStyle = (String) ois.readObject(); rotationAngle = ois.readDouble(); thickness = ois.readFloat(); isFilled = ois.readBoolean(); isSelected = ois.readBoolean(); isOnRotation = ois.readBoolean(); linesColor = (Color) ois.readObject(); blackDashLength = ois.readFloat(); dotSep = ois.readFloat(); whiteDashLength = ois.readFloat(); borders = (LaTeXDrawRectangle) ois.readObject(); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.5")>=0) //$NON-NLS-1$ { hasDoubleBoundary = ois.readBoolean(); doubleColor = (Color)ois.readObject(); doubleSep = ois.readDouble(); bordersPosition = (String)ois.readObject(); if(!(LaTeXDrawFrame.getVersionOfFile().compareTo("1.6")>=0)) //$NON-NLS-1$ ois.readBoolean(); hatchingAngle = ois.readDouble(); hatchingColor = (Color)ois.readObject(); hatchingStyle = (String)ois.readObject(); hatchingWidth = ois.readFloat(); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.6") < 0)//$NON-NLS-1$ { if(hatchingStyle.equals(DECREPETED_FILL_CROSS)) hatchingStyle = PSTricksConstants.TOKEN_FILL_CROSSHATCH; else if(hatchingStyle.equals(DECREPETED_FILL_HORIZ)) hatchingStyle = PSTricksConstants.TOKEN_FILL_HLINES; else if(hatchingStyle.equals(DECREPETED_FILL_VERT)) hatchingStyle = PSTricksConstants.TOKEN_FILL_VLINES; else if(hatchingStyle.equals(DECREPETED_FILL_NO)) hatchingStyle = PSTricksConstants.TOKEN_FILL_NONE; } } else { hasDoubleBoundary = DEFAULT_HAS_DOUBLE_BOUNDARY; doubleColor = DEFAULT_DOUBLE_COLOR; doubleSep = DEFAULT_DOUBLESEP; bordersPosition = DEFAULT_BORDERS_POSITION; hatchingAngle = DEFAULT_HATCH_ANGLE; hatchingColor = DEFAULT_HATCH_COL; hatchingStyle = DEFAULT_HATCH_STYLE; hatchingWidth = DEFAULT_HATCH_WIDTH; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.7")>=0) //$NON-NLS-1$ { hasShadow = ois.readBoolean(); shadowAngle = ois.readDouble(); shadowSize = ois.readDouble(); shadowColor = (Color)ois.readObject(); gradientEndColor = (Color)ois.readObject(); gradientStartColor = (Color)ois.readObject(); gradientAngle = ois.readDouble(); gradientMidPoint = ois.readDouble(); } else { hasShadow = DEFAULT_SHADOW_HAS; shadowAngle = DEFAULT_SHADOW_ANGLE; shadowSize = DEFAULT_SHADOW_SIZE; shadowColor = DEFAULT_SHADOW_COLOR; gradientEndColor = PSTricksConstants.DEFAULT_GRADIENT_END_COLOR; gradientStartColor = PSTricksConstants.DEFAULT_GRADIENT_START_COLOR; gradientAngle = DEFAULT_GRADIENT_ANGLE; gradientMidPoint = DEFAULT_GRADIENT_MID_POINT; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.8")>=0) //$NON-NLS-1$ hatchingSep = ois.readDouble(); else hatchingSep = DEFAULT_HATCH_SEP; updateGravityCenter(); updateStyleOfDelimitors(); shape = getInsideOutsideOrMiddleBorders(); } /** * Compute the intersection points between a circle and a line. * @param coeffA The a of y=ax+b of the second line * @param coeffB The b of y=ax+b of the second line * @return Null if there is no point ; else the two points. */ public LaTeXDrawPoint2D[] getIntersectionPoints(double coeffA, double coeffB) { double R = Math.abs(gravityCenter.x-getTheNWPoint().x); double c = coeffB*coeffB-R*R; double b = 2*coeffA*coeffB; double a = (1+coeffA)*(1+coeffA); double delta = b*b - 4*a*c; if(delta<=0) return null; double x1 = (-b-Math.sqrt(delta))/(2*a); double x2 = (-b+Math.sqrt(delta))/(2*a); LaTeXDrawPoint2D[] pts = new LaTeXDrawPoint2D[2]; pts[0] = new LaTeXDrawPoint2D(x1, coeffA*x1+coeffB); pts[1] = new LaTeXDrawPoint2D(x2, coeffA*x2+coeffB); return pts; } @Override public synchronized void setThickness(float value) { super.setThickness(value); shape = getInsideOutsideOrMiddleBorders(); } /** * @return The radius of the circle. * @since 1.9 */ public synchronized double getRadius() { return Math.abs(borders.getPoint(0).x-borders.getPoint(1).x)/2.; } @Override public int hashCode() { return super.hashCode()^((int)getRadius()); } } latexdraw-2.0.8+1.orig/latexDraw/figures/BezierCurve.java0000644000000000000000000022037511347255510020200 0ustar package latexDraw.figures; import java.awt.*; import java.awt.geom.AffineTransform; import java.awt.geom.GeneralPath; import java.awt.geom.Line2D; import java.awt.geom.Path2D; import java.awt.geom.Rectangle2D; import java.io.IOException; import java.io.ObjectInputStream; import java.util.Vector; import javax.swing.JLabel; import latexDraw.figures.properties.Arrowable; import latexDraw.psTricks.DviPsColors; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.ui.components.Delimitor; import latexDraw.ui.components.LaTeXDrawComboBox; import latexDraw.ui.components.LabelListCellRenderer; import latexDraw.ui.components.MagneticGrid; import latexDraw.util.LaTeXDrawException; import latexDraw.util.LaTeXDrawNumber; import latexDraw.util.LaTeXDrawPoint2D; import latexDraw.util.LaTeXDrawResources; /** * The class defines a new kind of figure, Bézier curves. *
    * This file is part of LaTeXDraw.
    * Copyright(c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 07/25/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class BezierCurve extends LaTeXDrawPolygon implements Arrowable { private static final long serialVersionUID = 1L; /** This vector contains the points which allows to change the angles of the curves */ protected Vector ctrlPts; /** Contains the second control points of each points; useful for closed curve. @since 1.9 */ protected Vector secondCtrlPts; /** This vector contains the lines which allows to change the angles of the curves */ protected Vector ctrlLines; /** Contains the second control lines of each point; useful for closed curve. @since 1.9 */ protected transient Vector secondCtrlLines; /** If true, the control lines are displayed */ protected boolean showPoints; /** the arrowhead of the first point. */ protected ArrowHead arrowHead1; /** The arrow head of the second point. */ protected ArrowHead arrowHead2; /** Define if the path must be closed or not. @since 1.9 */ protected boolean open; /** * Define the shape of the closing path. * @since 1.9 * @see BezierCurve#CLOSE_TYPE_CURVE * @see BezierCurve#CLOSE_TYPE_LINE */ protected int closeType; /** * Define the gap between a control point and its point in pixel when using {@link #equilibrate()} * method. * @since 1.9 */ protected int equilibrateGap; public static final int DEFAULT_EQUILIBRATE_GAP = 50; /** The value of showPoints by default */ public static final boolean DEFAULT_SHOWPOINTS = false; /** The gap of the control point by default */ public static final int DEFAULT_POSITION_CTRL = 40; /** The value by default of open. */ public static final boolean DEFAULT_OPEN = false; /** The closing path will be a line. */ public static final short CLOSE_TYPE_LINE = 0; /** The closing path will be a Bézier curve. */ public static final short CLOSE_TYPE_CURVE = 1; /** The value of closeType by default. */ public static final short DEFAULT_CLOSE_TYPE = CLOSE_TYPE_CURVE; public static final String LABEL_CLOSE_CHOICE = "closeBezierCh";//$NON-NLS-1$ /** * The constructor by default. */ public BezierCurve(boolean increaseMeter) { this(new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), increaseMeter); } /** * @param pt1 The first point. * @param pt2 The second point. */ public BezierCurve(LaTeXDrawPoint2D pt1, LaTeXDrawPoint2D pt2, boolean increaseMeter) { this(pt1, pt2, DEFAULT_OPEN, increaseMeter); } /** * @param pt1 The first point. * @param pt2 The second point. * @param isOpen Defines if the curve will be open or not. * @since 1.9 */ public BezierCurve(LaTeXDrawPoint2D pt1, LaTeXDrawPoint2D pt2, boolean isOpen, boolean increaseMeter) { super(pt1, pt2, increaseMeter); equilibrateGap = DEFAULT_EQUILIBRATE_GAP; closeType = DEFAULT_CLOSE_TYPE; canHaveArrow = true; isBordersMovable= false; showPoints = DEFAULT_SHOWPOINTS; LaTeXDrawPoint2D pt1b = new LaTeXDrawPoint2D(pt1), pt2b = new LaTeXDrawPoint2D(pt2); arrowHead1 = new ArrowHead(pt1b, new Line(pt1b, getFirstControlPoint(0), false), this); arrowHead2 = new ArrowHead(pt2b, new Line(pt2b, getFirstControlPoint(-1), false), this); updateBorders(); setOpen(isOpen); } /** * Allows to add a control line. * @param pt The new point of the Bézier curve. * @param ctrlPt The new control point of the new point pt. * @param pos The position of the new line in the vector (if -1 the line is * put at the end of the vector). */ protected void addCtrlLineAt(LaTeXDrawPoint2D pt, LaTeXDrawPoint2D ctrlPt, LaTeXDrawPoint2D ctrlPt2, int pos) { if(ctrlLines == null) { secondCtrlLines = new Vector(); ctrlLines = new Vector(); } if(pos<-1 || pos>ctrlPts.size()) throw new IllegalArgumentException("Invalid position");//$NON-NLS-1$ Line l = new Line(pt, ctrlPt, false); Line l2 = new Line(pt, ctrlPt2, false); double dim = Math.max(6,1.33*thickness+3.33 +1.); if(pos==-1 || pos==ctrlPts.size()-1) { ctrlLines.add(l); secondCtrlLines.add(l2); } else { ctrlLines.add(pos, l); secondCtrlLines.add(pos, l2); } l.setLinesColor(Color.GRAY); l.setLineStyle(PSTricksConstants.LINE_DASHED_STYLE); l.setThickness(1); l.delimiters.firstElement().setDim(dim); l.delimiters.lastElement().setDim(dim); l2.setLinesColor(Color.GRAY); l2.setLineStyle(PSTricksConstants.LINE_DASHED_STYLE); l2.setThickness(1); l2.delimiters.firstElement().setDim(dim); l2.delimiters.lastElement().setDim(dim); } /** * Allows to add a control line at the end of the vector. * @param pt The new point of the Bézier curve. * @param ctrlPt The new control point of the new point point. */ protected void addCtrlLine(LaTeXDrawPoint2D pt, LaTeXDrawPoint2D ctrlPt, LaTeXDrawPoint2D ctrlPt2) { addCtrlLineAt(pt, ctrlPt, ctrlPt2, -1); } @Override public boolean addPointAt(LaTeXDrawPoint2D pt, int id) { if(pt!=null) { if(ctrlPts==null) { ctrlPts = new Vector(); secondCtrlPts = new Vector(); } if(super.addPointAt(pt, id)) { LaTeXDrawPoint2D ctrlPt = new LaTeXDrawPoint2D(pt.x, pt.y+DEFAULT_POSITION_CTRL); LaTeXDrawPoint2D ctrlPt2 = ctrlPt.centralSymmetry(pt); if(id==pts.size()-2 || pts.isEmpty()) { ctrlPts.add(ctrlPt); secondCtrlPts.add(ctrlPt2); addCtrlLine(pt, ctrlPt, ctrlPt2); } else { ctrlPts.add(id, ctrlPt); secondCtrlPts.add(id, ctrlPt2); addCtrlLineAt(pt, ctrlPt, ctrlPt2, id); } if(id==0 && arrowHead1!=null) { LaTeXDrawPoint2D pt2 = new LaTeXDrawPoint2D(pts.firstElement()); arrowHead1.setPosition(pt2); arrowHead1.setLine(new Line(pt2, ctrlPts.firstElement(), false)); } else if(arrowHead2!=null && id==pts.size()-2) { LaTeXDrawPoint2D pt2 = new LaTeXDrawPoint2D(pt); arrowHead2.setPosition(pt2); arrowHead2.setLine(new Line(pt2, ctrlPts.lastElement(), false)); } return true; } } return false; } @Override public Object clone() throws CloneNotSupportedException { BezierCurve b = (BezierCurve)super.clone(); b.equilibrateGap= equilibrateGap; b.ctrlPts = new Vector(); b.secondCtrlPts = new Vector(); b.ctrlLines = new Vector(); b.secondCtrlLines = new Vector(); b.arrowHead1 = (ArrowHead)arrowHead1.clone(); b.arrowHead2 = (ArrowHead)arrowHead2.clone(); int i, size = ctrlPts.size(); for(i=0; i1; boolean arrow2Drawable = arrowHead2.isDrawable() && !arrowHead2Style.equals(PSTricksConstants.NONEARROW_STYLE) && pts.size()>1 && isOpen(); if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); else if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[]{0,thickness+dotSep}, 0)); else if(lineStyle.equals(PSTricksConstants.LINE_DASHED_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[]{blackDashLength, whiteDashLength}, 0)); int i, size = getNbPoints(); if(shape==null) shape = getSimpleShape(); g.setColor(linesColor); boolean update=false; if(arrow1Drawable) { double lgth = arrowHead1.getArrowHeadLength(); try { LaTeXDrawPoint2D[] points = arrowHead1.getLine().findPoints(arrowHead1.getPosition(), lgth); LaTeXDrawPoint2D newPt=null; if(points.length==1) newPt=points[0]; else newPt=points[0].distance(getFirstControlPoint(0))1) { ctrlLines.firstElement().draw(g, antiAlias, rendering, alphaInter, colorRendering); ctrlLines.firstElement().delimiters.elementAt(1).draw(g); for(i=1; i=ctrlLines.size() || id<-1) throw new IllegalArgumentException(); if(id==-1) id = ctrlLines.size()-1; ctrlLines.remove(id); secondCtrlLines.remove(id); ctrlPts.remove(id); secondCtrlPts.remove(id); if(id==pts.size()) { LaTeXDrawPoint2D pt2 = new LaTeXDrawPoint2D(pts.lastElement()); arrowHead2.setPosition(pt2); arrowHead2.setLine(new Line(pt2, ctrlPts.lastElement(), false)); } updateBorders(); updateShape(); } @Override public synchronized void setLastPoint(LaTeXDrawPoint2D pt) { double oldX = pts.lastElement().x; double oldY = pts.lastElement().y; super.setLastPoint(pt); // We move the last ctrl points of the Bézier curve if(!ctrlPts.isEmpty()) { LaTeXDrawPoint2D lastPt = ctrlPts.lastElement(); lastPt.x += pt.x - oldX; lastPt.y += pt.y - oldY; secondCtrlPts.lastElement().setLocation(lastPt.centralSymmetry(pts.lastElement())); arrowHead2.getPosition().setLocation(pt.x, pt.y); updateBorders(); updateShape(); updateGravityCenter(); } } @Override public synchronized void setPointAt(LaTeXDrawPoint2D pt, int id) { super.setPointAt(pt, id); if(id<0 || id>=ctrlPts.size()) throw new IllegalArgumentException("Invalid id");//$NON-NLS-1$ LaTeXDrawPoint2D ctrlPt = new LaTeXDrawPoint2D(pt.x, pt.y+DEFAULT_POSITION_CTRL); LaTeXDrawPoint2D ctrlPt2 = ctrlPt.centralSymmetry(pt); ctrlPts.setElementAt(ctrlPt, id); secondCtrlPts.setElementAt(ctrlPt2, id); addCtrlLineAt(pt, ctrlPt, ctrlPt2, id); arrowHead1.getPosition().setLocation(getPoint(0)); arrowHead2.getPosition().setLocation(getPoint(-1)); shape = getSimpleShape(); } @Override public String getCodePSTricks(DrawBorders drawBorders, float ppc) { LaTeXDrawPoint2D d = drawBorders.getOriginPoint(); String coord, add="", arrowsCode = ""; //$NON-NLS-1$ //$NON-NLS-2$ int i, size = getNbPoints(); String start = "";//$NON-NLS-1$ LaTeXDrawPoint2D pt, ctrlPt1, ctrlPt2; String showPointsCode = "";//$NON-NLS-1$ String arrowParams = "";//$NON-NLS-1$ boolean hasArrow1Style = !arrowHead1.isWithoutStyle(); boolean hasArrow2Style = !arrowHead2.isWithoutStyle() && isOpen(); double threshold = 0.001; if(size<2) return null; if(!linesColor.equals(PSTricksConstants.DEFAULT_LINE_COLOR)) { String name = DviPsColors.getColourName(linesColor); if(name==null) { name = "color"+number;//$NON-NLS-1$ DviPsColors.addUserColour(linesColor, name); } add += ",linecolor="+name; //$NON-NLS-1$ } if(hasShadow) { add+=",shadow=true";//$NON-NLS-1$ if(Math.toDegrees(shadowAngle)!=PSTricksConstants.DEFAULT_SHADOW_ANGLE) add+=",shadowangle="+(float)Math.toDegrees(shadowAngle);//$NON-NLS-1$ if(((float)shadowSize)!=((float)DEFAULT_SHADOW_SIZE)) add+=",shadowsize="+LaTeXDrawNumber.getCutNumber((float)(shadowSize/PPC), threshold);//$NON-NLS-1$ if(!shadowColor.equals(PSTricksConstants.DEFAULT_SHADOW_COLOR)) { String name = DviPsColors.getColourName(shadowColor); if(name==null) { name = "color"+number+'e';//$NON-NLS-1$ DviPsColors.addUserColour(shadowColor, name); } add += ",shadowcolor=" + name; //$NON-NLS-1$ } } String arrowHead1Style = arrowHead1.getArrowStyle(); String arrowHead2Style = arrowHead2.getArrowStyle(); if(!isOpen()) arrowHead2Style = PSTricksConstants.NONEARROW_STYLE; if(hasArrow1Style || hasArrow2Style) { if(arrowHead2Style.equals(PSTricksConstants.DLARROW_STYLE)) arrowHead2Style = PSTricksConstants.DRARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.DRARROW_STYLE)) arrowHead2Style = PSTricksConstants.DLARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.RARROW_STYLE)) arrowHead2Style = PSTricksConstants.LARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.LARROW_STYLE)) arrowHead2Style = PSTricksConstants.RARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.DLARROW_STYLE)) arrowHead2Style = PSTricksConstants.DRARROW_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.LRBRACKET_STYLE)) arrowHead2Style = PSTricksConstants.RRBRACKET_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.RRBRACKET_STYLE)) arrowHead2Style = PSTricksConstants.LRBRACKET_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.RSBRACKET_STYLE)) arrowHead2Style = PSTricksConstants.LSBRACKET_STYLE; else if(arrowHead2Style.equals(PSTricksConstants.LSBRACKET_STYLE)) arrowHead2Style = PSTricksConstants.RSBRACKET_STYLE; String paramsR = ","+ arrowHead1.getParametersCode(); //$NON-NLS-1$ String paramsL = ","+ arrowHead2.getParametersCode(); //$NON-NLS-1$ if(paramsR.equals(",")) paramsR = ""; //$NON-NLS-1$ //$NON-NLS-2$ if(paramsL.equals(",")) paramsL = ""; //$NON-NLS-1$ //$NON-NLS-2$ if(hasArrow1Style) { arrowsCode="{"+arrowHead1Style+'-'; //$NON-NLS-1$ if(hasArrow2Style) arrowsCode+=arrowHead2Style; arrowsCode+='}'; if(!arrowHead1.isOfTheSameTypeAs(arrowHead2)) { if((arrowHead2Style.equals(PSTricksConstants.LRBRACKET_STYLE) || arrowHead2Style.equals(PSTricksConstants.RRBRACKET_STYLE) || arrowHead2Style.equals(PSTricksConstants.RSBRACKET_STYLE) || arrowHead2Style.equals(PSTricksConstants.RSBRACKET_STYLE)) && (arrowHead1Style.equals(PSTricksConstants.BAREND_STYLE) || arrowHead1Style.equals(PSTricksConstants.BARIN_STYLE) || arrowHead1Style.equals(PSTricksConstants.LRBRACKET_STYLE) || arrowHead1Style.equals(PSTricksConstants.RRBRACKET_STYLE) || arrowHead1Style.equals(PSTricksConstants.RSBRACKET_STYLE) || arrowHead1Style.equals(PSTricksConstants.RSBRACKET_STYLE))) arrowParams = paramsR; else arrowParams = paramsL + paramsR; }else arrowParams = paramsR; } else if(hasArrow2Style) { arrowParams = paramsL; arrowsCode = "{-"+arrowHead2Style+'}'; //$NON-NLS-1$ } } String str = getPSTricksCodeFilling(ppc); if(str.length()>0) add=add+','+str; if(showPoints) { showPointsCode=",showpoints=true"; //$NON-NLS-1$ if(!arrowHead1.isArrowShapeDot() && !arrowHead2.isArrowShapeDot()) showPointsCode += ',' + arrowHead1.getDotParameters(); } if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) add += ",linestyle="+lineStyle+",dotsep="+ //$NON-NLS-1$ //$NON-NLS-2$ LaTeXDrawNumber.getCutNumber(dotSep/ppc, threshold)+ "cm"; //$NON-NLS-1$ else if(lineStyle.equals(PSTricksConstants.LINE_DASHED_STYLE)) add += ",linestyle="+lineStyle+",dash=" + //$NON-NLS-1$ //$NON-NLS-2$ LaTeXDrawNumber.getCutNumber(blackDashLength/ppc, threshold) + "cm "+ //$NON-NLS-1$ LaTeXDrawNumber.getCutNumber(whiteDashLength/ppc, threshold) + "cm";//$NON-NLS-1$ if(hasDoubleBoundary) { add+=",doubleline=true,doublesep="+LaTeXDrawNumber.getCutNumber((float)(doubleSep/ppc), threshold); //$NON-NLS-1$ if(doubleColor!=PSTricksConstants.DEFAULT_DOUBLE_COLOR) { String name = DviPsColors.getColourName(doubleColor); if(name==null) { name = "color"+number+'d';//$NON-NLS-1$ DviPsColors.addUserColour(doubleColor, name); } add+= ",doublecolor="+name; //$NON-NLS-1$ } } if(!isFilled && hasShadow() && isHatched()) { String name = DviPsColors.getColourName(interiorColor); if(name==null) { name = "color"+number+'b';//$NON-NLS-1$ DviPsColors.addUserColour(interiorColor, name); } add += ",fillcolor=" + name; //$NON-NLS-1$ } coord = "(" + LaTeXDrawNumber.getCutNumber((float)((pts.firstElement().x-d.x)/ppc), threshold) +","+ //$NON-NLS-1$ //$NON-NLS-2$ LaTeXDrawNumber.getCutNumber((float)((d.y-pts.firstElement().y)/ppc), threshold)+")("+ //$NON-NLS-1$ LaTeXDrawNumber.getCutNumber((float)((ctrlPts.firstElement().x-d.x)/ppc), threshold)+","+ //$NON-NLS-1$ LaTeXDrawNumber.getCutNumber((float)((d.y-ctrlPts.firstElement().y)/ppc), threshold)+")("+ //$NON-NLS-1$ LaTeXDrawNumber.getCutNumber((float)((ctrlPts.elementAt(1).x-d.x)/ppc), threshold)+","+ //$NON-NLS-1$ LaTeXDrawNumber.getCutNumber((float)((d.y-ctrlPts.elementAt(1).y)/ppc), threshold)+")("+ //$NON-NLS-1$ LaTeXDrawNumber.getCutNumber((float)((pts.elementAt(1).x-d.x)/ppc), threshold)+","+ //$NON-NLS-1$ LaTeXDrawNumber.getCutNumber((float)((d.y-pts.elementAt(1).y)/ppc), threshold)+')'; for(i=2; iSEx) SEx = pt.x; if(pt.ySEy) SEy = pt.y; } size = ctrlPts.size(); for(i=0; iSEx) SEx = pt.x; if(pt.ySEy) SEy = pt.y; } if(!open && size>0) { pt = secondCtrlPts.firstElement(); if(pt.xSEx) SEx = pt.x; if(pt.ySEy) SEy = pt.y; pt = secondCtrlPts.lastElement(); if(pt.xSEx) SEx = pt.x; if(pt.ySEy) SEy = pt.y; } for(i=1; iSEx) SEx = pt.x; if(pt.ySEy) SEy = pt.y; } if(showPoints) { double width = (arrowHead1.getDotSizeDim() + arrowHead1.getDotSizeNum()*thickness)/2.; NWx-=width; NWy-=width; SEx+=width; SEy+=width; } if(borders==null) borders = new LaTeXDrawRectangle(new LaTeXDrawPoint2D(NWx, NWy), new LaTeXDrawPoint2D(SEx, SEy), false); else { borders.setLastPoint(SEx, SEy); borders.setFirstPoint(NWx, NWy); } } } @Override public void updateBorders(LaTeXDrawPoint2D pt) { updateBorders(); } @Override public void addRotationAngle(double theta) { int i, size = pts.size(); LaTeXDrawPoint2D p, pRot; LaTeXDrawPoint2D cg = (LaTeXDrawPoint2D)gravityCenter.clone(); theta%=(Math.PI*2); for(i=0; iid in the vector ctrlPts. * @param id The identifier of the asked point (-1 = the last point). * @return The point asked. */ public LaTeXDrawPoint2D getFirstControlPoint(int id) { if(ctrlPts==null) return null; if(id==-1) return ctrlPts.lastElement(); if(id<0 || id>=ctrlPts.size()) throw new ArrayIndexOutOfBoundsException(id); return ctrlPts.elementAt(id); } /** * Allow to get the second control point at the identifier id in the vector ctrlPts. * @param id The identifier of the asked point (-1 = the last point). * @return The point asked. */ public LaTeXDrawPoint2D getSecondControlPoint(int id) { if(secondCtrlPts==null) return null; if(id==-1) return secondCtrlPts.lastElement(); if(id<0 || id>=secondCtrlPts.size()) throw new ArrayIndexOutOfBoundsException(id); return secondCtrlPts.elementAt(id); } @Override public void rescaleX(double formerX, double newX, double percent, LaTeXDrawRectangle bound) { if(percent==1.) return ; if(bound==null) throw new IllegalArgumentException(); int i, size = getNbPoints(); if(size>0) { LaTeXDrawPoint2D NW = bound.getTheNWPoint(), SE = bound.getTheSEPoint(),farest,p; if(formerX == SE.x) farest = NW; else if(formerX == NW.x) farest = SE; else throw new IllegalArgumentException(); for(i=0; i0) { LaTeXDrawPoint2D NW = bound.getTheNWPoint(), SE = bound.getTheSEPoint(),farest,p; if(formerY == SE.y) farest = NW; else if(formerY == NW.y) farest = SE; else throw new IllegalArgumentException(); for(i=0; i) ois.readObject(); ctrlPts = (Vector) ois.readObject(); hasDoubleBoundary = ois.readBoolean(); doubleColor = (Color)ois.readObject(); doubleSep = ois.readDouble(); showPoints = ois.readBoolean(); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.7")>=0) //$NON-NLS-1$ { hasShadow = ois.readBoolean(); shadowAngle = ois.readDouble(); shadowSize = ois.readDouble(); shadowColor = (Color)ois.readObject(); } else { hasShadow = DEFAULT_SHADOW_HAS; shadowAngle = DEFAULT_SHADOW_ANGLE; shadowSize = DEFAULT_SHADOW_SIZE; shadowColor = DEFAULT_SHADOW_COLOR; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.8")>=0) //$NON-NLS-1$ { hatchingAngle = ois.readDouble(); hatchingColor = (Color)ois.readObject(); hatchingStyle = (String)ois.readObject(); hatchingWidth = ois.readFloat(); gradientEndColor = (Color)ois.readObject(); gradientStartColor = (Color)ois.readObject(); gradientAngle = ois.readDouble(); gradientMidPoint = ois.readDouble(); hatchingSep = ois.readDouble(); arrowHead1 = (ArrowHead)ois.readObject(); arrowHead2 = (ArrowHead)ois.readObject(); } else { hatchingSep = DEFAULT_HATCH_SEP; hatchingAngle = DEFAULT_HATCH_ANGLE; hatchingColor = DEFAULT_HATCH_COL; hatchingStyle = DEFAULT_HATCH_STYLE; hatchingWidth = DEFAULT_HATCH_WIDTH; gradientEndColor = PSTricksConstants.DEFAULT_GRADIENT_END_COLOR; gradientStartColor = PSTricksConstants.DEFAULT_GRADIENT_START_COLOR; gradientAngle = DEFAULT_GRADIENT_ANGLE; gradientMidPoint = DEFAULT_GRADIENT_MID_POINT; LaTeXDrawPoint2D pt1 = new LaTeXDrawPoint2D(getPoint(0)); LaTeXDrawPoint2D pt2 = new LaTeXDrawPoint2D(getPoint(-1)); arrowHead1 = new ArrowHead(pt1, new Line(pt1, getFirstControlPoint(0), false), this); arrowHead2 = new ArrowHead(pt2, new Line(pt2, getFirstControlPoint(-1), false), this); } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.9")>=0) //$NON-NLS-1$ { closeType = ois.readInt(); open = ois.readBoolean(); secondCtrlPts = (Vector) ois.readObject(); equilibrateGap = ois.readInt(); } else { int i, size = pts.size(); closeType = DEFAULT_CLOSE_TYPE; open = true; secondCtrlPts = new Vector(); equilibrateGap = DEFAULT_EQUILIBRATE_GAP; for(i=0; i(); for(int i=0, size = pts.size();i0 && delimiters!=null && !delimiters.isEmpty() && ctrlLines!=null) { double dim = delimiters.elementAt(0).getDim(); for(Line l : ctrlLines) for(Delimitor d : l.delimiters) d.setDim(dim); for(Line l : secondCtrlLines) for(Delimitor d : l.delimiters) d.setDim(dim); updateBorders(); shape = getSimpleShape(); } } @Override protected GeneralPath getBorders(double gap, boolean into) { return getSimpleShape(); } @Override public Shape createShadowShape() { if(!hasShadow) return shape; double dx, dy; LaTeXDrawPoint2D cg = getGravityCenter(); LaTeXDrawPoint2D shadowCg = (LaTeXDrawPoint2D)cg.clone(); shadowCg.setLocation(cg.x+shadowSize, cg.y); shadowCg = Figure.rotatePoint(shadowCg, cg, shadowAngle); dx = shadowCg.x-cg.x; dy = cg.y-shadowCg.y; Shape outline = null; if(hasDoubleBoundary) { Stroke wideline = new BasicStroke((float)(doubleSep+thickness*2.), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); outline = wideline.createStrokedShape(shape); } else outline = shape; AffineTransform at = new AffineTransform(); at.translate(dx, dy); return at.createTransformedShape(outline); } public String getArrow1Style() { return arrowHead1.getArrowStyle(); } public String getArrow2Style() { return arrowHead2.getArrowStyle(); } public ArrowHead getArrowHead1() { return arrowHead1; } public ArrowHead getArrowHead2() { return arrowHead2; } public void setArrow1Style(String style) { arrowHead1.setArrowStyle(style); updateShape(); updateBorders(); } public void setArrow2Style(String style) { arrowHead2.setArrowStyle(style); updateShape(); updateBorders(); } @Override public synchronized void setFirstPoint(double x, double y) { super.setFirstPoint(x, y); updateBorders(); arrowHead1.getPosition().setLocation(x, y); } @Override public void mirrorHorizontal(LaTeXDrawPoint2D origin) { for(LaTeXDrawPoint2D pt : ctrlPts) pt.setLocation(pt.horizontalSymmetry(origin)); arrowHead1.getPosition().setLocation(arrowHead1.getPosition().horizontalSymmetry(origin)); arrowHead2.getPosition().setLocation(arrowHead2.getPosition().horizontalSymmetry(origin)); super.mirrorHorizontal(origin); updateSecondControlPoints(); updateShape(); updateBorders(); } @Override public void mirrorVertical(LaTeXDrawPoint2D origin) { for(LaTeXDrawPoint2D pt : ctrlPts) pt.setLocation(pt.verticalSymmetry(origin)); arrowHead1.getPosition().setLocation(arrowHead1.getPosition().verticalSymmetry(origin)); arrowHead2.getPosition().setLocation(arrowHead2.getPosition().verticalSymmetry(origin)); super.mirrorVertical(origin); updateSecondControlPoints(); updateShape(); updateBorders(); } @Override public void updateToGrid(MagneticGrid grid) { super.updateToGrid(grid); for(LaTeXDrawPoint2D pt : ctrlPts) pt.setLocation(grid.getTransformedPointToGrid(pt, false)); updateBorders(); updateShape(); } /** * @return The borders of the Bézier curve but without the control points, just the curve. */ public Rectangle2D getBezierBorders() { if(getNbPoints()<2 || ctrlPts==null || ctrlPts.size()<2) return new Rectangle2D.Double(); Vector points = new Vector(); points.add(pts.elementAt(0)); points.add(ctrlPts.elementAt(0)); points.add(ctrlPts.elementAt(1)); points.add(pts.elementAt(1)); double[] minMax = getBezierCurveMinMax(points, 3); return new Rectangle2D.Double(minMax[0], minMax[1], minMax[2]-minMax[0], minMax[3]-minMax[1]); } /** * Define the min and the max coordinates of the borders of the Bézier curve. * @param points The initial control points. * @param level The level of resolution. * @return The maximum and the minimum coordinates of the Bézier curve; * [minX, minY, maxX, maxY] */ protected double[] getBezierCurveMinMax(Vector points, int level) { if(level<=0) { double x1 = points.elementAt(0).x + 0.5; double y1 = points.elementAt(0).y + 0.5; double x2 = points.elementAt(3).x + 0.5; double y2 = points.elementAt(3).y + 0.5; return new double[]{Math.min(x1, x2), Math.min(y1, y2), Math.max(x1, x2), Math.max(y1, y2)}; } Vector left = new Vector(); Vector right = new Vector(); LaTeXDrawPoint2D l1 = new LaTeXDrawPoint2D(), l2 = new LaTeXDrawPoint2D(); LaTeXDrawPoint2D l3 = new LaTeXDrawPoint2D(), l4 = new LaTeXDrawPoint2D(); LaTeXDrawPoint2D r1 = new LaTeXDrawPoint2D(), r2 = new LaTeXDrawPoint2D(); LaTeXDrawPoint2D r3 = new LaTeXDrawPoint2D(), r4 = new LaTeXDrawPoint2D(); LaTeXDrawPoint2D p0 = points.elementAt(0); LaTeXDrawPoint2D p1 = points.elementAt(1); LaTeXDrawPoint2D p2 = points.elementAt(2); LaTeXDrawPoint2D p3 = points.elementAt(3); l1.x = p0.x; l1.y = p0.y; l2.x = (p0.x + p1.x) / 2; l2.y = (p0.y + p1.y) / 2; l3.x = (p0.x + 2*p1.x + p2.x) / 4; l3.y = (p0.y + 2*p1.y + p2.y) / 4; l4.x = (p0.x + 3*p1.x + 3*p2.x + p3.x) / 8; l4.y = (p0.y + 3*p1.y + 3*p2.y + p3.y) / 8; r1.x = p3.x; r1.y = p3.y; r2.x = (p1.x + 2*p2.x + p3.x) / 4; r2.y = (p1.y + 2*p2.y + p3.y) / 4; r3.x = (p2.x + p3.x) / 2; r3.y = (p2.y + p3.y) / 2; r4.x = p3.x; r4.y = p3.y; left.add(l1); left.add(l2); left.add(l3); left.add(l4); right.add(r1); right.add(r2); right.add(r3); right.add(r4); double mmLeft[] = getBezierCurveMinMax(left, level-1); double mmRight[] = getBezierCurveMinMax(right, level-1); return new double[] {Math.min(mmLeft[0], mmRight[0]), Math.min(mmLeft[1], mmRight[1]), Math.max(mmLeft[2], mmRight[2]), Math.max(mmLeft[3], mmRight[3])}; } /** * Create a list of choice in order to select the type of closing of the curve. * @return The created list. * @since 1.9 */ public static LaTeXDrawComboBox createTypeChoice() { LaTeXDrawComboBox typeChoice = new LaTeXDrawComboBox(); typeChoice.setRenderer(new LabelListCellRenderer()); typeChoice.setName(LABEL_CLOSE_CHOICE); typeChoice.setActionCommand(LABEL_CLOSE_CHOICE); JLabel l = new JLabel(String.valueOf(CLOSE_TYPE_CURVE)); l.setIcon(LaTeXDrawResources.closeCurveIcon); typeChoice.addItem(l); l = new JLabel(String.valueOf(CLOSE_TYPE_LINE)); l.setIcon(LaTeXDrawResources.closeLineIcon); typeChoice.addItem(l); return typeChoice; } /** * @return the open. * @since 1.9 */ public synchronized boolean isOpen() { return open; } /** * @param open the open to set.
    When the curve is closed, it cannot have double boundaries yet. * @since 1.9 */ public synchronized void setOpen(boolean open) { this.open = open; updateShape(); } /** * @return the closeType. * @since 1.9 */ public synchronized int getCloseType() { return closeType; } /** * @param closeType the closeType to set. * @since 1.9 * @exception IllegalArgumentException If the type is not valid. */ public synchronized void setCloseType(int closeType) { if(closeType==CLOSE_TYPE_CURVE || closeType==CLOSE_TYPE_LINE) { this.closeType = closeType; updateShape(); } else throw new IllegalArgumentException(); } @Override public int getSelectedDelimitorOrientation() { int del = super.getSelectedDelimitorOrientation(); if(del!=DELIMITOR_ORIENTATION_NONE) return del; boolean again = true; int i, size = pts.size(); if(size<2) return DELIMITOR_ORIENTATION_NONE; again = ctrlLines.firstElement().delimiters.lastElement()!=dSelected && ctrlLines.lastElement().delimiters.lastElement()!=dSelected; if(!open) again &= secondCtrlLines.firstElement().delimiters.lastElement()!=dSelected && secondCtrlLines.lastElement().delimiters.lastElement()!=dSelected; for(i=1; i=getNbPoints()) throw new IllegalArgumentException(); ctrlPts.elementAt(id).x = x; secondCtrlPts.elementAt(id).setLocation(ctrlPts.elementAt(id).centralSymmetry(pts.elementAt(id))); updateBorders(); updateShape(); } /** * Set the Y-coordinate of one of the first control point. * @param y The new Y-coordinate. * @param id The position of the point to set. * @since 1.9 */ public void setYCoordFirstCtrl(double y, int id) { if(id<0 || id>=getNbPoints()) throw new IllegalArgumentException(); ctrlPts.elementAt(id).y = y; secondCtrlPts.elementAt(id).setLocation(ctrlPts.elementAt(id).centralSymmetry(pts.elementAt(id))); updateBorders(); updateShape(); } /** * Set the X-coordinate of one of the second control point. * @param x The new X-coordinate. * @param id The position of the point to set. * @since 1.9 */ public void setXCoordSecondCtrl(double x, int id) { if(id<0 || id>=getNbPoints()) throw new IllegalArgumentException(); LaTeXDrawPoint2D pt = secondCtrlPts.elementAt(id); pt.x = x; ctrlPts.elementAt(id).setLocation(pt.centralSymmetry(pts.elementAt(id))); updateBorders(); updateShape(); } /** * Set the Y-coordinate of one of the second control point. * @param y The new Y-coordinate. * @param id The position of the point to set. * @since 1.9 */ public void setYCoordSecondCtrl(double y, int id) { if(id<0 || id>=getNbPoints()) throw new IllegalArgumentException(); LaTeXDrawPoint2D pt = secondCtrlPts.elementAt(id); pt.y = y; ctrlPts.elementAt(id).setLocation(pt.centralSymmetry(pts.elementAt(id))); updateBorders(); updateShape(); } /** * Balance all the control points in order the create a round curve. * @since 1.9 */ public void equilibrate() { int size = pts.size(); if(size>2)//Works only with more than 2 points. { Vector lines = new Vector(); int i; for(i=0; i1) { LaTeXDrawPoint2D oldCtrl1 = ctrlPts.firstElement(); if(oldCtrl1.distance(ctrlP[0]) pt2.distance(pts.elementAt(i-1))) { LaTeXDrawPoint2D tmp = new LaTeXDrawPoint2D(pt1); pt1.setLocation(pt2); pt2.setLocation(tmp); } } if(!open) {// We treat the first point (if the curve is closed). pt1 = ctrlPts.firstElement(); pt2 = secondCtrlPts.firstElement(); // A loop can occurred only when the two control points are outside the shape. if(!outline.contains(pt1) && !outline.contains(pt2)) // The first control point must be closer than the second control point // to the previous point. Else we invert them. if(pt1.distance(pts.elementAt(1)) > pt2.distance(pts.elementAt(1))) { LaTeXDrawPoint2D tmp = new LaTeXDrawPoint2D(pt1); pt1.setLocation(pt2); pt2.setLocation(tmp); } } updateShape(); }catch(Exception e) { e.printStackTrace(); } } } /** * @return the equilibrateGap. * @since 1.9 */ public synchronized int getEquilibrateGap() { return equilibrateGap; } /** * @param equilibrateGap the equilibrateGap to set. * @exception IllegalArgumentException If the value is lesser than 1. * @since 1.9 */ public synchronized void setEquilibrateGap(int equilibrateGap) { if(equilibrateGap<1) throw new IllegalArgumentException(); this.equilibrateGap = equilibrateGap; } /** * Check if the two Bézier curves have, at least, one extremity in common; if it is the case, * the control points must be symmetric. Curves are not considered as joined if at the joining point * there is an arrow. * @param bc The second Bézier curve. * @return 1, if the two Bézier curves have, at least, one extremity in common and symmetric * control points;
    * 0, if the two Bézier curves don't have any extremity shared;
    * 2, if they have an extremity shared but the control points are not symmetric. * @since 1.9 */ public int isJoined(BezierCurve bc) { boolean isStrictJoined = false; boolean isJoined = false; boolean hasB1NoArrow1 = arrowHead1.isWithoutStyle(); boolean hasB1NoArrow2 = arrowHead2.isWithoutStyle(); boolean hasB2NoArrow1 = bc.arrowHead1.isWithoutStyle(); boolean hasB2NoArrow2 = bc.arrowHead2.isWithoutStyle(); if(pts.firstElement().equals(bc.pts.firstElement(), 0.0001) && hasB1NoArrow1 && hasB2NoArrow1) { isJoined = true; if(ctrlPts.firstElement().equals(bc.secondCtrlPts.firstElement(), 5)) isStrictJoined = true; } if(pts.firstElement().equals(bc.pts.lastElement(), 0.0001) && hasB1NoArrow1 && hasB2NoArrow2) { isJoined = true; if(ctrlPts.firstElement().equals(bc.secondCtrlPts.lastElement(), 5)) isStrictJoined = true; } if(pts.lastElement().equals(bc.pts.firstElement(), 0.0001) && hasB1NoArrow2 && hasB2NoArrow1) { isJoined = true; if(ctrlPts.lastElement().equals(bc.secondCtrlPts.firstElement(), 5)) isStrictJoined = true; } if(pts.lastElement().equals(bc.pts.lastElement(), 0.0001) && hasB1NoArrow2 && hasB2NoArrow2) { isJoined = true; if(ctrlPts.lastElement().equals(bc.secondCtrlPts.lastElement(), 5)) isStrictJoined = true; } if(isStrictJoined && isJoined) return 1; if(isJoined) return 2; return 0; } /** * Join the second curve to the first (the second curve is not changed, points are added to the first); * if they are at all joined, two points are added to the given * curve. If they are joined at one point and if at this point the controls points are symmetric, * only one point is added; if the control points are not symmetric, a point is added to solve this * problem. * TODO For the moment only the case where the Bézier curve have a point in common and if at this * point the control points are symmetric is managed. * @param bc The Bézier curve to * @since 1.9 */ public void join(BezierCurve bc) { if(bc==null) throw new IllegalArgumentException(); switch(isJoined(bc)) { case 0: break; case 1: LaTeXDrawPoint2D p1a = pts.firstElement(), p1b = pts.lastElement(); LaTeXDrawPoint2D p2a = bc.pts.firstElement(), p2b = bc.pts.lastElement(); int i, size = bc.pts.size(); if(p1b.equals(p2b, 0.0001) && ctrlPts.lastElement().equals(bc.secondCtrlPts.lastElement(), 5)) { for(i=size-2; i>=0; i--) { addPoint((LaTeXDrawPoint2D)bc.pts.elementAt(i).clone()); ctrlPts.lastElement().setLocation(bc.ctrlPts.elementAt(i)); } if(!bc.arrowHead2.isWithoutStyle() && arrowHead2.isWithoutStyle()) arrowHead2.copyArrowParameters(bc.arrowHead1); if(!bc.arrowHead1.isWithoutStyle() && arrowHead1.isWithoutStyle()) arrowHead1.copyArrowParameters(bc.arrowHead2); } else if(p1a.equals(p2a, 0.0001) && ctrlPts.firstElement().equals(bc.secondCtrlPts.firstElement(), 5)) { ctrlPts.firstElement().setLocation(secondCtrlPts.firstElement()); for(i=1; i=0; i--) { addPointAt((LaTeXDrawPoint2D)bc.pts.elementAt(i).clone(), 0); ctrlPts.firstElement().setLocation(bc.ctrlPts.elementAt(i)); } if(!bc.arrowHead2.isWithoutStyle() && arrowHead2.isWithoutStyle()) arrowHead2.copyArrowParameters(bc.arrowHead2); if(!bc.arrowHead1.isWithoutStyle() && arrowHead1.isWithoutStyle()) arrowHead1.copyArrowParameters(bc.arrowHead1); } else if(p1b.equals(p2a, 0.0001) && ctrlPts.lastElement().equals(bc.secondCtrlPts.firstElement(), 5)) { for(i=1; iopen is set the false). * @since 1.9 */ public void replaceLastPointByClosing() { if(pts.firstElement().equals(pts.lastElement(), 1) && ctrlPts.firstElement().equals(secondCtrlPts.lastElement(), 5) && getNbPoints()>1) { int last = pts.size()-1; pts.remove(last); ctrlPts.remove(last); secondCtrlPts.remove(last); secondCtrlLines.remove(last); ctrlLines.remove(last); delimiters.remove(last); LaTeXDrawPoint2D pt = new LaTeXDrawPoint2D(pts.lastElement()); arrowHead2.setPosition(pt); arrowHead2.setLine(new Line(pt, ctrlPts.lastElement(), false)); setOpen(false); updateShape(); } } @Override public int hashCode() { return super.hashCode()*5; } /** * @param line The line to check. * @return True if the given line closes the Bézier curve (and return false if the line is null or if * the curve is closed). * @since 1.9 */ public boolean isLineClosingCurve(Line line) { if(line==null || !isOpen()) return false; LaTeXDrawPoint2D pt1 = line.getPt1(); LaTeXDrawPoint2D pt2 = line.getPt2(); LaTeXDrawPoint2D pt1b = pts.firstElement(); LaTeXDrawPoint2D pt2b = pts.lastElement(); double gap = 0.0001; return (pt1.equals(pt1b, gap) && pt2.equals(pt2b, gap)) || (pt1.equals(pt2b, gap) && pt2.equals(pt1b, gap)); } @Override public void setPoint(double x, double y, int id) { if(id<0 || id>=pts.size()) throw new IllegalArgumentException(); LaTeXDrawPoint2D old = (LaTeXDrawPoint2D)pts.elementAt(id).clone(); super.setPoint(x, y, id); double diffX = pts.elementAt(id).x - old.x; double diffY = pts.elementAt(id).y - old.y; ctrlPts.elementAt(id).x += diffX; ctrlPts.elementAt(id).y += diffY; secondCtrlPts.elementAt(id).x += diffX; secondCtrlPts.elementAt(id).y += diffY; if(id==0) arrowHead1.getPosition().setLocation(x, y); else if(id==pts.size()-1) arrowHead2.getPosition().setLocation(x, y); updateShape(); updateBorders(); updateGravityCenter(); } /** * @see #setPoint(double, double, int) * @param moveAll True: the control point move too. * @since 1.9.2 */ public void setPoint(double x, double y, int id, boolean moveAll) { if(moveAll) setPoint(x, y, id); if(id<0 || id>=pts.size()) throw new IllegalArgumentException(); super.setPoint(x, y, id); secondCtrlPts.elementAt(id).setLocation(ctrlPts.elementAt(id).centralSymmetry(pts.elementAt(id))); if(id==0) arrowHead1.getPosition().setLocation(x, y); else if(id==pts.size()-1) arrowHead2.getPosition().setLocation(x, y); updateShape(); updateBorders(); updateGravityCenter(); } /** * @param bc The given curve. * @return 1 if, the given curve closes the initial curve and if their control points coincide. * 0, if the given curve closes the initial curve but if one of the control points of the closure * does not coincide. -1 if the given curve does not close the initial curve.
    * It does not take care of the arrows. * @since 1.9 */ public int isCurveClosingCurve(BezierCurve bc) { if(pts.firstElement().equals(bc.pts.firstElement(), 5) && pts.lastElement().equals(bc.pts.lastElement(), 5)) { if(ctrlPts.firstElement().equals(bc.secondCtrlPts.firstElement(), 5) && ctrlPts.lastElement().equals(bc.secondCtrlPts.lastElement(), 5)) return 1; return 0; } if(pts.firstElement().equals(bc.pts.lastElement(), 5) && pts.lastElement().equals(bc.pts.firstElement(), 5)) { if(ctrlPts.firstElement().equals(bc.secondCtrlPts.lastElement(), 5) && ctrlPts.lastElement().equals(bc.secondCtrlPts.firstElement(), 5)) return 1; return 0; } return -1; } public boolean hasTwoLeftArrows() { return true; } @Override public boolean intersected(Rectangle2D.Double r) { if(r==null) return false; BasicStroke wideline = new BasicStroke(hasDoubleBoundary() ? (float)(thickness*2+doubleSep) : thickness); Shape outline = wideline.createStrokedShape(shape); boolean ok = outline.intersects(r); if(!ok && isOpen() && (isFilled() || isHatched() || hasGradient())) { Line2D.Double l = new Line2D.Double(pts.firstElement(), pts.lastElement()); if(l.intersects(r)) ok = true; } return ok; } @Override public boolean shadowFillsShape() { return false; } } latexdraw-2.0.8+1.orig/latexDraw/figures/Picture.java0000644000000000000000000003114711347255510017363 0ustar package latexDraw.figures; import java.awt.Graphics2D; import java.awt.Image; import java.awt.Point; import java.awt.Shape; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import latexDraw.lang.LaTeXDrawLang; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.ui.components.MagneticGrid; import latexDraw.util.LaTeXDrawException; import latexDraw.util.LaTeXDrawNumber; import latexDraw.util.LaTeXDrawPoint2D; import latexDraw.util.LaTeXDrawResources; import org.sourceforge.jlibeps.epsgraphics.EpsGraphics2D; /** * This class defines a kind of figure: a picture.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version.
    *
    * LaTeXDraw is distributed without any warranty; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details.
    *
    * 02/03/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class Picture extends Figure { private static final long serialVersionUID = 1L; /** The position of the picture */ protected LaTeXDrawPoint2D position; /** The picture */ protected transient Image picture; /** The path of the picture */ protected String pathTarget; /** The path of the source picture */ protected String pathSource; public Picture(boolean increaseMeter) { super(increaseMeter); canHaveShadow = false; isBordersMovable = false; isCustomizable = false; isDashableOrDotable = false; isDoubleBoundaryable = false; isResizable = false; isThicknessable = false; canBeFilled = false; position = new LaTeXDrawPoint2D(); borders = new LaTeXDrawRectangle(false); } /** * The constructor by default * @param increaseMeter True: the figure will increase the number of figures * @param pathSource The path of the source picture. */ public Picture(boolean increaseMeter, String pathSource) { this(increaseMeter, new LaTeXDrawPoint2D(), pathSource); } /** * The constructor taking the position of the picture * @param increaseMeter True: the figure will increase the number of figures * @param p The position of the figure * @param pathSource The path of the source picture */ public Picture(boolean increaseMeter, LaTeXDrawPoint2D p, String pathSource) { this(increaseMeter); if(pathSource==null) throw new IllegalArgumentException(); if(p==null) p = new LaTeXDrawPoint2D(); position = p; this.pathSource = pathSource; picture = getImage(); createEPSImage(); borders = new LaTeXDrawRectangle((LaTeXDrawPoint2D)position.clone(), new LaTeXDrawPoint2D( position.x+picture.getWidth(null), position.x+picture.getHeight(null)), false); borders.setIsFilled(true); updateShape(); } @Override protected void finalize() throws Throwable { picture.flush(); super.finalize(); } /** * @return An AWT image from the source path or null. * @since 2.0.0 */ public Image getImage() { return pathSource==null ? null : LaTeXDrawFrame.convertFrame.getImage(new File(pathSource)); } /** * Creates an EPS. * @throws IllegalArgumentException If the writing is not possible. * @since 2.0.0 */ public void createEPSImage() { if(pathSource==null || picture==null) return ; int indexName = pathSource.lastIndexOf(File.separator)+1; String name = pathSource.substring(indexName, pathSource.lastIndexOf('.'))+LaTeXDrawResources.EPS_EXTENSION; String dirPath = pathSource.substring(0, indexName); pathTarget = dirPath+name; File file = new File(pathTarget); boolean created; try {// We create the output file that will contains the eps picture. created = file.createNewFile(); }catch(IOException ex) { created = false; } // If created is false, it may mean that the file already exist. if(!created && !file.canWrite()) { pathTarget = LaTeXDrawFrame.getPathExport()+File.separator+name; file = new File(pathTarget); } try { // Within jlibeps, graphics are defined using 72 DPI (72/2.54=28,3465 PPC), but latexdraw uses 50 PPC. // That's why, we need the scale the graphics to have a 50 PPC eps picture. double scale = 72. / PSTricksConstants.INCH_VAL_CM / Figure.PPC;// 72 DPI / 2.54 / 50 PPC FileOutputStream finalImage = new FileOutputStream(file); EpsGraphics2D g = new EpsGraphics2D("LaTeXDrawPicture", finalImage, 0, 0, //$NON-NLS-1$ (int)(picture.getWidth(null)*scale), (int)(picture.getHeight(null)*scale)); g.scale(scale, scale); g.drawImage(picture, 0, 0, null); g.flush(); g.close(); finalImage.close(); } catch(Exception e) { throw new IllegalArgumentException(); } } @Override public Shape createShape2D() { if(borders==null) return null; return borders.shape; } @Override public Shape createNonRotatedShape2D() { if(borders==null) return null; return borders.createNonRotatedShape2D(); } @Override public void onDragged(Point formerPt, Point newPt) throws Exception { if(formerPt.equals(newPt)) return; if(isOnRotation&&borders.dSelected!=null) { borders.onDragged(formerPt, newPt); rotationAngle = borders.getRotationAngle(); } else shift(formerPt, newPt); updateShape(); } @Override public void draw(Graphics2D g, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering) { LaTeXDrawPoint2D NW = getTheNWPoint(), SE = getTheSEPoint(); double cx = (NW.x+SE.x)/2., cy = (NW.y+SE.y)/2.; double c2x = Math.cos(rotationAngle)*cx-Math.sin(rotationAngle)*cy; double c2y = Math.sin(rotationAngle)*cx+Math.cos(rotationAngle)*cy; double c3x = Math.cos(-rotationAngle)*(cx-c2x)-Math.sin(-rotationAngle)*(cy-c2y); double c3y = Math.sin(-rotationAngle)*(cx-c2x)+Math.cos(-rotationAngle)*(cy-c2y); if(rotationAngle%(Math.PI*2)!=0) { g.rotate(rotationAngle); g.translate(c3x, c3y); } g.drawImage(picture, (int)position.x, (int)position.y, null); if(rotationAngle%(Math.PI*2)!=0) { g.translate(-c3x, -c3y); g.rotate(-rotationAngle); } if(isSelected) borders.draw(g, false, antiAlias, rendering, alphaInter, colorRendering); } @Override @Deprecated public void setLastPoint(double x, double y) { // empty method } @Override @Deprecated public void setFirstPoint(double x, double y) { // empty method } @Override public void shift(double shiftX, double shiftY) { if(position!=null) { position.x += shiftX; position.y += shiftY; } if(borders!=null) borders.shift(shiftX, shiftY); updateShape(); } @Override @Deprecated public void rescaleX(double formerX, double newX, double percent, LaTeXDrawRectangle bound) { // not rescalable } @Override @Deprecated public void rescaleY(double formerY, double newY, double percent, LaTeXDrawRectangle bound) { // not rescalable } @Override public boolean isIn(LaTeXDrawPoint2D pt) { if(borders==null) return false; return borders.isIn(pt); } @Override public synchronized String getCodePSTricks(DrawBorders drawBorders, float ppc) { if(picture==null) return null; double threshold = 0.001; String addBegin = "", addEnd = ""; //$NON-NLS-1$ //$NON-NLS-2$ LaTeXDrawPoint2D d = drawBorders.getOriginPoint(); LaTeXDrawPoint2D NW = borders.getTheNWPoint(); LaTeXDrawPoint2D SE = borders.getTheSEPoint(); float x = LaTeXDrawNumber.getCutNumber((float)((position.x+(SE.x-NW.x)/2.-d.x)/ppc),threshold); float y = LaTeXDrawNumber.getCutNumber((float)(((d.y-position.y-(SE.y-NW.y)/2.)/ppc)),threshold); if(rotationAngle%(Math.PI*2)!=0.) { double angle = -Math.toDegrees(rotationAngle); double cx = (gravityCenter.x-d.x)/ppc; double cy = (d.y-gravityCenter.y)/ppc; double x2 = -Math.cos(-rotationAngle)*cx+Math.sin(-rotationAngle)*cy+cx; double y2 = -Math.sin(-rotationAngle)*cx-Math.cos(-rotationAngle)*cy+cy; addBegin += "\\rput{"+(float)angle+"}("+LaTeXDrawNumber.getCutNumber((float)x2,threshold)+','+LaTeXDrawNumber.getCutNumber((float)y2,threshold)+"){"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addEnd = "}"; //$NON-NLS-1$ } String path2 = pathTarget; path2 = path2.replaceAll("\\\\", "/");//$NON-NLS-1$ //$NON-NLS-2$ if(path2.contains(" "))//$NON-NLS-1$ addBegin += LaTeXDrawLang.getString1_6("Picture.0") //$NON-NLS-1$ +System.getProperty("line.separator").charAt(0);//$NON-NLS-1$ return addBegin+"\\rput("+x+","+y+"){"+ //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ "\\includegraphics{"+path2+"}}"+addEnd; //$NON-NLS-1$ //$NON-NLS-2$ } /** * @return the picture */ public synchronized Image getPicture() { return picture; } /** * @param picture the picture to set */ public synchronized void setPicture(Image picture) { if(picture!=null) this.picture = picture; } /** * @return the position */ public synchronized LaTeXDrawPoint2D getPosition() { return position; } /** * @param position the position to set */ public synchronized void setPosition(LaTeXDrawPoint2D position) { if(position!=null) this.position = position; } @Override public Object clone() throws CloneNotSupportedException { Picture p = (Picture)super.clone(); p.borders = (LaTeXDrawRectangle)borders.clone(); p.position = (LaTeXDrawPoint2D)position.clone(); p.pathSource = pathSource; p.pathTarget = pathTarget; p.updateShape(); return p; } /** * @return the path of the target picture. */ public synchronized String getPathTarget() { return pathTarget; } /** * @param path the path of the target picture to set. */ public synchronized void setPathTarget(String path) { this.pathTarget = path; } private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException, LaTeXDrawException { isSelected = ois.readBoolean(); isOnRotation = ois.readBoolean(); borders = (LaTeXDrawRectangle)ois.readObject(); position = (LaTeXDrawPoint2D)ois.readObject(); pathTarget = (String)ois.readObject(); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.9.5")>=0)//$NON-NLS-1$ pathSource = (String)ois.readObject(); else pathSource = pathTarget; gravityCenter = borders.getGravityCenter(); try { picture = LaTeXDrawFrame.convertFrame.getImage(new File(pathSource)); if(picture==null || picture.getWidth(null)<1 || picture.getHeight(null)<1) throw new LaTeXDrawException(LaTeXDrawException.INVALID_PICTURE); } catch(Exception e) { throw new LaTeXDrawException(LaTeXDrawException.INVALID_PICTURE); } } @Override public void updateShape() { updateGravityCenter(); shape = createShape2D(); } @Override public boolean isTooSmallToBeRescaled() { return true; } @Override public void mirrorHorizontal(LaTeXDrawPoint2D origin) {// Fixes #1564477 borders.mirrorHorizontal(origin); position.setLocation(borders.getTheNWPoint().x, position.y); updateShape(); } @Override public void mirrorVertical(LaTeXDrawPoint2D origin) {// Fixes #1564477 borders.mirrorVertical(origin); position.setLocation(position.x, borders.getTheNWPoint().y); updateShape(); } @Override @Deprecated public LaTeXDrawPoint2D getLastPoint() { return null; } @Override public void updateToGrid(MagneticGrid grid) { position.setLocation(grid.getTransformedPointToGrid(position, false)); } @Override public int getSelectedDelimitorOrientation() { return DELIMITOR_ORIENTATION_NONE; } @Override public int hashCode() { return super.hashCode()+picture.hashCode(); } /** * @return the pathSource. * @since 2.0.0 */ public synchronized String getPathSource() { return pathSource; } /** * @param pathSource the pathSource to set. * @since 2.0.0 */ public synchronized void setPathSource(String pathSource) { this.pathSource = pathSource; } } latexdraw-2.0.8+1.orig/latexDraw/figures/GridShape.java0000644000000000000000000002260011347255510017610 0ustar package latexDraw.figures; import java.awt.*; import java.awt.image.BufferedImage; import latexDraw.util.LaTeXDrawPoint2D; /** * This abstract class defines a general model of a grid; it can be used to define * a grid or axes for instance.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 14/08/06
    * @author Arnaud BLOUIN
    * @since 1.8
    * @version 2.0.0
    */ public abstract class GridShape extends Figure { private static final long serialVersionUID = 1L; /** If true, the x label will be displayed at the south of the grid. Else at the north */ protected boolean isXLabelSouth; /** If true, the y label will be displayed at the west of the grid. Else at the east */ protected boolean isYLabelWest; /** The minimum values of the axes */ protected LaTeXDrawPoint2D gridStart; /** The maximum values of the axes */ protected LaTeXDrawPoint2D gridEnd; /** The position of the SW point of the grid in the drawpanel */ protected LaTeXDrawPoint2D position; /** The origin of the grid */ protected LaTeXDrawPoint2D origin; /** The current font*/ protected Font font; /** The current font metrics of the text */ protected FontMetrics fontMetrics; /** The value by default of isXLabelSouth */ public static final boolean DEFAULT_ISXLABELSOUTH = true; /** The value by default of isYLabelWest */ public static final boolean DEFAULT_ISYLABELWEST = true; /** The origin of the grid by default */ public static final LaTeXDrawPoint2D DEFAULT_ORIGIN = new LaTeXDrawPoint2D(0,0); /** The minimum points of the grid by default */ public static final LaTeXDrawPoint2D DEFAULT_GRIDMIN = (LaTeXDrawPoint2D)DEFAULT_ORIGIN.clone(); /** The maximum points of the grid by default */ public static final LaTeXDrawPoint2D DEFAULT_GRIDMAX = new LaTeXDrawPoint2D(2,2); protected GridShape(LaTeXDrawPoint2D pos, boolean increaseMeter) { super(increaseMeter); canHaveShadow = false; canBeFilled = false; isBordersMovable = false; isDashableOrDotable = false; isDoubleBoundaryable = false; isThicknessable = false; isResizable = false; position = pos; isXLabelSouth = DEFAULT_ISXLABELSOUTH; isYLabelWest = DEFAULT_ISYLABELWEST; origin = (LaTeXDrawPoint2D)DEFAULT_ORIGIN.clone(); gridStart = (LaTeXDrawPoint2D)DEFAULT_GRIDMIN.clone(); gridEnd = (LaTeXDrawPoint2D)DEFAULT_GRIDMAX.clone(); } @Override public Object clone() throws CloneNotSupportedException { GridShape g = (GridShape)super.clone(); g.borders = (LaTeXDrawRectangle)borders.clone(); g.gridEnd = (LaTeXDrawPoint2D)gridEnd.clone(); g.gridStart = (LaTeXDrawPoint2D)gridStart.clone(); g.origin = (LaTeXDrawPoint2D)origin.clone(); g.position = (LaTeXDrawPoint2D)position.clone(); g.gravityCenter = g.borders.getGravityCenter(); g.isXLabelSouth = isXLabelSouth; g.isYLabelWest = isYLabelWest; g.shape = g.createShape2D(); return g; } @Override public Shape createNonRotatedShape2D() { return borders.createNonRotatedShape2D(); } @Override public Shape createShape2D() { if(borders==null) updateBorders(); return borders.createShape2D(); } public abstract void updateBorders(); @Override public abstract void draw(Graphics2D g, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering); @Override public abstract String getCodePSTricks(DrawBorders drawBorders, float ppc); @Override public boolean isIn(LaTeXDrawPoint2D pt) { if(borders==null) return false; return borders.isIn(pt); } @Override public boolean isTooSmallToBeRescaled() { return true; } @Override public void mirrorHorizontal(LaTeXDrawPoint2D orig) { updateBorders(); borders.mirrorHorizontal(orig); position.setLocation(borders.getTheNWPoint().x, position.y); updateBorders(fontMetrics); } public abstract void updateBorders(FontMetrics fm); @Override public void mirrorVertical(LaTeXDrawPoint2D orig) { updateBorders(); borders.mirrorVertical(orig); position.setLocation(position.x, borders.getTheSEPoint().y); updateBorders(fontMetrics); } @Override public void onDragged(Point formerPt, Point newPt) { if(formerPt.equals(newPt)) return; if(isOnRotation && borders.dSelected!=null) { borders.onDragged(formerPt, newPt); shape = createShape2D(); rotationAngle = borders.getRotationAngle(); } else shift(formerPt, newPt); gravityCenter = borders.getGravityCenter(); } @Override @Deprecated public void rescaleX(double formerX, double newX, double percent, LaTeXDrawRectangle bound) { /* * This function is disable */ } @Override @Deprecated public void rescaleY(double formerY, double newY, double percent, LaTeXDrawRectangle bound) { /* * This function is disable */ } @Override @Deprecated public void setLastPoint(double x, double y) { /* * This function is disable */ } @Override @Deprecated public void setFirstPoint(double x, double y) { /* * This function is disable */ } @Override public void shift(double shiftX, double shiftY) { if(position!=null) { position.x+=shiftX; position.y+=shiftY; updateBorders(getFontMetrics()); } } @Override public void updateShape() { shape = createShape2D(); } /** * @param x The x-coordinate to set. */ public synchronized void setGridEndX(int x) { if(x>=gridStart.x) gridEnd.x = x; } /** * @param y The y-coordinate to set. */ public synchronized void setGridEndY(int y) { if(y>=gridStart.y) gridEnd.y = y; } /** * @return the isXLabelSouth. */ public synchronized boolean isXLabelSouth() { return isXLabelSouth; } /** * @param isXLabelSouth the isXLabelSouth to set. */ public synchronized void setXLabelSouth(boolean isXLabelSouth) { this.isXLabelSouth = isXLabelSouth; } /** * @return the isYLabelWest. */ public synchronized boolean isYLabelWest() { return isYLabelWest; } /** * @param isYLabelWest the isYLabelWest to set. */ public synchronized void setYLabelWest(boolean isYLabelWest) { this.isYLabelWest = isYLabelWest; } /** * @return the gridStart. */ public synchronized LaTeXDrawPoint2D getGridStart() { return gridStart; } /** * @param gridStart the gridStart to set. */ public synchronized void setGridStart(LaTeXDrawPoint2D gridStart) { this.gridStart = gridStart; } /** * @return the gridEnd. */ public synchronized LaTeXDrawPoint2D getGridEnd() { return gridEnd; } /** * @param gridEnd the gridEnd to set. */ public synchronized void setGridEnd(LaTeXDrawPoint2D gridEnd) { this.gridEnd = gridEnd; } /** * @return the position. */ public synchronized LaTeXDrawPoint2D getPosition() { return position; } /** * @param position the position to set. */ public synchronized void setPosition(LaTeXDrawPoint2D position) { this.position = position; } /** * @return the origin. */ public synchronized LaTeXDrawPoint2D getOrigin() { return origin; } /** * @param origin the origin to set. */ public synchronized void setOrigin(LaTeXDrawPoint2D origin) { this.origin = origin; } /** * @param y The y-coordinate to set. */ public synchronized void setGridStartY(int y) { if(y<=gridEnd.y) gridStart.y = y; } /** * @param x The x-coordinate to set. */ public synchronized void setGridStartX(int x) { if(x<=gridEnd.x) gridStart.x = x; } /** * @param x The X-coordinate to set. */ public synchronized void setOriginX(int x) { origin.x = x; } /** * @param y The Y-coordinate to set. */ public synchronized void setOriginY(int y) { origin.y = y; } /** * @return the fontMetrics */ public synchronized FontMetrics getFontMetrics() { return fontMetrics; } /** * Allows to update the Font and the FontMetrics. */ public synchronized void updateFonts() { BufferedImage bufferImage = new BufferedImage(2, 2, BufferedImage.TYPE_INT_RGB); Graphics2D g = bufferImage.createGraphics(); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setFont(getFont()); fontMetrics = g.getFontMetrics(); g.dispose(); bufferImage.flush(); g = null; bufferImage = null; } /** * @return the font */ public synchronized Font getFont() { return font; } @Override @Deprecated public LaTeXDrawPoint2D getLastPoint() { return null; } } latexdraw-2.0.8+1.orig/latexDraw/figures/Ellipse.java0000644000000000000000000006205611347255510017350 0ustar package latexDraw.figures; import java.awt.*; import java.awt.geom.*; import java.io.IOException; import java.io.ObjectInputStream; import latexDraw.figures.properties.BordersMovable; import latexDraw.figures.properties.DoubleBoundaryable; import latexDraw.psTricks.DviPsColors; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.ui.components.MagneticGrid; import latexDraw.util.LaTeXDrawNumber; import latexDraw.util.LaTeXDrawPoint2D; /** * This class defines an Ellipse.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class Ellipse extends Figure implements BordersMovable, DoubleBoundaryable { private static final long serialVersionUID = 1L; /** * The constructor by default */ public Ellipse(boolean increaseMeter) { this(new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), increaseMeter); } /** * The constructor using four points * @param pt1 The top left point of rectangle containing the ellipse * @param pt2 The top right point of the rectangle containing the ellipse * @param pt3 The bottom left point * @param pt4 The bottom right point */ public Ellipse(LaTeXDrawPoint2D pt1, LaTeXDrawPoint2D pt2, LaTeXDrawPoint2D pt3, LaTeXDrawPoint2D pt4, boolean increaseMeter) { super(increaseMeter); borders = new LaTeXDrawRectangle(pt1, pt2, pt3, pt4, false); updateGravityCenter(); shape = getInsideOutsideOrMiddleBorders(); } /** * @param f The figure to copy * @param sameNumber True if the figure will have the same number of the copy. */ public Ellipse(Figure f, boolean sameNumber) { super(f, sameNumber); try { borders = new LaTeXDrawRectangle((LaTeXDrawPoint2D)f.getBordersPoint(0).clone(), (LaTeXDrawPoint2D)f.getBordersPoint(-1).clone(), false); updateGravityCenter(); updateShape(); LaTeXDrawPoint2D nw = borders.getTheNWPoint(); LaTeXDrawPoint2D cg = getGravityCenter(); double c = Math.abs(cg.x-nw.x)*3./2.25; double a = (Math.sqrt((cg.x-nw.x+c)*(cg.x-nw.x+c)+((cg.y-nw.y)*(cg.y-nw.y)))+ Math.sqrt((cg.x-nw.x-c)*(cg.x-nw.x-c)+((cg.y-nw.y)*(cg.y-nw.y))))/2.; double b = Math.sqrt(a*a-c*c); borders.setFirstPoint(cg.x-a, cg.y-b); borders.setLastPoint(cg.x+a, cg.y+b); } catch (Exception e) { borders = new LaTeXDrawRectangle(false); } updateGravityCenter(); updateShape(); } @Override public void onDragged(Point formerPt, Point newPt) { if(formerPt.equals(newPt)) return; borders.onDragged(formerPt, newPt); rotationAngle = borders.getRotationAngle();//update the angle(when rotation) updateGravityCenter();//update centre of gravity when reshaping shape = getInsideOutsideOrMiddleBorders(); } @Override public void draw(Graphics2D g, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering) { LaTeXDrawPoint2D NW = borders.getTheNWPoint(), SE = borders.getTheSEPoint(); Color formerCol = g.getColor(); double cx = (NW.x+SE.x)/2., cy = (NW.y+SE.y)/2.; double c2x = Math.cos(rotationAngle)*cx - Math.sin(rotationAngle)*cy; double c2y = Math.sin(rotationAngle)*cx + Math.cos(rotationAngle)*cy; double c3x = Math.cos(-rotationAngle)*(cx-c2x) - Math.sin(-rotationAngle)*(cy-c2y); double c3y = Math.sin(-rotationAngle)*(cx-c2x) + Math.cos(-rotationAngle)*(cy-c2y); double dx=0, dy=0; boolean changeFillStyle = false; if(rotationAngle%(Math.PI*2)!=0) { g.rotate(rotationAngle); g.translate(c3x,c3y); } if(hasShadow) { LaTeXDrawPoint2D cg = getGravityCenter(); LaTeXDrawPoint2D shadowCg = (LaTeXDrawPoint2D)cg.clone(); shadowCg.setLocation(cg.x+shadowSize, cg.y); shadowCg = Figure.rotatePoint(shadowCg, cg, shadowAngle); dx = shadowCg.x-cg.x; dy = cg.y-shadowCg.y; } if(hasDoubleBoundary) { Shape s0 = shape; Shape s[] = getDbleBoundariesOutInOrMiddle(s0); Shape s1, s2, s3; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) { s1 = s0; s2 = s[0]; s3 = s[1]; } else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) { s1 = s[0]; s2 = s0; s3 = s[1]; } else { s1 = s[0]; s2 = s[1]; s3 = s0; } Shape sTooSmall = getTooSmallShape(s1); if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); if(hasShadow) { g.translate(dx, dy); g.setColor(shadowColor); g.fill(s1); if(sTooSmall==null) g.draw(s1); else g.draw(sTooSmall); g.translate(-dx, -dy); if(!isFilled) { changeFillStyle = true; isFilled = true; } } g.setColor(doubleColor); g.setStroke(new BasicStroke((float)(doubleSep + thickness), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.draw(s2); fillFigure(g, antiAlias, rendering, alphaInter, colorRendering, s3); g.setColor(linesColor); g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); if(sTooSmall==null) g.draw(s1); else g.draw(sTooSmall); g.draw(s3); } else { if(hasShadow) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.fill(s1); if(sTooSmall==null) g.draw(s1); else g.draw(sTooSmall); g.translate(-dx, -dy); g.setColor(interiorColor); g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.draw(s2); if(!isFilled) { changeFillStyle = true; isFilled = true; } } if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[] { 0, (float)(thickness*2+doubleSep + dotSep) }, 0)); else g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[] { blackDashLength, whiteDashLength }, 0)); fillFigure(g, antiAlias, rendering, alphaInter, colorRendering, s2); g.setColor(linesColor); Shape sTooSmall2 = getTooSmallShape(s2); if(sTooSmall2==null) g.draw(s2); else g.draw(sTooSmall2); g.setStroke(new BasicStroke((float)doubleSep, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.setColor(doubleColor); if(sTooSmall2==null) g.draw(s2); else g.draw(sTooSmall2); } } else { Shape sTooSmall = getTooSmallShape(shape); if(hasShadow) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.fill(shape); if(sTooSmall==null) g.draw(shape); else g.draw(sTooSmall); g.translate(-dx, -dy); if(!isFilled) { changeFillStyle = true; isFilled = true; } g.setColor(interiorColor); g.draw(shape); } if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); else if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[] { 0, thickness + dotSep }, 0)); } else g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[] { blackDashLength, whiteDashLength }, 0)); fillFigure(g, antiAlias, rendering, alphaInter, colorRendering, shape); g.setColor(linesColor); if(sTooSmall==null) g.draw(shape); else g.draw(sTooSmall); } if(changeFillStyle) isFilled = false; g.setColor(formerCol); if(rotationAngle%(Math.PI*2)!=0) { g.translate(-c3x, -c3y); g.rotate(-rotationAngle); } if(isSelected) borders.draw(g, false, antiAlias, rendering, alphaInter, colorRendering); } @Override public synchronized void setLastPoint(double x, double y) { borders.setLastPoint(x, y); updateGravityCenter(); shape = getInsideOutsideOrMiddleBorders(); } @Override public synchronized void setFirstPoint(double x, double y) { borders.setFirstPoint(x, y); updateGravityCenter(); shape = getInsideOutsideOrMiddleBorders(); } @Override public synchronized void setBordersPosition(String doubleLinePosition) { super.setBordersPosition(doubleLinePosition); shape = getInsideOutsideOrMiddleBorders(); } @Override public boolean isIn(LaTeXDrawPoint2D p) { LaTeXDrawPoint2D pt = rotateInvertPoint(p); if(isSelected && (borders.dNE.isIn(pt) || borders.dNW.isIn(pt) || borders.dSE.isIn(pt) || borders.dSW.isIn(pt) || borders.dS.isIn(pt) || borders.dN.isIn(pt) || borders.dE.isIn(pt) || borders.dW.isIn(pt))) return true; LaTeXDrawPoint2D NW = getTheNWNonRotatedBoundPoint(); LaTeXDrawPoint2D SE = getTheSENonRotatedBoundPoint(); Shape s = new Ellipse2D.Double(NW.x, NW.y, Math.abs(NW.x - SE.x), Math.abs(NW.y - SE.y)); Rectangle2D bounds = s.getBounds2D(); if(bounds.getHeight()<=1) { Line l; if(bounds.getWidth()<=1) l = new Line(bounds.getMaxX(), Math.max(1, bounds.getMaxY()), bounds.getMaxX(), Math.max(1, bounds.getMaxY()), false); else l = new Line(bounds.getMinX(), Math.max(1, bounds.getMinY()), bounds.getMaxX(), Math.max(1, bounds.getMaxY()), false); return l.isIn(pt); } if(bounds.getWidth()<=1) { Line l = new Line(Math.max(1, bounds.getMaxX()), bounds.getMinY(), Math.max(1, bounds.getMaxX()), bounds.getMaxY(), false); return l.isIn(pt); } if(!s.contains(pt)) return false; if(isFilled || hasShadow || hasGradient()) return true; Shape s2; if(hasDoubleBoundary) s2 = new Ellipse2D.Double(NW.x + thickness * 2 + doubleSep, NW.y + thickness * 2 + doubleSep, Math.abs(NW.x - SE.x)- 4 * thickness - 2 * doubleSep, Math.abs(NW.y- SE.y) - 4 * thickness - 2 * doubleSep); else s2 = new Ellipse2D.Double(NW.x + thickness, NW.y + thickness, Math.abs(NW.x - SE.x) - 2 * thickness, Math.abs(NW.y- SE.y)- 2 * thickness); return !s2.contains(pt); } @Override public String getCodePSTricks(DrawBorders drawBorders, float ppc) { LaTeXDrawPoint2D d = drawBorders.getOriginPoint(); LaTeXDrawPoint2D pt1 = borders.getPoint(0), pt2 = borders.getPoint(1); LaTeXDrawPoint2D pt3 = borders.getPoint(2); String add = "", addBegin="", addEnd="", fillType=""; //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-4$ double x = (pt1.x+pt2.x)/2. - d.x, y = d.y - (pt1.y+pt3.y)/2. ; double width = Math.abs(pt1.x-pt2.x); double height = Math.abs(pt1.y-pt3.y); boolean isFilledWasChanged = false; double threshold = 0.001; if(hasShadow) { fillType+=",shadow=true";//$NON-NLS-1$ if(Math.toDegrees(shadowAngle)!=PSTricksConstants.DEFAULT_SHADOW_ANGLE) fillType+=",shadowangle="+(float)Math.toDegrees(shadowAngle);//$NON-NLS-1$ if(((float)shadowSize)!=((float)DEFAULT_SHADOW_SIZE)) fillType+=",shadowsize="+LaTeXDrawNumber.getCutNumber((float)(shadowSize/PPC),threshold);//$NON-NLS-1$ if(!shadowColor.equals(PSTricksConstants.DEFAULT_SHADOW_COLOR)) { String name = DviPsColors.getColourName(shadowColor); if(name==null) { name = "color"+number+'e';//$NON-NLS-1$ DviPsColors.addUserColour(shadowColor, name); } add += ",shadowcolor=" + name; //$NON-NLS-1$ } if(!isFilled) { isFilled = true; isFilledWasChanged = true; } } String str = getPSTricksCodeFilling(ppc); if(str.length()>0) fillType=fillType+','+str; str = getPSTricksCodeLine(ppc); if(str.length()>0) add=add+','+str; if(rotationAngle%(Math.PI*2)!=0.) { double angle = -Math.toDegrees(rotationAngle); double cx = (gravityCenter.x-d.x)/ppc; double cy = (d.y-gravityCenter.y)/ppc; double x2 = -Math.cos(-rotationAngle)*cx+ Math.sin(-rotationAngle)*cy+cx; double y2 = -Math.sin(-rotationAngle)*cx- Math.cos(-rotationAngle)*cy+cy; addBegin +="\\rput{"+(float)angle+ "}("+LaTeXDrawNumber.getCutNumber((float)x2,threshold)+','+LaTeXDrawNumber.getCutNumber((float)y2,threshold)+"){"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addEnd = "}"; //$NON-NLS-1$ } add+=",dimen="+bordersPosition; //$NON-NLS-1$ if(hasDoubleBoundary) { add+=",doubleline=true,doublesep="+LaTeXDrawNumber.getCutNumber((float)(doubleSep/ppc),threshold); //$NON-NLS-1$ if(doubleColor!=PSTricksConstants.DEFAULT_DOUBLE_COLOR) { String name = DviPsColors.getColourName(doubleColor); if(name==null) { name = "color"+number+'d';//$NON-NLS-1$ DviPsColors.addUserColour(doubleColor, name); } add+= ",doublecolor="+name; //$NON-NLS-1$ } } if(isFilledWasChanged) isFilled = false; return addBegin+"\\psellipse[linewidth=" + (thickness/ppc) + //$NON-NLS-1$ add + fillType + "](" + LaTeXDrawNumber.getCutNumber((float)(x/ppc),threshold) + ',' + LaTeXDrawNumber.getCutNumber((float)(y/ppc),threshold) + ")(" //$NON-NLS-1$ //$NON-NLS-2$ + LaTeXDrawNumber.getCutNumber((float)((width/2.)/ppc),threshold) + ',' + LaTeXDrawNumber.getCutNumber((float)((height/2.)/ppc),threshold) + ')'+addEnd; } @Override public void shift(double shiftX,double shiftY) { if(shiftX==0 && shiftY==0) return ; borders.shift(shiftX, shiftY); updateGravityCenter(); shape = getInsideOutsideOrMiddleBorders(); } @Override public Object clone() throws CloneNotSupportedException { Ellipse e = (Ellipse) super.clone(); e.borders = (LaTeXDrawRectangle) borders.clone(); e.gravityCenter = (LaTeXDrawPoint2D)gravityCenter.clone(); e.shape = getInsideOutsideOrMiddleBorders(); return e; } @Override public Shape createShape2D() { LaTeXDrawPoint2D NW = getTheNWPoint(), SE = getTheSEPoint(); Shape area = createNonRotatedShape2D(); if(rotationAngle%(Math.PI*2)!=0) { double cx = (NW.x+SE.x)/2., cy = (NW.y+SE.y)/2.; double c2x = Math.cos(rotationAngle)*cx-Math.sin(rotationAngle)*cy; double c2y = Math.sin(rotationAngle)*cx+Math.cos(rotationAngle)*cy; AffineTransform at = AffineTransform.getTranslateInstance(cx-c2x, cy-c2y); at.rotate(rotationAngle); area = at.createTransformedShape(area); } return area; } @Override public void rescaleX(double formerX, double newX, double percent, LaTeXDrawRectangle bound) { if(percent==1.) return ; borders.rescaleX(formerX, newX, percent, bound); updateGravityCenter();//update centre of gravity when reshaping shape = getInsideOutsideOrMiddleBorders(); } @Override public void rescaleY(double formerY, double newY, double percent, LaTeXDrawRectangle bound) { if(percent==1.) return ; borders.rescaleY(formerY, newY, percent, bound); updateGravityCenter();//update centre of gravity when reshaping shape = getInsideOutsideOrMiddleBorders(); } private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { canHaveShadow = true; interiorColor = (Color) ois.readObject(); lineStyle = (String) ois.readObject(); rotationAngle = ois.readDouble(); thickness = ois.readFloat(); isFilled = ois.readBoolean(); isSelected = ois.readBoolean(); isOnRotation = ois.readBoolean(); linesColor = (Color) ois.readObject(); blackDashLength = ois.readFloat(); dotSep = ois.readFloat(); whiteDashLength = ois.readFloat(); borders = (LaTeXDrawRectangle) ois.readObject(); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.5")>=0)//$NON-NLS-1$ { hasDoubleBoundary = ois.readBoolean(); doubleColor = (Color)ois.readObject(); doubleSep = ois.readDouble(); bordersPosition = (String)ois.readObject(); if(!(LaTeXDrawFrame.getVersionOfFile().compareTo("1.6")>=0)) //$NON-NLS-1$ ois.readBoolean(); hatchingAngle = ois.readDouble(); hatchingColor = (Color)ois.readObject(); hatchingStyle = (String)ois.readObject(); hatchingWidth = ois.readFloat(); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.6") < 0)//$NON-NLS-1$ { if(hatchingStyle.equals(DECREPETED_FILL_CROSS)) hatchingStyle = PSTricksConstants.TOKEN_FILL_CROSSHATCH; else if(hatchingStyle.equals(DECREPETED_FILL_HORIZ)) hatchingStyle = PSTricksConstants.TOKEN_FILL_HLINES; else if(hatchingStyle.equals(DECREPETED_FILL_VERT)) hatchingStyle = PSTricksConstants.TOKEN_FILL_VLINES; else if(hatchingStyle.equals(DECREPETED_FILL_NO)) hatchingStyle = PSTricksConstants.TOKEN_FILL_NONE; } } else { hasDoubleBoundary = DEFAULT_HAS_DOUBLE_BOUNDARY; doubleColor = DEFAULT_DOUBLE_COLOR; doubleSep = DEFAULT_DOUBLESEP; bordersPosition = DEFAULT_BORDERS_POSITION; hatchingAngle = DEFAULT_HATCH_ANGLE; hatchingColor = DEFAULT_HATCH_COL; hatchingStyle = DEFAULT_HATCH_STYLE; hatchingWidth = DEFAULT_HATCH_WIDTH; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.7")>=0) //$NON-NLS-1$ { hasShadow = ois.readBoolean(); shadowAngle = ois.readDouble(); shadowSize = ois.readDouble(); shadowColor = (Color)ois.readObject(); gradientEndColor = (Color)ois.readObject(); gradientStartColor = (Color)ois.readObject(); gradientAngle = ois.readDouble(); gradientMidPoint = ois.readDouble(); } else { hasShadow = DEFAULT_SHADOW_HAS; shadowAngle = DEFAULT_SHADOW_ANGLE; shadowSize = DEFAULT_SHADOW_SIZE; shadowColor = DEFAULT_SHADOW_COLOR; gradientEndColor = PSTricksConstants.DEFAULT_GRADIENT_END_COLOR; gradientStartColor = PSTricksConstants.DEFAULT_GRADIENT_START_COLOR; gradientAngle = DEFAULT_GRADIENT_ANGLE; gradientMidPoint = DEFAULT_GRADIENT_MID_POINT; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.8")>=0) //$NON-NLS-1$ hatchingSep = ois.readDouble(); else hatchingSep = DEFAULT_HATCH_SEP; updateGravityCenter(); updateStyleOfDelimitors(); shape = getInsideOutsideOrMiddleBorders(); } /** * Allows to create the tangent to the ellipse at the point point * @param angle The position of the tangent point in radian * @param orientation Change the orientation of the tangent * @return The tangent */ public Line2D.Double getTangenteAt(double angle, boolean orientation) { Line2D.Double l = new Line2D.Double(); LaTeXDrawPoint2D NW = getTheNWPoint(); LaTeXDrawPoint2D SE = getTheSEPoint(); LaTeXDrawPoint2D grav = getGravityCenter(); LaTeXDrawPoint2D pt = rotatePoint(new LaTeXDrawPoint2D(SE.x, (SE.y+NW.y)/2.), -angle); double a = Math.abs(NW.x-grav.x); double b = Math.abs(NW.y-grav.y); double dec = 5.; l.x1 = pt.x; l.y1 = pt.y; if(((float)angle)%((float)Math.PI)<=0.01)//0. is not possible { l.x2 = pt.x; if(orientation) l.y2 = pt.y - dec; else l.y2 = pt.y + dec; } else { if(orientation) l.x2 = pt.x-dec; else l.x2 = pt.x+dec; if(((float)angle)%((float)Math.PI/2f)<=0.01)//0. is not possible l.y2 = pt.y; else l.y2 = - (b*(pt.x-grav.x)*(l.x2-pt.x))/(a*(pt.y-grav.y)) + pt.y; } return l; } public Shape getInsideBorders() { LaTeXDrawPoint2D NW = getTheNWPoint(), SE = getTheSEPoint(); return new Ellipse2D.Double(NW.x + thickness / 2., NW.y + thickness/ 2., Math.max(Math.abs(NW.x - SE.x) - thickness, 1), Math.max(Math.abs(NW.y - SE.y) - thickness, 1)); } public Shape getOutsideBorders() { LaTeXDrawPoint2D NW = getTheNWPoint(), SE = getTheSEPoint(); return new Ellipse2D.Double(NW.x - thickness / 2., NW.y - thickness/ 2., Math.max(Math.abs(NW.x - SE.x) + thickness, 1), Math.max(Math.abs(NW.y - SE.y) + thickness, 1)); } public Shape getMiddleBorders() { LaTeXDrawPoint2D NW = getTheNWPoint(), SE = getTheSEPoint(); return new Ellipse2D.Double(NW.x, NW.y, Math.max(Math.abs(NW.x - SE.x), 1), Math.max(Math.abs(NW.y - SE.y), 1)); } public Shape getInsideOutsideOrMiddleBorders() { Shape s; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) s = getInsideBorders(); else if(bordersPosition.equals(PSTricksConstants.BORDERS_OUTSIDE)) s = getOutsideBorders(); else s = getMiddleBorders(); return s; } public Shape[] getDbleBoundariesOutside(Shape classicBord) { if(classicBord == null) return null; Ellipse2D.Double r = (Ellipse2D.Double)classicBord; Shape[] s = new Shape[2]; s[0] = new Ellipse2D.Double(r.x - doubleSep - thickness, r.y- doubleSep - thickness, r.width + 2*(doubleSep + thickness), r.height + 2*(doubleSep + thickness)); s[1] = new Ellipse2D.Double(r.x - (doubleSep + thickness) / 2., r.y - (doubleSep + thickness) / 2., r.width + doubleSep+ thickness, r.height + doubleSep + thickness); return s; } public Shape[] getDbleBoundariesInside(Shape classicBord) { if(classicBord == null) return null; Ellipse2D.Double r = (Ellipse2D.Double)classicBord; Shape[] s = new Shape[2]; s[0] = new Ellipse2D.Double(r.x + (doubleSep + thickness) / 2., r.y + (doubleSep + thickness) / 2., r.width - doubleSep- thickness, r.height - doubleSep - thickness); s[1] = new Ellipse2D.Double(r.x + doubleSep + thickness, r.y + doubleSep + thickness, r.width - 2*(doubleSep + thickness), r.height - 2 * (doubleSep + thickness)); return s; } public Shape[] getDbleBoundariesMiddle(Shape classicBord) { if(classicBord == null) return null; Ellipse2D.Double r = (Ellipse2D.Double)classicBord; Shape[] s = new Shape[2]; double add = (doubleSep + thickness) / 2.; s[0] = new Ellipse2D.Double(r.x - add, r.y - add, r.width + doubleSep + thickness, r.height + doubleSep + thickness); s[1] = new Ellipse2D.Double(r.x + add, r.y + add, r.width - doubleSep - thickness, r.height - doubleSep - thickness); return s; } public Shape[] getDbleBoundariesOutInOrMiddle(Shape classicBord) { Shape[] s; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) s = getDbleBoundariesInside(classicBord); else if(bordersPosition.equals(PSTricksConstants.BORDERS_OUTSIDE)) s = getDbleBoundariesOutside(classicBord); else s = getDbleBoundariesMiddle(classicBord); return s; } @Override public Shape createNonRotatedShape2D() { Shape area; Shape s = getInsideOutsideOrMiddleBorders(); if(hasDoubleBoundary) { Shape[] s2 = getDbleBoundariesOutInOrMiddle(s); Shape min; Shape max; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) { max = s; min = s2[1]; } else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) { max = s2[0]; min = s2[1]; } else { max = s2[0]; min = s; } area = new Area(max); ((Area)area).exclusiveOr(new Area(min)); Shape tooSmallShape = getTooSmallShape(area); if(tooSmallShape!=null) { Rectangle2D bounds = max.getBounds2D(); area = new Line2D.Double(Math.max(1, bounds.getMinX()), Math.max(1, bounds.getMinY()), Math.max(1, bounds.getMaxX()), Math.max(1, bounds.getMaxY())); } } else area = s; return area; } @Override public synchronized void setThickness(float value) { super.setThickness(value); shape = getInsideOutsideOrMiddleBorders(); } @Override public void updateShape() { shape = getInsideOutsideOrMiddleBorders(); } @Override public boolean isTooSmallToBeRescaled() { return borders.isTooSmallToBeRescaled(); } @Override public Shape createShadowShape() { if(!canHaveShadow || !hasShadow) return shape; Rectangle2D b = createShape2D().getBounds2D(); double dx=0, dy=0; LaTeXDrawPoint2D cg = getGravityCenter(); LaTeXDrawPoint2D shadowCg = (LaTeXDrawPoint2D)cg.clone(); shadowCg.setLocation(cg.x+shadowSize, cg.y); shadowCg = Figure.rotatePoint(shadowCg, cg, shadowAngle); dx = shadowCg.x-cg.x; dy = cg.y-shadowCg.y; return new Ellipse2D.Double(b.getX()+dx-thickness/2.,b.getY()+dy-thickness/2., b.getWidth()+thickness, b.getHeight()+thickness); } @Override public void mirrorHorizontal(LaTeXDrawPoint2D origin) { borders.mirrorHorizontal(origin); updateShape(); } @Override public void mirrorVertical(LaTeXDrawPoint2D origin) { borders.mirrorVertical(origin); updateShape(); } @Override public synchronized LaTeXDrawPoint2D getLastPoint() { return borders.getLastPoint(); } @Override public void updateToGrid(MagneticGrid grid) { borders.updateToGrid(grid); updateShape(); } @Override public int getSelectedDelimitorOrientation() { return borders.getSelectedDelimitorOrientation(); } @Override public int hashCode() { return (int)(super.hashCode()*1.5); } } latexdraw-2.0.8+1.orig/latexDraw/figures/properties/0000755000000000000000000000000011347255510017273 5ustar latexdraw-2.0.8+1.orig/latexDraw/figures/properties/DoubleBoundaryable.java0000644000000000000000000000421511347255510023702 0ustar package latexDraw.figures.properties; import java.awt.Shape; /** * This class define a properties of figures : if the figure can have * double boundaries, then these methods allows the user to get the two of * three borders of the double boundaries (the third boundary is the classic * borders of the figure). *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public interface DoubleBoundaryable { /** * Allows to get the two others borders of the double boundary * @param classicBord The initial border * @return The two others borders of the double boundary (shape[0] is the * bigger of the two borders). */ public Shape[] getDbleBoundariesOutside(Shape classicBord); /** * Allows to get the two others borders of the double boundary * @param classicBord The initial border * @return The two others borders of the double boundary (shape[0] is the * bigger of the two borders). */ public Shape[] getDbleBoundariesInside(Shape classicBord); /** * Allows to get the two others borders of the double boundary * @param classicBord The initial border * @return The two others borders of the double boundary (shape[0] is the * bigger of the two borders). */ public Shape[] getDbleBoundariesMiddle(Shape classicBord); /** * Allows to get the two others borders of the figure according to the position * of the borders: inside, outside or in the middle. * @return The two others borders */ public Shape[] getDbleBoundariesOutInOrMiddle(Shape classicBord); } latexdraw-2.0.8+1.orig/latexDraw/figures/properties/Drawable.java0000644000000000000000000000254111347255510021661 0ustar package latexDraw.figures.properties; import java.awt.Graphics2D; import latexDraw.figures.LaTeXDrawRectangle; import latexDraw.util.LaTeXDrawException; /** * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/01/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public interface Drawable { /** * Allows to draw the figure. * @param g The graphic * @param antiAlias The antialiasing value * @param rendering The rendering value * @param alphaInter The alphainterpolation value * @param colorRendering The colour rendering value * @throws LaTeXDrawException */ public void draw(Graphics2D g, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering) throws Exception; /** * @return The borders of the drawn figure. */ public LaTeXDrawRectangle getBorders(); } latexdraw-2.0.8+1.orig/latexDraw/figures/properties/Arrowable.java0000644000000000000000000000316611347255510022062 0ustar package latexDraw.figures.properties; import latexDraw.figures.ArrowHead; /** * This class defines a property of figures: if a shape can have (two) arrows, this interface * defines the prototype of the methods for the management of these arrows.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 07/25/06
    * @author Arnaud BLOUIN
    * @since 1.8
    * @version 2.0.0
    */ public interface Arrowable { /** Allows to get the style of the first arrow. */ public String getArrow1Style(); /** Allows to get the style of the second arrow. */ public String getArrow2Style(); /** Allows to get the first arrow. */ public ArrowHead getArrowHead1(); /** Allows to get the second arrow. */ public ArrowHead getArrowHead2(); /** Allows to set the first arrow. */ public void setArrow1Style(String style); /** Allows to set the first arrow. */ public void setArrow2Style(String style); /** Some figures like joined-lines, axes, Bézier curves, have not a left arrow and a right arrow but two left arrows. */ public boolean hasTwoLeftArrows(); } latexdraw-2.0.8+1.orig/latexDraw/figures/properties/BordersMovable.java0000644000000000000000000000212211347255510023041 0ustar package latexDraw.figures.properties; import java.awt.Shape; /** * This class defines a properties of figures: if the borders can move, * these methods allow the user to get the different positions of the * borders.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public interface BordersMovable { public Shape getInsideBorders(); public Shape getOutsideBorders(); public Shape getMiddleBorders(); public Shape getInsideOutsideOrMiddleBorders(); } latexdraw-2.0.8+1.orig/latexDraw/figures/ArrowHead.java0000644000000000000000000012654111347255510017627 0ustar /* * ArrowHead.java */ package latexDraw.figures; import java.awt.*; import java.awt.geom.AffineTransform; import java.awt.geom.Arc2D; import java.awt.geom.Ellipse2D; import java.awt.geom.Line2D; import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; import javax.swing.JLabel; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.components.LaTeXDrawComboBox; import latexDraw.ui.components.LabelListCellRenderer; import latexDraw.util.LaTeXDrawNumber; import latexDraw.util.LaTeXDrawPoint2D; import latexDraw.util.LaTeXDrawResources; /** * This class defines an arrowhead.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class ArrowHead implements Serializable, Cloneable { private static final long serialVersionUID = 1L; public static final double DEFAULT_ARROW_SIZE_DIM = PSTricksConstants.DEFAULT_ARROW_SIZE_DIM*Figure.PPC; public static final double DEFAULT_ARROW_SIZE_NUM = PSTricksConstants.DEFAULT_ARROW_SIZE_NUM; public static final double DEFAULT_ARROW_LGTH = PSTricksConstants.DEFAULT_ARROW_LENGTH; public static final double DEFAULT_ARROW_INSET = PSTricksConstants.DEFAULT_ARROW_INSET; public static final double DEFAULT_DOT_SIZE_DIM = PSTricksConstants.DEFAULT_ARROW_DOTSIZE_DIM*Figure.PPC; public static final double DEFAULT_DOT_SIZE_NUM = PSTricksConstants.DEFAULT_ARROW_DOTSIZE_NUM; public static final double DEFAULT_TBAR_SIZE_DIM = PSTricksConstants.DEFAULT_ARROW_TBARSIZE_DIM*Figure.PPC; public static final double DEFAULT_TBAR_SIZE_NUM = PSTricksConstants.DEFAULT_ARROW_TBARSIZE_NUM; public static final double DEFAULT_BRACKET_NUM = PSTricksConstants.DEFAULT_ARROW_BRACKET_LGTH; public static final double DEFAULT_RBRACKET_NUM = PSTricksConstants.DEFAULT_ARROW_RBRACKET_LGTH; public static final String DEFAULT_STYLE = PSTricksConstants.NONEARROW_STYLE; private Line line; private String currentArrowStyle; private LaTeXDrawPoint2D position; private double arrowSizeDim; private double arrowSizeNum; private double arrowLength; private double arrowInset; private double dotSizeDim; private double dotSizeNum; private double tBarSizeDim; private double tBarSizeNum; private double bracketNum; private double rBracketNum; /** The figure containing the arrow. @since 2.0.0 */ protected transient Figure figure; /** * The constructor taking an figure. * @param f The figure containing the arrow. * @throws IllegalArgumentException If f is null. */ public ArrowHead(Figure f) { this(new LaTeXDrawPoint2D(), new Line(false), f); } /** * The constructor taking a point. * @param position The position of the arrowhead. * @param l the line of the arrow. * @param f The figure containing the arrow. * @throws IllegalArgumentException If f is null. */ public ArrowHead(LaTeXDrawPoint2D position, Line l, Figure f) { if(f==null) throw new IllegalArgumentException(); figure = f; line = l; this.position = position; currentArrowStyle = DEFAULT_STYLE; arrowInset = DEFAULT_ARROW_INSET; arrowLength = DEFAULT_ARROW_LGTH; arrowSizeDim = DEFAULT_ARROW_SIZE_DIM; arrowSizeNum = DEFAULT_ARROW_SIZE_NUM; dotSizeDim = DEFAULT_DOT_SIZE_DIM; dotSizeNum = DEFAULT_DOT_SIZE_NUM; tBarSizeDim = DEFAULT_TBAR_SIZE_DIM; tBarSizeNum = DEFAULT_TBAR_SIZE_NUM; bracketNum = DEFAULT_BRACKET_NUM; rBracketNum = DEFAULT_RBRACKET_NUM; } /** * Allows to create a list of the different style of arrowhead (left) * @return The list */ public static LaTeXDrawComboBox createLeftArrowStyleList() { LaTeXDrawComboBox lineArrowLChoice = new LaTeXDrawComboBox(); lineArrowLChoice.setRenderer(new LabelListCellRenderer()); JLabel label = new JLabel(PSTricksConstants.NONEARROW_STYLE); label.setName(PSTricksConstants.NONEARROW_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleNoneLIcon); lineArrowLChoice.addItem(label); label = new JLabel(PSTricksConstants.BARIN_STYLE); label.setName(PSTricksConstants.BARIN_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleBarInLIcon); lineArrowLChoice.addItem(label); label = new JLabel(PSTricksConstants.BAREND_STYLE); label.setName(PSTricksConstants.BAREND_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleBarEndLIcon); lineArrowLChoice.addItem(label); label = new JLabel(PSTricksConstants.CIRCLEEND_STYLE); label.setName(PSTricksConstants.CIRCLEEND_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleCircleEndLIcon); lineArrowLChoice.addItem(label); label = new JLabel(PSTricksConstants.CIRCLEIN_STYLE); label.setName(PSTricksConstants.CIRCLEIN_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleCircleInLIcon); lineArrowLChoice.addItem(label); label = new JLabel(PSTricksConstants.DISKEND_STYLE); label.setName(PSTricksConstants.DISKEND_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleDiskEndLIcon); lineArrowLChoice.addItem(label); label = new JLabel(PSTricksConstants.DISKIN_STYLE); label.setName(PSTricksConstants.DISKIN_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleDiskInLIcon); lineArrowLChoice.addItem(label); label = new JLabel(PSTricksConstants.LARROW_STYLE); label.setName(PSTricksConstants.LARROW_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleArrowLIcon); lineArrowLChoice.addItem(label); label = new JLabel(PSTricksConstants.RARROW_STYLE); label.setName(PSTricksConstants.RARROW_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleRArrowLIcon); lineArrowLChoice.addItem(label); label = new JLabel(PSTricksConstants.LRBRACKET_STYLE); label.setName(PSTricksConstants.LRBRACKET_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleArcLIcon); lineArrowLChoice.addItem(label); label = new JLabel(PSTricksConstants.RRBRACKET_STYLE); label.setName(PSTricksConstants.RRBRACKET_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleArcLRIcon); lineArrowLChoice.addItem(label); label = new JLabel(PSTricksConstants.LSBRACKET_STYLE); label.setName(PSTricksConstants.LSBRACKET_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleBrackLIcon); lineArrowLChoice.addItem(label); label = new JLabel(PSTricksConstants.RSBRACKET_STYLE); label.setName(PSTricksConstants.RSBRACKET_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleBrackLRIcon); lineArrowLChoice.addItem(label); label = new JLabel(PSTricksConstants.DLARROW_STYLE); label.setName(PSTricksConstants.DLARROW_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleDbleArrowLIcon); lineArrowLChoice.addItem(label); label = new JLabel(PSTricksConstants.DRARROW_STYLE); label.setName(PSTricksConstants.DRARROW_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleRDbleArrowLIcon); lineArrowLChoice.addItem(label); label = new JLabel(PSTricksConstants.ROUNDIN_STYLE); label.setName(PSTricksConstants.ROUNDIN_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleRoundInLIcon); lineArrowLChoice.addItem(label); lineArrowLChoice.setPreferredSize(new Dimension(75, 30)); lineArrowLChoice.setSize(new Dimension(75, 30)); lineArrowLChoice.setMaximumSize(new Dimension(75, 30)); lineArrowLChoice.setMinimumSize(new Dimension(75, 30)); return lineArrowLChoice; } /** * Allows to create a list of the different style of arrowhead (right) * @return The list */ public static LaTeXDrawComboBox createRightArrowStyleList() { LaTeXDrawComboBox lineArrowRChoice = new LaTeXDrawComboBox(); lineArrowRChoice.setRenderer(new LabelListCellRenderer()); JLabel label = new JLabel(PSTricksConstants.NONEARROW_STYLE); label.setName(PSTricksConstants.NONEARROW_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleNoneRIcon); lineArrowRChoice.addItem(label); label = new JLabel(PSTricksConstants.BARIN_STYLE); label.setName(PSTricksConstants.BARIN_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleBarInRIcon); lineArrowRChoice.addItem(label); label = new JLabel(PSTricksConstants.BAREND_STYLE); label.setName(PSTricksConstants.BAREND_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleBarEndRIcon); lineArrowRChoice.addItem(label); label = new JLabel(PSTricksConstants.CIRCLEEND_STYLE); label.setName(PSTricksConstants.CIRCLEEND_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleCircleEndRIcon); lineArrowRChoice.addItem(label); label = new JLabel(PSTricksConstants.CIRCLEIN_STYLE); label.setName(PSTricksConstants.CIRCLEIN_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleCircleInRIcon); lineArrowRChoice.addItem(label); label = new JLabel(PSTricksConstants.DISKEND_STYLE); label.setName(PSTricksConstants.DISKEND_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleDiskEndRIcon); lineArrowRChoice.addItem(label); label = new JLabel(PSTricksConstants.DISKIN_STYLE); label.setName(PSTricksConstants.DISKIN_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleDiskInRIcon); lineArrowRChoice.addItem(label); label = new JLabel(PSTricksConstants.RARROW_STYLE); label.setName(PSTricksConstants.RARROW_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleArrowRIcon); lineArrowRChoice.addItem(label); label = new JLabel(PSTricksConstants.LARROW_STYLE); label.setName(PSTricksConstants.LARROW_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleRArrowRIcon); lineArrowRChoice.addItem(label); label = new JLabel(PSTricksConstants.RRBRACKET_STYLE); label.setName(PSTricksConstants.RRBRACKET_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleArcRIcon); lineArrowRChoice.addItem(label); label = new JLabel(PSTricksConstants.LRBRACKET_STYLE); label.setName(PSTricksConstants.LRBRACKET_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleArcRRIcon); lineArrowRChoice.addItem(label); label = new JLabel(PSTricksConstants.RSBRACKET_STYLE); label.setName(PSTricksConstants.RSBRACKET_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleBrackRIcon); lineArrowRChoice.addItem(label); label = new JLabel(PSTricksConstants.LSBRACKET_STYLE); label.setName(PSTricksConstants.LSBRACKET_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleBrackRRIcon); lineArrowRChoice.addItem(label); label = new JLabel(PSTricksConstants.DRARROW_STYLE); label.setName(PSTricksConstants.DRARROW_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleDbleArrowRIcon); lineArrowRChoice.addItem(label); label = new JLabel(PSTricksConstants.DLARROW_STYLE); label.setName(PSTricksConstants.DLARROW_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleRDbleArrowRIcon); lineArrowRChoice.addItem(label); label = new JLabel(PSTricksConstants.ROUNDIN_STYLE); label.setName(PSTricksConstants.ROUNDIN_STYLE); label.setIcon(LaTeXDrawResources.arrowStyleRoundInRIcon); lineArrowRChoice.addItem(label); lineArrowRChoice.setPreferredSize(new Dimension(75, 30)); lineArrowRChoice.setSize(new Dimension(75, 30)); lineArrowRChoice.setMaximumSize(new Dimension(75, 30)); lineArrowRChoice.setMinimumSize(new Dimension(75, 30)); return lineArrowRChoice; } /** * Allows to set the style of the right arrow of the line * @param style The new style of the right arrow of the line */ public synchronized void setArrowStyle(String style) { if(PSTricksConstants.isValidArrowStyle(style)) currentArrowStyle = style; } /** * Allows to get the style of the left arrow of the line * @return The style of the left arrow of the line */ public synchronized String getArrowStyle() { return currentArrowStyle; } /** * Allows to draw the arrowhead * @param g The graphics where the arrowhead is drawn * @param fColor The colour used to fill the circles. * @param asShadow If true, the arrow will be drawn as an arrow of the shadow figure. */ public void draw(Graphics2D g, Color fColor, boolean asShadow) { if(currentArrowStyle.equals(PSTricksConstants.NONEARROW_STYLE) || !isDrawable()) return; line.updateAandB(); LaTeXDrawPoint2D pt1 = line.getPt1(), pt2 = line.getPt2(); Color lineColor = asShadow ? figure.getShadowColor() : figure.getLinesColor(); Color fillColor = asShadow ? figure.getShadowColor() : fColor; float lineWidth = getThickness(); double x, y, lineAngle, b = line.getB(); lineAngle = Math.atan(line.getA()); double xRot,yRot, c2x, c2y, c3x, c3y; if(Math.abs(lineAngle)==(Math.PI/2.)) { yRot = position.y; xRot = position.x; double cx = position.x, cy = yRot; c2x = Math.cos(lineAngle)*cx - Math.sin(lineAngle)*cy; c2y = Math.sin(lineAngle)*cx + Math.cos(lineAngle)*cy; c3x = Math.cos(-lineAngle)*(cx-c2x) - Math.sin(-lineAngle)*(cy-c2y); c3y = Math.sin(-lineAngle)*(cx-c2x) + Math.cos(-lineAngle)*(cy-c2y); } else { xRot = Math.cos(-lineAngle)*position.x-Math.sin(-lineAngle)*(position.y-b); yRot = Math.sin(-lineAngle)*position.x+Math.cos(-lineAngle)*(position.y-b)+b; c2x = - Math.sin(lineAngle)*b; c2y = Math.cos(lineAngle)*b; c3x = Math.cos(-lineAngle)*(-c2x) - Math.sin(-lineAngle)*(b-c2y); c3y = Math.sin(-lineAngle)*(-c2x) + Math.cos(-lineAngle)*(b-c2y); } if(lineAngle%(Math.PI*2)!=0) { g.rotate(lineAngle); g.translate(c3x,c3y); } if(currentArrowStyle.equals(PSTricksConstants.CIRCLEEND_STYLE) || currentArrowStyle.equals(PSTricksConstants.DISKEND_STYLE)) { double arrowRadius = (dotSizeDim+dotSizeNum*lineWidth)/2.; x = xRot - arrowRadius+lineWidth/2.; y = yRot - arrowRadius+lineWidth/2.; if(currentArrowStyle.equals(PSTricksConstants.DISKEND_STYLE)) g.setColor(lineColor); else g.setColor(fillColor); g.fill(new Ellipse2D.Double(x, y, arrowRadius*2-lineWidth, arrowRadius*2-lineWidth)); g.setColor(lineColor); g.draw(new Ellipse2D.Double(x, y, arrowRadius*2-lineWidth, arrowRadius*2-lineWidth)); } else if(currentArrowStyle.equals(PSTricksConstants.CIRCLEIN_STYLE) || currentArrowStyle.equals(PSTricksConstants.DISKIN_STYLE)) { double arrowRadius = (dotSizeDim+dotSizeNum*lineWidth)/2.; if(position==pt1) { if(pt1.x=pt2.x) x = xRot+lineWidth/2.; else x = xRot-2*arrowRadius+lineWidth/2.; y = yRot - arrowRadius +lineWidth/2.; if(currentArrowStyle.equals(PSTricksConstants.DISKIN_STYLE)) g.setColor(lineColor); else g.setColor(fillColor); g.fill(new Ellipse2D.Double(x, y, arrowRadius*2-lineWidth, arrowRadius*2-lineWidth)); g.setColor(lineColor); g.draw(new Ellipse2D.Double(x, y, arrowRadius*2-lineWidth, arrowRadius*2-lineWidth)); } else if(currentArrowStyle.equals(PSTricksConstants.BARIN_STYLE) || currentArrowStyle.equals(PSTricksConstants.LSBRACKET_STYLE) || currentArrowStyle.equals(PSTricksConstants.RSBRACKET_STYLE)) { double width = tBarSizeDim + tBarSizeNum*lineWidth; double x1, x2, y1, y2; if((position==pt1 && pt1.x=pt2.x && currentArrowStyle.equals(PSTricksConstants.RSBRACKET_STYLE)) || (position==pt2 && pt2.x<=pt1.x && currentArrowStyle.equals(PSTricksConstants.RSBRACKET_STYLE)) || (position==pt2 && pt2.x>pt1.x && currentArrowStyle.equals(PSTricksConstants.LSBRACKET_STYLE))) { x3 = x1+lgth; x4 = x2+lgth; } else { x3 = x1-lgth; x4 = x2-lgth; } Stroke s = g.getStroke(); g.setStroke(new BasicStroke(lineWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER)); g.draw(new Line2D.Double(x1, y1+lineWidth/2., x3, y1+lineWidth/2.)); g.draw(new Line2D.Double(x2, y2-lineWidth/2., x4, y2-lineWidth/2.)); g.setStroke(s); } } else if(currentArrowStyle.equals(PSTricksConstants.BAREND_STYLE)) { double width = tBarSizeDim + tBarSizeNum*lineWidth; x = xRot; y = yRot; g.setColor(lineColor); g.draw(new Line2D.Double(x,y-width/2. ,x ,y+width/2.)); } else if(currentArrowStyle.equals(PSTricksConstants.RARROW_STYLE) || currentArrowStyle.equals(PSTricksConstants.LARROW_STYLE)) { double width = arrowSizeNum*lineWidth + arrowSizeDim, length = arrowLength*width, inset = arrowInset*length; int nbPts = 4, xs[] = new int[nbPts], ys[] = new int[nbPts]; if((position==pt1 && pt1.x=pt2.x && currentArrowStyle.equals(PSTricksConstants.RARROW_STYLE))) { xs[0] = (int)xRot; ys[0] = (int)yRot; xs[1] = (int)(xRot+length); ys[1] = (int)(yRot-width/2.); xs[3] = (int)(xRot+length); ys[3] = (int)(yRot+width/2.); xs[2] = (int)(xRot+length-inset); ys[2] = (int)yRot; g.setColor(lineColor); g.fillPolygon(xs, ys, nbPts); }else{ if((position==pt1 && pt1.x>=pt2.x && currentArrowStyle.equals(PSTricksConstants.LARROW_STYLE)) || (position==pt2 && pt1.x=pt2.x && currentArrowStyle.equals(PSTricksConstants.LARROW_STYLE))) { xs[0] = (int)(xRot+length); ys[0] = (int)yRot; xs[1] = (int)xRot; ys[1] = (int)(yRot-width/2.); xs[3] = (int)xRot; ys[3] = (int)(yRot+width/2.); xs[2] = (int)(xRot+inset); ys[2] = (int)yRot; g.setColor(lineColor); g.fillPolygon(xs, ys, nbPts); }else{ if((position==pt1 && pt1.x>=pt2.x && currentArrowStyle.equals(PSTricksConstants.RARROW_STYLE)) || (position==pt2 && pt1.x=pt2.x && currentArrowStyle.equals(PSTricksConstants.LRBRACKET_STYLE)) || (position==pt2 && pt2.x<=pt1.x && currentArrowStyle.equals(PSTricksConstants.LRBRACKET_STYLE)) || (position==pt2 && pt2.x>pt1.x && currentArrowStyle.equals(PSTricksConstants.RRBRACKET_STYLE))) { double cx = xRot, cy = yRot; double rotX = Math.cos(Math.PI)*cx - Math.sin(Math.PI)*cy; double rotY = Math.sin(Math.PI)*cx + Math.cos(Math.PI)*cy; AffineTransform at = AffineTransform.getTranslateInstance(cx-rotX, cy-rotY); at.rotate(Math.PI); s = at.createTransformedShape(s); } g.setColor(lineColor); Stroke stroke = g.getStroke(); g.setStroke(new BasicStroke(lineWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER)); g.draw(s); g.setStroke(stroke); } else if(currentArrowStyle.equals(PSTricksConstants.DLARROW_STYLE) || currentArrowStyle.equals(PSTricksConstants.DRARROW_STYLE)) { double width = arrowSizeNum*lineWidth+arrowSizeDim, length = arrowLength*width, inset = arrowInset*length; int nbPts = 4, xs[] = new int[nbPts], ys[] = new int[nbPts]; int xs2[] = new int[nbPts]; if((position==pt1 && pt1.x=pt2.x && currentArrowStyle.equals(PSTricksConstants.DRARROW_STYLE))) { xs[0] = (int)xRot; ys[0] = (int)yRot; xs[1] = (int)(xRot+length); ys[1] = (int)(yRot-width/2.); xs[3] = (int)(xRot+length); ys[3] = (int)(yRot+width/2.); xs[2] = (int)(xRot+length-inset); ys[2] = (int)yRot; xs2[0] = (int)(xRot+length); xs2[1] = (int)(xRot+2*length); xs2[3] = (int)(xRot+2*length); xs2[2] = (int)(xRot+2*length-inset); }else{ if((position==pt1 && pt1.x>=pt2.x && currentArrowStyle.equals(PSTricksConstants.DLARROW_STYLE)) || (position==pt2 && pt1.x=pt2.x && currentArrowStyle.equals(PSTricksConstants.DLARROW_STYLE))) { xs[0] = (int)(xRot+length); ys[0] = (int)yRot; xs[1] = (int)xRot; ys[1] = (int)(yRot-width/2.); xs[3] = (int)xRot; ys[3] = (int)(yRot+width/2.); xs[2] = (int)(xRot+inset); ys[2] = (int)yRot; xs2[0] = (int)(xRot+2*length); xs2[1] = (int)(xRot+length); xs2[3] = (int)(xRot+length); xs2[2] = (int)(xRot+length+inset); }else{ if((position==pt1 && pt1.x>=pt2.x && currentArrowStyle.equals(PSTricksConstants.DRARROW_STYLE)) || (position==pt2 && pt1.x=0) this.arrowInset = arrowInset; } /** * @return Returns the arrowSizeDim. */ public synchronized double getArrowSizeDim() { return arrowSizeDim; } /** * @param arrowSizeDim The arrowSizeDim to set. */ public synchronized void setArrowSizeDim(double arrowSizeDim) { if(arrowSizeDim>=0) this.arrowSizeDim = arrowSizeDim; } /** * @return Returns the arrowSizeNum. */ public synchronized double getArrowSizeNum() { return arrowSizeNum; } /** * @param arrowSizeNum The arrowSizeNum to set. */ public synchronized void setArrowSizeNum(double arrowSizeNum) { if(arrowSizeNum>=0.001) this.arrowSizeNum = arrowSizeNum; } /** * @return Returns the bracketNumRight. */ public synchronized double getBracketNum() { return bracketNum; } /** * @param bracketNum The bracketNumRight to set. */ public synchronized void setBracketNum(double bracketNum) { if(bracketNum>0.001) this.bracketNum = bracketNum; } /** * @return Returns the dotSizeDim. */ public synchronized double getDotSizeDim() { return dotSizeDim; } /** * @param dotSizeDim The dotSizeDim to set. */ public synchronized void setDotSizeDim(double dotSizeDim) { if(dotSizeDim>=0) this.dotSizeDim = dotSizeDim; } /** * @return Returns the dotSizeNum. */ public synchronized double getDotSizeNum() { return dotSizeNum; } /** * @param dotSizeNum The dotSizeNum to set. */ public synchronized void setDotSizeNum(double dotSizeNum) { if(dotSizeNum>=0.1) this.dotSizeNum = dotSizeNum; } /** * @return Returns the rBracketNum. */ public synchronized double getRBracketNum() { return rBracketNum; } /** * @param bracketNum The rBracketNum to set. */ public synchronized void setRBracketNum(double bracketNum) { if(bracketNum>=0.001) rBracketNum = bracketNum; } /** * @return Returns the tBarSizeDim. */ public synchronized double getTBarSizeDim() { return tBarSizeDim; } /** * @param barSizeDim The tBarSizeDim to set. */ public synchronized void setTBarSizeDim(double barSizeDim) { if(barSizeDim>=0) tBarSizeDim = barSizeDim; } /** * @return Returns the tBarSizeNum. */ public synchronized double getTBarSizeNum() { return tBarSizeNum; } /** * @param barSizeNum The tBarSizeNum to set. */ public synchronized void setTBarSizeNum(double barSizeNum) { if(tBarSizeDim>=0.1) tBarSizeNum = barSizeNum; } /** * @param arrowLength The arrowLength to set. */ public void setArrowLength(double arrowLength) { if(arrowLength>=0) this.arrowLength = arrowLength; } /** * @return Returns the line. */ public synchronized Line getLine() { return line; } /** * @param line The line to set. */ public synchronized void setLine(Line line) { if(line!=null) this.line = line; } /** * @return the arrowLength */ public double getArrowLength() { return arrowLength; } /** * @return True if the current style of the arrow is an arrow, a double arrow, ... */ public boolean needReduceLine() { return currentArrowStyle.equals(PSTricksConstants.RARROW_STYLE) || currentArrowStyle.equals(PSTricksConstants.LARROW_STYLE) || currentArrowStyle.equals(PSTricksConstants.DLARROW_STYLE) || currentArrowStyle.equals(PSTricksConstants.DRARROW_STYLE) || currentArrowStyle.equals(PSTricksConstants.RRBRACKET_STYLE) || currentArrowStyle.equals(PSTricksConstants.LRBRACKET_STYLE) || currentArrowStyle.equals(PSTricksConstants.RSBRACKET_STYLE) || currentArrowStyle.equals(PSTricksConstants.LSBRACKET_STYLE) || currentArrowStyle.equals(PSTricksConstants.ROUNDIN_STYLE); } @Override public boolean equals(Object o) { if(o instanceof ArrowHead) { ArrowHead ah2 = (ArrowHead)o; return ((float)ah2.getArrowInset())==((float)getArrowInset()) && ((float)ah2.getArrowLength())==((float)getArrowLength()) && ((float)ah2.getArrowSizeDim())==((float)getArrowSizeDim()) && ((float)ah2.getArrowSizeNum())==((float)getArrowSizeNum()) && ah2.getArrowStyle().equals(getArrowStyle()) && ((float)ah2.getBracketNum())==((float)getBracketNum()) && ((float)ah2.getDotSizeDim())==((float)getDotSizeDim()) && ((float)ah2.getDotSizeNum())==((float)getDotSizeNum()) && ((float)ah2.getRBracketNum())==((float)getRBracketNum()) && ((float)ah2.getTBarSizeDim())==((float)getTBarSizeDim()) && ((float)ah2.getTBarSizeNum())==((float)getTBarSizeNum()); } return false; } /** * @return True if the arrow has no style. * @since 1.9 */ public boolean isWithoutStyle() { return currentArrowStyle.equals(PSTricksConstants.NONEARROW_STYLE); } @Override public int hashCode() { return (int)(currentArrowStyle.hashCode()+getArrowInset()+getArrowLength()+ getRBracketNum()+getDotSizeDim()+getDotSizeDim()); } /** * @return The parameters of the dot shape (even if the arrow has not currently the dot shape). * @since 1.9 */ public String getDotParameters() { return "dotsize="+(float)(getDotSizeDim()/Figure.PPC)+"cm "+(float)getDotSizeNum(); //$NON-NLS-1$ //$NON-NLS-2$ } /** * @return True if the current shape of the arrow is a dot. * @since 1.9 */ public boolean isArrowShapeDot() { return currentArrowStyle.equals(PSTricksConstants.CIRCLEEND_STYLE) || currentArrowStyle.equals(PSTricksConstants.CIRCLEIN_STYLE) || currentArrowStyle.equals(PSTricksConstants.DISKEND_STYLE) || currentArrowStyle.equals(PSTricksConstants.DISKIN_STYLE); } /** * Copy the parameters of the arrowHead (style and parameters) a to the current arrowhead. * @param a The copied arrowhead * @since 1.9 */ public void copyArrowParameters(ArrowHead a) { arrowInset = a.arrowInset; arrowLength = a.arrowLength; arrowSizeDim = a.arrowSizeDim; arrowSizeNum = a.arrowSizeNum; bracketNum = a.bracketNum; currentArrowStyle = a.currentArrowStyle; dotSizeDim = a.dotSizeDim; dotSizeNum = a.dotSizeNum; rBracketNum = a.rBracketNum; tBarSizeDim = a.tBarSizeDim; tBarSizeNum = a.tBarSizeNum; arrowInset = a.arrowInset; arrowLength = a.arrowLength; arrowSizeDim = a.arrowSizeDim; arrowSizeNum = a.arrowSizeNum; } /** * Sometimes it is useful to have the inverse of an arrow style (e.g. when you have > or >> you * would like to get < or <<). * @param arrowS The arrow style to reverse. * @return The opposite of the given arrow. * @since 1.9.1 */ public static String invertArrowStyle(String arrowS) { if(arrowS.equals(PSTricksConstants.DLARROW_STYLE)) return PSTricksConstants.DRARROW_STYLE; if(arrowS.equals(PSTricksConstants.DRARROW_STYLE)) return PSTricksConstants.DLARROW_STYLE; if(arrowS.equals(PSTricksConstants.RARROW_STYLE)) return PSTricksConstants.LARROW_STYLE; if(arrowS.equals(PSTricksConstants.LARROW_STYLE)) return PSTricksConstants.RARROW_STYLE; if(arrowS.equals(PSTricksConstants.LRBRACKET_STYLE)) return PSTricksConstants.RRBRACKET_STYLE; if(arrowS.equals(PSTricksConstants.RRBRACKET_STYLE)) return PSTricksConstants.LRBRACKET_STYLE; if(arrowS.equals(PSTricksConstants.RSBRACKET_STYLE)) return PSTricksConstants.LSBRACKET_STYLE; if(arrowS.equals(PSTricksConstants.LSBRACKET_STYLE)) return PSTricksConstants.RSBRACKET_STYLE; if(arrowS.equals(PSTricksConstants.NONEARROW_STYLE)) return PSTricksConstants.NONEARROW_STYLE; return arrowS; } /** * @return True of the arrow can be drawn (if the two points of its line are not at the same location). * @since 1.9.4 */ public boolean isDrawable() { LaTeXDrawPoint2D pt1 = line.getPt1(), pt2 = line.getPt2(); return pt1!=pt2 && (pt1.x!=pt2.x || pt1.y!=pt2.y); } /** * @return the figure. * @since 2.0.0 */ public synchronized Figure getFigure() { return figure; } /** * @param figure the figure to set. * @throws IllegalArgumentException If figure is null. * @since 2.0.0 */ public synchronized void setFigure(Figure figure) { if(figure==null) throw new IllegalArgumentException(); this.figure = figure; } /** * @return The thickness of the arrowhead. * @since 2.0.0 */ public float getThickness() { return (float)(figure.hasDoubleBoundary() ? figure.getThickness()*2 + figure.getDoubleSep() : figure.getThickness()); } /** * @return True if the arrow style is inverted. * @since 2.0.0 */ public boolean isInverted() { LaTeXDrawPoint2D p1 = line.getPt1(); LaTeXDrawPoint2D p2 = line.getPt2(); LaTeXDrawPoint2D pos = getPosition(); if(currentArrowStyle.equals(PSTricksConstants.DLARROW_STYLE) || currentArrowStyle.equals(PSTricksConstants.LARROW_STYLE) || currentArrowStyle.equals(PSTricksConstants.LRBRACKET_STYLE) || currentArrowStyle.equals(PSTricksConstants.LSBRACKET_STYLE)) return pos==p1 ? false : true; if(currentArrowStyle.equals(PSTricksConstants.DRARROW_STYLE) || currentArrowStyle.equals(PSTricksConstants.RARROW_STYLE) || currentArrowStyle.equals(PSTricksConstants.RRBRACKET_STYLE) || currentArrowStyle.equals(PSTricksConstants.RSBRACKET_STYLE)) return pos==p2 ? false : true; return false; } /** * @return True if the arrow is a left arrow. * @since 2.0.0 */ public boolean isLeftArrow() { return line.getPt1()==position ? true : false; } } latexdraw-2.0.8+1.orig/latexDraw/figures/LaTeXDrawRectangle.java0000644000000000000000000012263711347255510021375 0ustar package latexDraw.figures; import static java.lang.Math.*; import java.awt.*; import java.awt.geom.*; import java.io.IOException; import java.io.ObjectInputStream; import java.util.Vector; import latexDraw.figures.properties.BordersMovable; import latexDraw.psTricks.DviPsColors; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.ui.components.Delimitor; import latexDraw.ui.components.MagneticGrid; import latexDraw.util.LaTeXDrawNumber; import latexDraw.util.LaTeXDrawPoint2D; /** * This class defines a Rectangle.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details.
    *
    * * 01/16/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class LaTeXDrawRectangle extends LaTeXDrawPolygon implements BordersMovable { private static final long serialVersionUID = 1L; /** The North-West delimiter (therefore it's possible that the delimiter not be a this position it's just a indication). */ protected Delimitor dNW; /** The South-East delimiter (therefore it's possible that the delimiter not be a this position it's just a indication). */ protected Delimitor dSE; /** The South-West delimiter (therefore it's possible that the delimiter not be a this position it's just a indication). */ protected Delimitor dSW; /** The North East delimiter (therefore it's possible that the delimiter not be a this position it's just a indication). */ protected Delimitor dNE; /** The West delimiter (therefore it's possible that the delimiter not be a this position it's just a indication) */ protected Delimitor dW; /** The South delimiter (therefore it's possible that the delimiter not be a this position it's just a indication) */ protected Delimitor dS; /** The East delimiter (therefore it's possible that the delimiter not be a this position it's just a indication) */ protected Delimitor dE; /** The North delimiter (therefore it's possible that the delimiter not be a this position it's just a indication) */ protected Delimitor dN; /** Allows to know if the rectangle has round corner or not */ protected boolean isRound; /** The level of roundness of the rectangle */ protected double frameArc; /** The value by default of the roundness of the rectangle */ public static final double DEFAULT_FRAME_ARC = 0.5; /** The number of points which contains a rectangle */ public static final short NB_POINTS_FRAME = 4; public static final boolean DEFAULT_ISROUND = false; /** * The basic constructor. * @param increaseMeter True if the meter of figures must be increased. */ public LaTeXDrawRectangle(boolean increaseMeter) { this(new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), increaseMeter); } /** * Creates a figure from one another. * @param f The figure to copy. * @param sameNumber True is the new figure must have the same number as the other. * @throws IllegalArgumentException If f is null or if f has no border. */ public LaTeXDrawRectangle(Figure f, boolean sameNumber) { super(f, sameNumber); borders = null; isBordersMovable = true; LaTeXDrawRectangle bord = f.getBorders(); if(bord==null) throw new IllegalArgumentException(); pts = new Vector(); pts.add((LaTeXDrawPoint2D)bord.getPoint(0).clone()); pts.add((LaTeXDrawPoint2D)bord.getPoint(1).clone()); pts.add((LaTeXDrawPoint2D)bord.getPoint(2).clone()); pts.add((LaTeXDrawPoint2D)bord.getPoint(3).clone()); initializeDelimitors(); updateShape(); setThickness(thickness); if(f instanceof LaTeXDrawRectangle) { frameArc = ((LaTeXDrawRectangle)f).frameArc; isRound = ((LaTeXDrawRectangle)f).isRound; } } /** * Allows to create a rectangle with the north-west point and the south-east point * @param NW The north-west point * @param SE The south-east point */ public LaTeXDrawRectangle(LaTeXDrawPoint2D NW, LaTeXDrawPoint2D SE, boolean increaseMeter) { this(NW, new LaTeXDrawPoint2D(SE.x, NW.y), new LaTeXDrawPoint2D(NW.x, SE.y), SE, increaseMeter); } /** * The constructor taking four points. * @param first The first point of the rectangle (the highest and the westiest point) * @param second The second point of the rectangle (the lowest and the eastiest point) * @param third The third point of the rectangle (the lowest and the eastiest point) * @param fourth The fourth point of the rectangle (the lowest and the eastiest point) */ public LaTeXDrawRectangle(LaTeXDrawPoint2D first, LaTeXDrawPoint2D second, LaTeXDrawPoint2D third, LaTeXDrawPoint2D fourth , boolean increaseMeter) { super(increaseMeter); isBordersMovable = true; borders = null; pts.add(first); pts.add(second); pts.add(third); pts.add(fourth); frameArc = DEFAULT_FRAME_ARC; isRound = DEFAULT_ISROUND; initializeDelimitors(); updateShape(); } /** * Initialises the delimiters of the rectangle. */ protected void initializeDelimitors() { if(getNbPoints()<4) throw new IllegalArgumentException("Invalid number of points");//$NON-NLS-1$ dNW = new Delimitor(getPoint(0)); dNE = new Delimitor(getPoint(1)); dSW = new Delimitor(getPoint(2)); dSE = new Delimitor(getPoint(3)); dN = new Delimitor(new LaTeXDrawPoint2D((dNW.getCenter().x + dNE.getCenter().x) / 2, dNW.getCenter().y)); dS = new Delimitor(new LaTeXDrawPoint2D((dSW.getCenter().x + dSE.getCenter().x) / 2, dSW.getCenter().y)); dE = new Delimitor(new LaTeXDrawPoint2D(dSE.getCenter().x, (dSE.getCenter().y + dNE.getCenter().y) / 2)); dW = new Delimitor(new LaTeXDrawPoint2D(dNW.getCenter().x, (dSW.getCenter().y + dNW.getCenter().y) / 2)); dN.setColorSet2(); dS.setColorSet2(); dE.setColorSet2(); dW.setColorSet2(); } /** * Sets id the rectangle must be round or not. * @param round Its new value : if true, the rectangle will be round. */ public synchronized void setIsRound(boolean round) { if(round!=isRound) { isRound = round; shape = getInsideOutsideOrMiddleBorders(); } } @Override public synchronized void setOnRotation(boolean on) { isOnRotation = on; updateStyleOfDelimitors(); } /** * @return True if the rectangle is round. */ public synchronized boolean isRound() { return isRound; } /** * @return The value of the attribute. */ public synchronized double getFrameArc() { return frameArc; } /** * @return The width of the non-rotated rectangle. */ public synchronized double getWidth() { return Math.abs(getTheNWPoint().x - getTheSEPoint().x); } /** * @return The height of the non-rotated rectangle. */ public synchronized double getHeight() { return Math.abs(getTheNWPoint().y - getTheSEPoint().y); } @Override public synchronized LaTeXDrawRectangle getBorders() { return this; } @Override public synchronized LaTeXDrawPoint2D getBordersPoint(int id) { if(id == -1) return getPoint(getNbPoints()-1); if(id < 0 || id > LaTeXDrawRectangle.NB_POINTS_FRAME - 1) throw new IllegalArgumentException(); return getPoint(id); } @Override public void shift(double shiftX, double shiftY) { if(shiftX==0 && shiftY==0) return ; if(pts == null) pts = new Vector(); int i, size = pts.size(); for(i = 0; i < size; i++) { LaTeXDrawPoint2D p = pts.elementAt(i); p.x += shiftX; p.y += shiftY; } updateNSEWDelimitors(); updateGravityCenter(); shape = getInsideOutsideOrMiddleBorders(); } /** * Sets the attribute frameArc. * @param value Its new value. */ public synchronized void setFrameArc(double value) { if(value != frameArc && value>0) { frameArc = min(value,1); // The frame arc must at max at 1 shape = getInsideOutsideOrMiddleBorders(); } } @Override public void rescaleX(double formerX, double newX, double percent, LaTeXDrawRectangle bound) { if(percent==1.) return ; int i, size = getNbPoints(); if(size > 0) { LaTeXDrawPoint2D NW = bound.getTheNWPoint(), SE = bound.getTheSEPoint(), farest, p; if(formerX == SE.x) farest = NW; else if(formerX == NW.x) farest = SE; else throw new IllegalArgumentException(); for(i = 0; i < size; i++) {// We rescale each point p = getPoint(i); p.x = farest.x + (p.x - farest.x) * percent; } updateNSEWDelimitors(); } shape = getInsideOutsideOrMiddleBorders(); } @Override public void rescaleY(double formerY, double newY, double percent, LaTeXDrawRectangle bound) { if(percent==1.) return ; int i, size = getNbPoints(); if(size > 0) { LaTeXDrawPoint2D NW = bound.getTheNWPoint(), SE = bound.getTheSEPoint(), farest, p; if(formerY == SE.y) farest = NW; else if(formerY == NW.y) farest = SE; else throw new IllegalArgumentException(); for(i = 0; i < size; i++) {// We rescale each point p = getPoint(i); p.y = farest.y + (p.y - farest.y) * percent; } updateNSEWDelimitors(); } shape = getInsideOutsideOrMiddleBorders(); } @Override public synchronized void setFirstPoint(double x, double y) { LaTeXDrawPoint2D first = getPoint(0), second = getPoint(1); LaTeXDrawPoint2D third = getPoint(2); first.setLocation(x, y); second.y = y; third.x = x; updateNSEWDelimitors(); updateGravityCenter(); shape = getInsideOutsideOrMiddleBorders(); } @Override public synchronized void setBordersPosition(String doubleLinePosition) { super.setBordersPosition(doubleLinePosition); shape = getInsideOutsideOrMiddleBorders(); } @Override public synchronized void setThickness(float val) { if(!Double.isInfinite(val) && !Double.isNaN(val) && val>0) { thickness = val; double dim = 1.33 * val + 3.33 + 1.; if(dim < 6.) dim = 6; if(dNW!=null) { dNW.setDim(dim); dSE.setDim(dim); dSW.setDim(dim); dNE.setDim(dim); dN.setDim(dim); dS.setDim(dim); dE.setDim(dim); dW.setDim(dim); } shape = getInsideOutsideOrMiddleBorders(); } } @Override public synchronized void setRotationAngle(double theta) { theta%=(Math.PI*2); rotationAngle = theta; } @Override public synchronized void setSelected(boolean state) { isSelected = state; } /** * Updates the position of some delimiters. */ public synchronized void updateNSEWDelimitors() { dN.setCoordinates((dNW.getCenter().x + dNE.getCenter().x)/2, dNW.getCenter().y); dS.setCoordinates((dSW.getCenter().x + dSE.getCenter().x)/2, dSW.getCenter().y); dE.setCoordinates(dSE.getCenter().x, (dSE.getCenter().y + dNE.getCenter().y) / 2); dW.setCoordinates(dNW.getCenter().x, (dSW.getCenter().y + dNW.getCenter().y) / 2); } @Override public synchronized void updateGravityCenter() { if(pts.size() == NB_POINTS_FRAME) { LaTeXDrawPoint2D NW = getTheNWPoint(); LaTeXDrawPoint2D SE = getTheSEPoint(); if(gravityCenter==null) gravityCenter = new LaTeXDrawPoint2D((NW.x + SE.x) / 2., (NW.y + SE.y) / 2.); else gravityCenter.setLocation((NW.x + SE.x) / 2., (NW.y + SE.y) / 2.); } } /** * Changes the last point of the rectangle. * @param pt The new last point (in fact the south-east point). */ @Override public synchronized void setLastPoint(LaTeXDrawPoint2D pt) { if(!pt.equals(getPoint(-1))) { LaTeXDrawPoint2D third = getPoint(2), fourth = getPoint(3); LaTeXDrawPoint2D second = getPoint(1); fourth.setLocation(pt.x, pt.y); third.y = pt.y; second.x = pt.x; updateNSEWDelimitors(); updateGravityCenter(); shape = getInsideOutsideOrMiddleBorders(); } } @Override public void draw(Graphics2D g, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering) { draw(g, true, antiAlias, rendering, alphaInter, colorRendering); } /** * This method draws the rectangle. * @param drawRectangle if true, the rectangle is drawn ; else, only the delimiters may be drawn (Useful for Rhombus, ...). */ public void draw(Graphics2D g, boolean drawRectangle, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering) { LaTeXDrawPoint2D NW = getTheNWPoint(), SE = getTheSEPoint(); double cx = (NW.x + SE.x) / 2., cy = (NW.y + SE.y) / 2.; double c2x = Math.cos(rotationAngle) * cx - Math.sin(rotationAngle)* cy; double c2y = Math.sin(rotationAngle) * cx + Math.cos(rotationAngle)* cy; double c3x = Math.cos(-rotationAngle) * (cx - c2x)- Math.sin(-rotationAngle) * (cy - c2y); double c3y = Math.sin(-rotationAngle) * (cx - c2x)+ Math.cos(-rotationAngle) * (cy - c2y); double dx=0, dy=0; boolean changeFillStyle = false; if(rotationAngle % (Math.PI*2) != 0) { g.rotate(rotationAngle); g.translate(c3x, c3y); } if(hasShadow) { LaTeXDrawPoint2D cg = getGravityCenter(); LaTeXDrawPoint2D shadowCg = (LaTeXDrawPoint2D)cg.clone(); shadowCg.setLocation(cg.x+shadowSize, cg.y); shadowCg = Figure.rotatePoint(shadowCg, cg, shadowAngle); dx = shadowCg.x-cg.x; dy = cg.y-shadowCg.y; } if(drawRectangle) { Color formerCol = g.getColor(); if(hasDoubleBoundary) { Shape s0 = shape; Shape s[] = getDbleBoundariesOutInOrMiddle(s0); Shape s1, s2, s3; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) { s1 = s0; s2 = s[0]; s3 = s[1]; } else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) { s1 = s[0]; s2 = s0; s3 = s[1]; } else { s1 = s[0]; s2 = s[1]; s3 = s0; } Shape sTooSmall = getTooSmallShape(s1); if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) { Area area = new Area(s1); area.subtract(new Area(s3)); g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); if(hasShadow) { g.translate(dx, dy); g.setColor(shadowColor); g.fill(s1); if(sTooSmall==null) g.draw(s1); else g.draw(sTooSmall); g.translate(-dx, -dy); if(!isFilled) { changeFillStyle = true; isFilled = true; } } g.setColor(doubleColor); g.fill(area); fillFigure(g,antiAlias,rendering,alphaInter,colorRendering,s3); g.setColor(linesColor); if(sTooSmall==null) g.draw(s1); else g.draw(sTooSmall); g.draw(s3); } else { if(hasShadow) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.fill(s1); if(sTooSmall==null) g.draw(s1); else g.draw(sTooSmall); g.translate(-dx, -dy); g.setColor(interiorColor); g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.draw(s2); if(!isFilled) { changeFillStyle = true; isFilled = true; } } if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[] { 0, (float)(thickness*2+doubleSep + dotSep) }, 0)); else g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[] { blackDashLength, whiteDashLength }, 0)); fillFigure(g, antiAlias, rendering, alphaInter, colorRendering, s2); g.setColor(linesColor); Shape sTooSmall2 = getTooSmallShape(s2); if(sTooSmall2==null) g.draw(s2); else g.draw(sTooSmall2); g.setStroke(new BasicStroke((float)doubleSep, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.setColor(doubleColor); if(sTooSmall2==null) g.draw(s2); else g.draw(sTooSmall2); } } else { Shape sTooSmall = getTooSmallShape(shape); if(hasShadow) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.fill(shape); if(sTooSmall==null) g.draw(shape); else g.draw(sTooSmall); g.translate(-dx, -dy); if(!isFilled) { changeFillStyle = true; isFilled = true; } g.setColor(interiorColor); g.draw(shape); } if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); else if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[] { 0, thickness + dotSep }, 0)); else g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[] { blackDashLength, whiteDashLength }, 0)); fillFigure(g, antiAlias, rendering, alphaInter, colorRendering, shape); g.setColor(linesColor); if(sTooSmall==null) g.draw(shape); else g.draw(sTooSmall); } if(changeFillStyle) isFilled = false; g.setColor(formerCol); } if(isSelected()) { dN.draw(g); dE.draw(g); dW.draw(g); dS.draw(g); dNW.draw(g); dSE.draw(g); dNE.draw(g); dSW.draw(g); } if((rotationAngle%(Math.PI*2))!=0) { g.translate(-c3x, -c3y); g.rotate(-rotationAngle); } } @Override public LaTeXDrawPoint2D getTheNWPoint() { LaTeXDrawPoint2D first = getPoint(0), second = getPoint(1), third = getPoint(2); LaTeXDrawPoint2D fourth = getPoint(3); if (first.x < second.x) { if (first.y < third.y) return first; return third; } else if (second.y < fourth.y) return second; else return fourth; } @Override public LaTeXDrawPoint2D getTheSERotatedPoint() { if (!pts.isEmpty()) { LaTeXDrawPoint2D pt = rotatePoint(getPoint(0)); double SEx = pt.x, SEy = pt.y; int i, size = pts.size(); for (i = 1; i < size; i++) { pt = rotatePoint(getPoint(i)); if (pt.x > SEx) SEx = pt.x; if (pt.y > SEy) SEy = pt.y; } return new LaTeXDrawPoint2D(SEx, SEy); } return null; } @Override public LaTeXDrawPoint2D getTheNWRotatedPoint() { if(!pts.isEmpty()) { LaTeXDrawPoint2D pt = rotatePoint(getPoint(0)); double NWx = pt.x, NWy = pt.y; int i, size = pts.size(); for(i=1; i second.x) { if (first.y > third.y) return first; return third; } if(second.y > fourth.y) return second; return fourth; } @Override public boolean intersected(Rectangle2D.Double r) { if(r==null) return false; Shape s = createShape2D(); Rectangle2D bounds = s.getBounds2D(); if(bounds.getHeight()<=0)////fix #1591312 s = new Line2D.Double(bounds.getMinX(), bounds.getMaxY(), bounds.getMaxX(), bounds.getMaxY()); else if(bounds.getWidth()<=0) s = new Line2D.Double(bounds.getMaxX(), bounds.getMinY(), bounds.getMaxX(), bounds.getMaxY()); BasicStroke wideline = new BasicStroke(thickness); Shape outline = wideline.createStrokedShape(s); return outline.intersects(r) && !outline.contains(r); } @Override public boolean isIn(LaTeXDrawPoint2D p) { if(p == null) throw new IllegalArgumentException(); LaTeXDrawPoint2D pt = rotateInvertPoint(p); if(isSelected() && (dNW.isIn(pt) || dSE.isIn(pt) || dSW.isIn(pt) || dNE.isIn(pt) || dS.isIn(pt) || dW.isIn(pt) || dN.isIn(pt) || dE.isIn(pt))) return true; LaTeXDrawPoint2D NW = getTheNWNonRotatedBoundPoint(); LaTeXDrawPoint2D SE = getTheSENonRotatedBoundPoint(); Rectangle2D.Double s = new Rectangle2D.Double(NW.x, NW.y, Math.abs(NW.x - SE.x), Math.abs(NW.y - SE.y)); if(!s.contains(pt)) return false; if(isFilled || hasShadow || hasGradient()) return true; Shape s2; if(hasDoubleBoundary) s2 = new Rectangle2D.Double(NW.x + thickness * 2 + doubleSep, NW.y + thickness * 2 + doubleSep, Math.abs(NW.x - SE.x)- 4 * thickness - 2 * doubleSep, Math.abs(NW.y- SE.y) - 4 * thickness - 2 * doubleSep); else s2 = new Rectangle2D.Double(NW.x + thickness, NW.y + thickness, Math.abs(NW.x - SE.x) - 2 * thickness, Math.abs(NW.y- SE.y)- 2 * thickness); return !s2.contains(pt); } @Override public synchronized String getCodePSTricks(DrawBorders drawBorders, float ppc) { LaTeXDrawPoint2D NW = getTheNWPoint(), SE = getTheSEPoint(); LaTeXDrawPoint2D d = drawBorders.getOriginPoint(); double x1 = NW.x - d.x, x2 = SE.x - d.x; double y1 = d.y - NW.y, y2 = d.y - SE.y; String add = "", addBegin = "", addEnd = "", fillType = ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ boolean isFilledWasChanged = false; double threshold = 0.001; if(hasShadow) { fillType+=",shadow=true";//$NON-NLS-1$ if(Math.toDegrees(shadowAngle)!=PSTricksConstants.DEFAULT_SHADOW_ANGLE) fillType+=",shadowangle="+(float)Math.toDegrees(shadowAngle);//$NON-NLS-1$ if(((float)shadowSize)!=((float)DEFAULT_SHADOW_SIZE)) fillType+=",shadowsize="+(float)(shadowSize/PPC);//$NON-NLS-1$ if(!shadowColor.equals(PSTricksConstants.DEFAULT_SHADOW_COLOR)) { String name = DviPsColors.getColourName(shadowColor); if(name==null) { name = "color"+number+'e';//$NON-NLS-1$ DviPsColors.addUserColour(shadowColor, name); } fillType += ",shadowcolor=" + name; //$NON-NLS-1$ } if(!isFilled) { isFilled = true; isFilledWasChanged = true; } } String str = getPSTricksCodeFilling(ppc); if(str.length()>0) fillType=fillType+','+str; str = getPSTricksCodeLine(ppc); if(str.length()>0) add=add+','+str; if(isRound) add += ",framearc=" + (float)frameArc; //$NON-NLS-1$ if(rotationAngle%(Math.PI*2)!=0.) { double angle = -Math.toDegrees(rotationAngle); double cx = (gravityCenter.x - d.x) / ppc; double cy = (d.y - gravityCenter.y) / ppc; double x = -Math.cos(-rotationAngle) * cx + Math.sin(-rotationAngle) * cy + cx; double y = -Math.sin(-rotationAngle) * cx - Math.cos(-rotationAngle) * cy + cy; x = LaTeXDrawNumber.getCutNumber(x, threshold); y = LaTeXDrawNumber.getCutNumber(y, threshold); addBegin += "\\rput{" + (float)angle + "}(" + (float)x + ',' + (float)y + "){"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addEnd = "}"; //$NON-NLS-1$ } add += ",dimen=" + bordersPosition; //$NON-NLS-1$ if(hasDoubleBoundary) { add += ",doubleline=true,doublesep=" + (float)(doubleSep / ppc); //$NON-NLS-1$ if(doubleColor != PSTricksConstants.DEFAULT_DOUBLE_COLOR) { String name = DviPsColors.getColourName(doubleColor); if(name==null) { name = "color"+number+'d';//$NON-NLS-1$ DviPsColors.addUserColour(doubleColor, name); } add += ",doublecolor=" + name; //$NON-NLS-1$ } } x2 = LaTeXDrawNumber.getCutNumber(x2/ppc, threshold); y2 = LaTeXDrawNumber.getCutNumber(y2/ppc, threshold); x1 = LaTeXDrawNumber.getCutNumber(x1/ppc, threshold); y1 = LaTeXDrawNumber.getCutNumber(y1/ppc, threshold); float th = LaTeXDrawNumber.getCutNumber(thickness/ppc, threshold); if(isFilledWasChanged) isFilled = false; return addBegin + "\\psframe[linewidth=" + th + //$NON-NLS-1$ add + fillType+"](" + (float)x2 + ',' + //$NON-NLS-1$ (float)y1 + ")(" //$NON-NLS-1$ + (float)x1 + ',' + (float)y2 + ')' + addEnd; } /** * Recentres the figure after a drag with a rotated figure. * @param oldGravityCenter The former gravity centre */ protected void recenterDraggedOnRotation(LaTeXDrawPoint2D oldGravityCenter) { if(oldGravityCenter==null) throw new IllegalArgumentException(); updateGravityCenter(); LaTeXDrawPoint2D rotGc = rotatePoint(getGravityCenter(), oldGravityCenter, rotationAngle); shift(getGravityCenter(), rotGc); } @Override public void onDragged(Point formerPt, Point newPt) { if(formerPt.equals(newPt)) return; if(dSelected != null) { if(isOnRotation()) rotate(formerPt, newPt); else { LaTeXDrawPoint2D newPt2 = rotateInvertPoint(newPt); LaTeXDrawPoint2D oldGc = (LaTeXDrawPoint2D)getGravityCenter().clone(); if(dSelected == dE) dNE.getCenter().x = dSE.getCenter().x = newPt2.x; else if(dSelected == dW) dNW.getCenter().x = dSW.getCenter().x = newPt2.x; else if(dSelected == dN) dNE.getCenter().y = dNW.getCenter().y = newPt2.y; else if(dSelected == dS) dSE.getCenter().y = dSW.getCenter().y = newPt2.y; else if(dSelected == dNE) { dNW.getCenter().y = newPt2.y; dSE.getCenter().x = newPt2.x; }else if(dSelected == dNW) { dNE.getCenter().y = newPt2.y; dSW.getCenter().x = newPt2.x; }else if(dSelected == dSW) { dSE.getCenter().y = newPt2.y; dNW.getCenter().x = newPt2.x; }else if(dSelected == dSE) { dSW.getCenter().y = newPt2.y; dNE.getCenter().x = newPt2.x; } dSelected.setCoordinates(newPt2); if(rotationAngle!=0) recenterDraggedOnRotation(oldGc); } updateGravityCenter(); shape = getInsideOutsideOrMiddleBorders(); } else // If the user has clicked on the line shift(formerPt, newPt); updateNSEWDelimitors(); } @Override public synchronized void onClick(Point p) { updateNSEWDelimitors(); LaTeXDrawPoint2D pt = rotateInvertPoint(p); if(dSE.isIn(pt)) dSelected = dSE; else if(dNW.isIn(pt)) dSelected = dNW; else if(dNE.isIn(pt)) dSelected = dNE; else if(dSW.isIn(pt)) dSelected = dSW; else if(dN.isIn(pt)) dSelected = dN; else if(dS.isIn(pt)) dSelected = dS; else if(dE.isIn(pt)) dSelected = dE; else if(dW.isIn(pt)) dSelected = dW; isSelected = true; } @Override public synchronized void onDelimitorRelease() { updateStyleOfDelimitors(); dSelected = null; } @Override public synchronized void onRelease() { setOnRotation(false); isSelected = false; dSelected = null; } @Override public synchronized Shape createShape2D() { Shape area = createNonRotatedShape2D(); if((rotationAngle % (2*PI)) != 0) { LaTeXDrawPoint2D NW = getTheNWPoint(), SE = getTheSEPoint(); double cx = (NW.x+SE.x)/2., cy = (NW.y+SE.y)/2.; double c2x = cos(rotationAngle)*cx - sin(rotationAngle)*cy; double c2y = sin(rotationAngle)*cx + cos(rotationAngle)*cy; Rectangle2D bounds = area.getBounds2D(); if(bounds.getHeight()<=0)//AffineTransform has problem when the shape is very small. if(bounds.getWidth()<=0) area = new Rectangle2D.Double(bounds.getMinX(), bounds.getMinY(), 1, 1); else area = new Rectangle2D.Double(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), 1); else if(bounds.getWidth()<=0) area = new Rectangle2D.Double(bounds.getMinX(), bounds.getMinY(), 1, bounds.getHeight()); AffineTransform at = AffineTransform.getTranslateInstance(cx - c2x, cy - c2y); at.rotate(rotationAngle); area = at.createTransformedShape(area); } return area; } @Override public synchronized Shape createNonRotatedShape2D() { Shape area; Shape s = getInsideOutsideOrMiddleBorders(); if(hasDoubleBoundary) { Shape[] s2 = getDbleBoundariesOutInOrMiddle(s); Shape min; Shape max; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) { max = s; min = s2[1]; } else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) { max = s2[0]; min = s2[1]; } else { max = s2[0]; min = s; } area = new Area(max); ((Area)area).exclusiveOr(new Area(min)); Shape tooSmallShape = getTooSmallShape(area); if(tooSmallShape!=null) { Rectangle2D bounds = max.getBounds2D(); area = new Line2D.Double(Math.max(1, bounds.getMinX()), Math.max(1, bounds.getMinY()), Math.max(1, bounds.getMaxX()), Math.max(1, bounds.getMaxY())); } } else area = s; return area; } @Override public Object clone() throws CloneNotSupportedException { LaTeXDrawRectangle r = (LaTeXDrawRectangle)super.clone(); r.dNW = new Delimitor(r.getPoint(0)); r.dNE = new Delimitor(r.getPoint(1)); r.dSW = new Delimitor(r.getPoint(2)); r.dSE = new Delimitor(r.getPoint(3)); r.dE = (Delimitor)dE.clone(); r.dS = (Delimitor)dS.clone(); r.dW = (Delimitor)dW.clone(); r.dN = (Delimitor)dN.clone(); r.setThickness(thickness); r.updateNSEWDelimitors(); r.updateStyleOfDelimitors(); r.isRound = isRound; r.frameArc = frameArc; r.shape = getInsideOutsideOrMiddleBorders(); return r; } @Override public synchronized void updateStyleOfDelimitors() { if(isOnRotation) { dN.setColorSet4(); dS.setColorSet4(); dE.setColorSet4(); dW.setColorSet4(); dSW.setColorSet4(); dSE.setColorSet4(); dNW.setColorSet4(); dNE.setColorSet4(); } else { dN.setColorSet2(); dS.setColorSet2(); dE.setColorSet2(); dW.setColorSet2(); dSW.setColorSet1(); dSE.setColorSet1(); dNW.setColorSet1(); dNE.setColorSet1(); } } @SuppressWarnings("unchecked") private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { canHaveShadow = true; interiorColor = (Color)ois.readObject(); lineStyle = (String)ois.readObject(); rotationAngle = ois.readDouble(); float thick = ois.readFloat(); thickness = DEFAULT_THICKNESS; isFilled = ois.readBoolean(); isSelected = ois.readBoolean(); isOnRotation = ois.readBoolean(); linesColor = (Color)ois.readObject(); blackDashLength = ois.readFloat(); dotSep = ois.readFloat(); whiteDashLength = ois.readFloat(); pts = (Vector)ois.readObject(); isRound = ois.readBoolean(); frameArc = ois.readDouble(); if(pts.size() != NB_POINTS_FRAME) throw new ArrayIndexOutOfBoundsException(); dNW = new Delimitor(pts.firstElement()); dNE = new Delimitor(pts.elementAt(1)); dSW = new Delimitor(pts.elementAt(2)); dSE = new Delimitor(pts.elementAt(3)); dN = new Delimitor(new LaTeXDrawPoint2D((dNW.getCenter().x+dNE.getCenter().x)/2, dNW.getCenter().y)); dS = new Delimitor(new LaTeXDrawPoint2D((dSW.getCenter().x+dSE.getCenter().x)/2, dSW.getCenter().y)); dE = new Delimitor(new LaTeXDrawPoint2D(dSE.getCenter().x,(dSE.getCenter().y+dNE.getCenter().y)/2)); dW = new Delimitor(new LaTeXDrawPoint2D(dNW.getCenter().x,(dSW.getCenter().y+dNW.getCenter().y)/2)); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.5") >= 0)//$NON-NLS-1$ { hasDoubleBoundary = ois.readBoolean(); doubleColor = (Color)ois.readObject(); doubleSep = ois.readDouble(); bordersPosition = (String)ois.readObject(); if(!(LaTeXDrawFrame.getVersionOfFile().compareTo("1.6")>=0)) //$NON-NLS-1$ ois.readBoolean(); hatchingAngle = ois.readDouble(); hatchingColor = (Color)ois.readObject(); hatchingStyle = (String)ois.readObject(); hatchingWidth = ois.readFloat(); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.6") < 0)//$NON-NLS-1$ { if(hatchingStyle.equals(DECREPETED_FILL_CROSS)) hatchingStyle = PSTricksConstants.TOKEN_FILL_CROSSHATCH; else if(hatchingStyle.equals(DECREPETED_FILL_HORIZ)) hatchingStyle = PSTricksConstants.TOKEN_FILL_HLINES; else if(hatchingStyle.equals(DECREPETED_FILL_VERT)) hatchingStyle = PSTricksConstants.TOKEN_FILL_VLINES; else if(hatchingStyle.equals(DECREPETED_FILL_NO)) hatchingStyle = PSTricksConstants.TOKEN_FILL_NONE; } } else { hasDoubleBoundary = DEFAULT_HAS_DOUBLE_BOUNDARY; doubleColor = DEFAULT_DOUBLE_COLOR; doubleSep = DEFAULT_DOUBLESEP; bordersPosition = DEFAULT_BORDERS_POSITION; hatchingAngle = DEFAULT_HATCH_ANGLE; hatchingColor = DEFAULT_HATCH_COL; hatchingStyle = DEFAULT_HATCH_STYLE; hatchingWidth = DEFAULT_HATCH_WIDTH; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.7")>=0) //$NON-NLS-1$ { hasShadow = ois.readBoolean(); shadowAngle = ois.readDouble(); shadowSize = ois.readDouble(); shadowColor = (Color)ois.readObject(); gradientEndColor = (Color)ois.readObject(); gradientStartColor = (Color)ois.readObject(); gradientAngle = ois.readDouble(); gradientMidPoint = ois.readDouble(); } else { hasShadow = DEFAULT_SHADOW_HAS; shadowAngle = DEFAULT_SHADOW_ANGLE; shadowSize = DEFAULT_SHADOW_SIZE; shadowColor = DEFAULT_SHADOW_COLOR; gradientEndColor = PSTricksConstants.DEFAULT_GRADIENT_END_COLOR; gradientStartColor = PSTricksConstants.DEFAULT_GRADIENT_START_COLOR; gradientAngle = DEFAULT_GRADIENT_ANGLE; gradientMidPoint = DEFAULT_GRADIENT_MID_POINT; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.8")>=0) //$NON-NLS-1$ hatchingSep = ois.readDouble(); else hatchingSep = DEFAULT_HATCH_SEP; setThickness(thick); updateStyleOfDelimitors(); shape = getInsideOutsideOrMiddleBorders(); } /** * Creates the borders of the rectangle in the position "inside". * @return The borders. */ public Shape getInsideBorders() { LaTeXDrawPoint2D NW = getTheNWPoint(), SE = getTheSEPoint(); double width = abs(NW.x - SE.x), height = abs(NW.y - SE.y); double min = min(width, height); Shape s; if(isRound)//Fixes #1554750 s = new RoundRectangle2D.Double(NW.x+thickness/2., NW.y+thickness/2., max(width-thickness,1), max(height-thickness,1), (min-thickness)*frameArc, (min-thickness)*frameArc); else s = new Rectangle2D.Double(NW.x+thickness/2., NW.y+thickness/2., max(width-thickness,1), max(height-thickness,1)); return s; } /** * Creates the borders of the rectangle in the position "outside". * @return The borders. */ public Shape getOutsideBorders() { LaTeXDrawPoint2D NW = getTheNWPoint(), SE = getTheSEPoint(); double width = abs(NW.x - SE.x), height = abs(NW.y - SE.y); double min = min(width, height); Shape s; if(isRound)//Fixes #1554750 s = new RoundRectangle2D.Double(NW.x-thickness/2., NW.y-thickness/2., max(width+thickness, 1), max(height+thickness, 1), (min+thickness)*frameArc, (min+thickness)*frameArc); else s = new Rectangle2D.Double(NW.x-thickness/2., NW.y-thickness/2., max(width+thickness, 1), max(height+thickness, 1)); return s; } /** * Creates the borders of the rectangle in the position "middle". * @return The borders. */ public Shape getMiddleBorders() { LaTeXDrawPoint2D NW = getTheNWPoint(), SE = getTheSEPoint(); double width = abs(NW.x - SE.x), height = abs(NW.y - SE.y); double min = min(width, height); Shape s; if(isRound) s = new RoundRectangle2D.Double(NW.x, NW.y, max(width,1), max(height,1), min*frameArc, min*frameArc); else s = new Rectangle2D.Double(NW.x, NW.y, max(width, 1), max(height, 1)); return s; } @Override public Shape getInsideOutsideOrMiddleBorders() { Shape s; if (bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) s = getInsideBorders(); else if (bordersPosition.equals(PSTricksConstants.BORDERS_OUTSIDE)) s = getOutsideBorders(); else s = getMiddleBorders(); return s; } @Override public Shape[] getDbleBoundariesOutside(Shape classicBord) { if(classicBord == null) return null; RectangularShape r = (RectangularShape)classicBord; Shape[] s = new Shape[2]; double min = min(r.getWidth(), r.getHeight()); double add = doubleSep+thickness; if(isRound) {//Fixes #1554750 s[0] = new RoundRectangle2D.Double(r.getX()-add, r.getY()-add, r.getWidth()+2*add, r.getHeight()+2*add, (min+2*add)*frameArc, (min+2*add)*frameArc); s[1] = new RoundRectangle2D.Double(r.getX()-add/2., r.getY()-add/2., r.getWidth()+add, r.getHeight()+add, (min+add)*frameArc, (min+add)*frameArc); } else { s[0] = new Rectangle2D.Double(r.getX()-add, r.getY()-add, r.getWidth()+2*add, r.getHeight()+2*add); s[1] = new Rectangle2D.Double(r.getX()-add/2., r.getY()-add/2., r.getWidth()+add, r.getHeight()+add); } return s; } @Override public Shape[] getDbleBoundariesMiddle(Shape classicBord) { if(classicBord == null) return null; RectangularShape r = (RectangularShape)classicBord; Shape[] s = new Shape[2]; double min = min(r.getWidth(), r.getHeight()); double add = doubleSep+thickness; if(isRound) {//Fixes #1554750 s[0] = new RoundRectangle2D.Double(r.getX()-add/2., r.getY()-add/2., r.getWidth()+add, r.getHeight()+add, (min+add)*frameArc, (min+add)*frameArc); s[1] = new RoundRectangle2D.Double(r.getX()+add/2., r.getY()+add/2., r.getWidth()-add, r.getHeight()-add, (min-add)*frameArc, (min-add)*frameArc); } else { s[0] = new Rectangle2D.Double(r.getX()-add/2., r.getY()-add/2., r.getWidth()+add, r.getHeight()+add); s[1] = new Rectangle2D.Double(r.getX()+add/2., r.getY()+add/2., r.getWidth()-add, r.getHeight()-add); } return s; } @Override public Shape[] getDbleBoundariesInside(Shape classicBord) { if(classicBord == null) return null; RectangularShape r = (RectangularShape)classicBord; Shape[] s = new Shape[2]; double min = min(r.getWidth(), r.getHeight()); double add = doubleSep+thickness; if(isRound) {//Fixes #1554750 s[0] = new RoundRectangle2D.Double( r.getX()+add/2., r.getY() + add/2., r.getWidth()-add, r.getHeight()-add, (min-add)*frameArc, (min-add)*frameArc); s[1] = new RoundRectangle2D.Double(r.getX()+add, r.getY()+add, r.getWidth()-2*add, r.getHeight()-2*add, (min-add*2)*frameArc, (min-add*2)*frameArc); } else { s[0] = new Rectangle2D.Double(r.getX() + add/2., r.getY()+add/2., r.getWidth()-add, r.getHeight()-add); s[1] = new Rectangle2D.Double(r.getX()+add, r.getY()+add, r.getWidth()-2*add, r.getHeight()-2*add); } return s; } @Override public Shape[] getDbleBoundariesOutInOrMiddle(Shape classicBord) { Shape[] s; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) s = getDbleBoundariesInside(classicBord); else if(bordersPosition.equals(PSTricksConstants.BORDERS_OUTSIDE)) s = getDbleBoundariesOutside(classicBord); else s = getDbleBoundariesMiddle(classicBord); return s; } @Override public boolean isTooSmallToBeRescaled() { if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) return (getTheSEPoint().x-getTheNWPoint().x-2*thickness)<1 || (getTheSEPoint().y-getTheNWPoint().y-2*thickness)<1; else if(bordersPosition.equals(PSTricksConstants.BORDERS_OUTSIDE)) return (getTheSEPoint().x-getTheNWPoint().x)<1 || (getTheSEPoint().y-getTheNWPoint().y)<1; else return (getTheSEPoint().x-getTheNWPoint().x-thickness)<1 || (getTheSEPoint().y-getTheNWPoint().y-thickness)<1; } @Override public Shape createShadowShape() { if(!canHaveShadow || !hasShadow) return shape; Rectangle2D b = createShape2D().getBounds2D(); double dx=0, dy=0; LaTeXDrawPoint2D cg = getGravityCenter(); LaTeXDrawPoint2D shadowCg = (LaTeXDrawPoint2D)cg.clone(); shadowCg.setLocation(cg.x+shadowSize, cg.y); shadowCg = Figure.rotatePoint(shadowCg, cg, shadowAngle); dx = shadowCg.x-cg.x; dy = cg.y-shadowCg.y; Rectangle2D.Double shadowS = new Rectangle2D.Double(b.getX()+dx-thickness/2.,b.getY()+dy-thickness/2., b.getWidth()+thickness, b.getHeight()+thickness); return shadowS; } @Override public void mirrorHorizontal(LaTeXDrawPoint2D origin) { super.mirrorHorizontal(origin); updateNSEWDelimitors(); } @Override public void mirrorVertical(LaTeXDrawPoint2D origin) { super.mirrorVertical(origin); updateNSEWDelimitors(); } @Override public void updateToGrid(MagneticGrid grid) { super.updateToGrid(grid); updateNSEWDelimitors(); } @Override public int getSelectedDelimitorOrientation() { int del = super.getSelectedDelimitorOrientation(); if(del!=DELIMITOR_ORIENTATION_NONE) return del; if(dSelected==dN) return DELIMITOR_ORIENTATION_NORTH; if(dSelected==dS) return DELIMITOR_ORIENTATION_SOUTH; if(dSelected==dE) return DELIMITOR_ORIENTATION_EAST; if(dSelected==dW) return DELIMITOR_ORIENTATION_WEST; if(dSelected==dNE) return DELIMITOR_ORIENTATION_NE; if(dSelected==dNW) return DELIMITOR_ORIENTATION_NW; if(dSelected==dSE) return DELIMITOR_ORIENTATION_SE; if(dSelected==dSW) return DELIMITOR_ORIENTATION_SW; return DELIMITOR_ORIENTATION_NONE; } @Override public int hashCode() { return super.hashCode()*8; } /** * Creates a Rectangle2D from the LaTeXDrawRectangle. * @return A Rectangle2D * @since 1.9.2 */ public Rectangle2D toRectangle2D() { LaTeXDrawPoint2D nw = getTheNWPoint(), se = getTheSEPoint(); return new Rectangle2D.Double(nw.x, nw.y, se.x-nw.x, se.y-nw.y); } /** * Creates a Rectangle from the LaTeXDrawRectangle. * @return A Rectangle * @since 1.9.2 */ public Rectangle toRectangle() { LaTeXDrawPoint2D nw = getTheNWPoint(), se = getTheSEPoint(); return new Rectangle((int)nw.x, (int)nw.y, (int)(se.x-nw.x), (int)(se.y-nw.y)); } } latexdraw-2.0.8+1.orig/latexDraw/figures/Square.java0000644000000000000000000006077511347255510017221 0ustar package latexDraw.figures; import java.awt.*; import java.awt.geom.Area; import java.awt.geom.Rectangle2D; import java.io.IOException; import java.io.ObjectInputStream; import java.util.Vector; import latexDraw.psTricks.DviPsColors; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.ui.components.Delimitor; import latexDraw.ui.components.MagneticGrid; import latexDraw.util.LaTeXDrawNumber; import latexDraw.util.LaTeXDrawPoint2D; /** * This class defines a square.
    *
    * This file is part of LaTeXDraw.
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/16/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class Square extends LaTeXDrawRectangle { private static final long serialVersionUID = 1L; /** The width of the square */ protected double width; /** * @param f The figure to copy. * @param sameNumber If the new figure must have the same id than the copy. */ public Square(Figure f, boolean sameNumber) { super(f, sameNumber); width = f.getTheSEPoint().x - f.getTheNWPoint().x; updateGravityCenter(); setThickness(thickness); } /** * The constructor by default */ public Square(boolean increaseMeter) { this(new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), increaseMeter); } /** * The constructor taking the four points of the square * @param pt1 The first point of the square * @param pt2 The second point of the square * @param pt3 The third point of the square * @param pt4 The fourth point of the square */ public Square(LaTeXDrawPoint2D pt1, LaTeXDrawPoint2D pt2, LaTeXDrawPoint2D pt3, LaTeXDrawPoint2D pt4, boolean increaseMeter) { super(pt1, pt2, pt3, pt4, increaseMeter); width = Math.abs(pt1.x-pt2.x); updateGravityCenter(); } /** * Sets the width of the square. * @param w The new width of the square. * @throws IllegalArgumentException if w<0. */ public synchronized void setWidth(double w) { if(w<=0) throw new IllegalArgumentException(); width = w; updateGravityCenter(); shape = getInsideOutsideOrMiddleBorders(); } @Override public void draw(Graphics2D g, boolean drawBorders, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering) { LaTeXDrawPoint2D NW = getTheNWPoint(), SE = getTheSEPoint(); if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); else if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[]{0,thickness+dotSep}, 0)); else if(lineStyle.equals(PSTricksConstants.LINE_DASHED_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[]{blackDashLength, whiteDashLength}, 0)); double cx = (NW.x+SE.x)/2., cy = (NW.y+SE.y)/2.; double c2x = Math.cos(rotationAngle)*cx - Math.sin(rotationAngle)*cy; double c2y = Math.sin(rotationAngle)*cx + Math.cos(rotationAngle)*cy; double c3x = Math.cos(-rotationAngle)*(cx-c2x) - Math.sin(-rotationAngle)*(cy-c2y); double c3y = Math.sin(-rotationAngle)*(cx-c2x) + Math.cos(-rotationAngle)*(cy-c2y); double dx=0, dy=0; boolean changeFillStyle = false; if(rotationAngle%(Math.PI*2)!=0) { g.rotate(rotationAngle); g.translate(c3x,c3y); } if(hasShadow) { LaTeXDrawPoint2D cg = getGravityCenter(); LaTeXDrawPoint2D shadowCg = (LaTeXDrawPoint2D)cg.clone(); shadowCg.setLocation(cg.x+shadowSize, cg.y); shadowCg = Figure.rotatePoint(shadowCg, cg, shadowAngle); dx = shadowCg.x-cg.x; dy = cg.y-shadowCg.y; } if(drawBorders) { Color formerCol = g.getColor(); if(hasDoubleBoundary) { Shape s0 = shape; Shape s[] = getDbleBoundariesOutInOrMiddle(s0); Shape s1, s2, s3; if(bordersPosition.equals(PSTricksConstants.BORDERS_INSIDE)) { s1 = s0; s2 = s[0]; s3 = s[1]; } else if(bordersPosition.equals(PSTricksConstants.BORDERS_MIDDLE)) { s1 = s[0]; s2 = s0; s3 = s[1]; } else { s1 = s[0]; s2 = s[1]; s3 = s0; } if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); if(hasShadow) { g.translate(dx, dy); g.setColor(shadowColor); g.fill(s1); g.draw(s1); g.translate(-dx, -dy); if(!isFilled) { changeFillStyle = true; isFilled = true; } } g.setColor(doubleColor); Area area = new Area(s1); area.subtract(new Area(s3)); g.fill(area); fillFigure(g, antiAlias, rendering, alphaInter, colorRendering,s3); g.setColor(linesColor); g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.draw(s1); g.draw(s3); } else { if(hasShadow) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.fill(s1); g.draw(s1); g.translate(-dx, -dy); g.setColor(interiorColor); g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.draw(s2); if(!isFilled) { changeFillStyle = true; isFilled = true; } } if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[] { 0, (float)(thickness*2+doubleSep + dotSep) }, 0)); else g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[] { blackDashLength, whiteDashLength }, 0)); fillFigure(g, antiAlias, rendering, alphaInter, colorRendering, s2); g.setColor(linesColor); g.draw(s2); g.setStroke(new BasicStroke((float)doubleSep, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.setColor(doubleColor); g.draw(s2); } } else { Shape shape2 = shape; if(hasShadow) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.fill(shape); g.draw(shape); g.translate(-dx, -dy); if(!isFilled) { changeFillStyle = true; isFilled = true; } g.setColor(interiorColor); g.draw(shape); } if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); else if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[]{ 0, thickness + dotSep }, 0)); } else g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[] { blackDashLength, whiteDashLength }, 0)); fillFigure(g, antiAlias, rendering, alphaInter, colorRendering,shape2); g.setColor(linesColor); g.draw(shape); } if(changeFillStyle) isFilled = false; g.setColor(formerCol); } if(isSelected) { dNW.draw(g); dSE.draw(g); dNE.draw(g); dSW.draw(g); } if(rotationAngle%(Math.PI*2)!=0) { g.translate(-c3x, -c3y); g.rotate(-rotationAngle); } } @Override public void draw(Graphics2D g, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering) { draw(g, true, antiAlias, rendering, alphaInter, colorRendering); } @Override public void onDragged(Point formerPt, Point newPt) { if(formerPt.equals(newPt)) return; if(dSelected!=null) { if(isOnRotation) rotate(formerPt, newPt); else { LaTeXDrawPoint2D newPt2 = rotateInvertPoint(newPt); LaTeXDrawPoint2D oldGc = (LaTeXDrawPoint2D)gravityCenter.clone(); if(dSelected.getCenter()==pts.elementAt(0)) setFirstPoint(newPt2); else if(dSelected.getCenter()==pts.elementAt(1)) setSecondPoint(newPt2); else if(dSelected.getCenter()==pts.elementAt(2)) setThirdPoint(newPt2); else setLastPoint(newPt2); width = Math.abs(pts.elementAt(0).x - pts.elementAt(1).x); if(rotationAngle!=0) recenterDraggedOnRotation(oldGc); updateGravityCenter(); } } else // If the user has clicked on the line { shift(formerPt, newPt); shape = getInsideOutsideOrMiddleBorders(); } } @Override public void rescaleX(double formerX, double newX, double percent, LaTeXDrawRectangle bound) { if(percent==1.) return ; int i, size = getNbPoints(); if(size>0) { LaTeXDrawPoint2D bNW = bound.getTheNWPoint(), bSE = bound.getTheSEPoint(),farest,p; if(Math.abs(newX-bSE.x)0) { LaTeXDrawPoint2D NW = bound.getTheNWPoint(), SE = bound.getTheSEPoint(),farest,p; if(Math.abs(newY-SE.y)pt2.y ? pt1.y - width : pt1.y; x = pt1.x>pt2.x ? pt1.x - width : pt1.x; x = x - d.x; y = d.y - y; if(hasShadow) { fillType+=",shadow=true";//$NON-NLS-1$ if(Math.toDegrees(shadowAngle)!=PSTricksConstants.DEFAULT_SHADOW_ANGLE) fillType+=",shadowangle="+(float)Math.toDegrees(shadowAngle);//$NON-NLS-1$ if(((float)shadowSize)!=((float)DEFAULT_SHADOW_SIZE)) fillType+=",shadowsize="+LaTeXDrawNumber.getCutNumber((float)(shadowSize/PPC),threshold);//$NON-NLS-1$ if(!shadowColor.equals(PSTricksConstants.DEFAULT_SHADOW_COLOR)) { String name = DviPsColors.getColourName(shadowColor); if(name==null) { name = "color"+number+'e';//$NON-NLS-1$ DviPsColors.addUserColour(shadowColor, name); } add += ",shadowcolor=" + name; //$NON-NLS-1$ } if(!isFilled) { isFilled = true; isFilledWasChanged = true; } } String str = getPSTricksCodeFilling(ppc); if(str.length()>0) fillType=fillType+','+str; str = getPSTricksCodeLine(ppc); if(str.length()>0) add=add+','+str; if(isRound) add+=",framearc="+(float)frameArc; //$NON-NLS-1$ if(rotationAngle%(Math.PI*2)!=0.) { double angle = -Math.toDegrees(rotationAngle); double cx = (gravityCenter.x-d.x)/ppc; double cy = (d.y-gravityCenter.y)/ppc; double x2 = -Math.cos(-rotationAngle)*cx+ Math.sin(-rotationAngle)*cy+cx; double y2 = -Math.sin(-rotationAngle)*cx- Math.cos(-rotationAngle)*cy+cy; if(Math.abs(x2) < 0.001) x2 = 0; if(Math.abs(y2) < 0.001) y2 = 0; addBegin +="\\rput{"+(float)angle+ "}("+(float)x2+','+(float)y2+"){"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addEnd = "}"; //$NON-NLS-1$ } add+=",dimen="+bordersPosition; //$NON-NLS-1$ if(hasDoubleBoundary) { add+=",doubleline=true,doublesep="+LaTeXDrawNumber.getCutNumber((float)(doubleSep/ppc),threshold); //$NON-NLS-1$ if(doubleColor!=PSTricksConstants.DEFAULT_DOUBLE_COLOR) { String name = DviPsColors.getColourName(doubleColor); if(name==null) { name = "color"+number+'d';//$NON-NLS-1$ DviPsColors.addUserColour(doubleColor, name); } add+= ",doublecolor="+name; //$NON-NLS-1$ } } if(isFilledWasChanged) isFilled = false; return addBegin+"\\psframe[linewidth=" + LaTeXDrawNumber.getCutNumber(thickness/ppc,threshold) + //$NON-NLS-1$ add + fillType+"](" + LaTeXDrawNumber.getCutNumber((float)((x+width)/ppc),threshold) + ',' + //$NON-NLS-1$ LaTeXDrawNumber.getCutNumber((float)(y/ppc),threshold) + ")(" //$NON-NLS-1$ + LaTeXDrawNumber.getCutNumber((float)(x/ppc),threshold) + ',' + LaTeXDrawNumber.getCutNumber((float)((y-width)/ppc),threshold) + ')'+addEnd; } @Override public Square clone() throws CloneNotSupportedException { Square s = (Square) super.clone(); s.width = width; return s; } @SuppressWarnings("unchecked") private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { interiorColor = (Color) ois.readObject(); lineStyle = (String) ois.readObject(); rotationAngle = ois.readDouble(); float thick = ois.readFloat(); thickness = DEFAULT_THICKNESS; isFilled = ois.readBoolean(); isSelected = ois.readBoolean(); isOnRotation = ois.readBoolean(); linesColor = (Color) ois.readObject(); blackDashLength = ois.readFloat(); dotSep = ois.readFloat(); whiteDashLength = ois.readFloat(); pts = (Vector) ois.readObject(); isRound = ois.readBoolean(); frameArc = ois.readDouble(); width = ois.readDouble(); if(pts.size()!=NB_POINTS_FRAME) throw new ArrayIndexOutOfBoundsException(); dNW = new Delimitor(pts.firstElement()); dNE = new Delimitor(pts.elementAt(1)); dSW = new Delimitor(pts.elementAt(2)); dSE = new Delimitor(pts.elementAt(3)); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.5")>=0)//$NON-NLS-1$ { hasDoubleBoundary = ois.readBoolean(); doubleColor = (Color)ois.readObject(); doubleSep = ois.readDouble(); bordersPosition = (String)ois.readObject(); if(!(LaTeXDrawFrame.getVersionOfFile().compareTo("1.6")>=0)) //$NON-NLS-1$ ois.readBoolean(); hatchingAngle = ois.readDouble(); hatchingColor = (Color)ois.readObject(); hatchingStyle = (String)ois.readObject(); hatchingWidth = ois.readFloat(); if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.6") < 0)//$NON-NLS-1$ { if(hatchingStyle.equals(DECREPETED_FILL_CROSS)) hatchingStyle = PSTricksConstants.TOKEN_FILL_CROSSHATCH; else if(hatchingStyle.equals(DECREPETED_FILL_HORIZ)) hatchingStyle = PSTricksConstants.TOKEN_FILL_HLINES; else if(hatchingStyle.equals(DECREPETED_FILL_VERT)) hatchingStyle = PSTricksConstants.TOKEN_FILL_VLINES; else if(hatchingStyle.equals(DECREPETED_FILL_NO)) hatchingStyle = PSTricksConstants.TOKEN_FILL_NONE; } } else { hasDoubleBoundary = DEFAULT_HAS_DOUBLE_BOUNDARY; doubleColor = DEFAULT_DOUBLE_COLOR; doubleSep = DEFAULT_DOUBLESEP; bordersPosition = DEFAULT_BORDERS_POSITION; hatchingAngle = DEFAULT_HATCH_ANGLE; hatchingColor = DEFAULT_HATCH_COL; hatchingStyle = DEFAULT_HATCH_STYLE; hatchingWidth = DEFAULT_HATCH_WIDTH; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.7")>=0) //$NON-NLS-1$ { hasShadow = ois.readBoolean(); shadowAngle = ois.readDouble(); shadowSize = ois.readDouble(); shadowColor = (Color)ois.readObject(); gradientEndColor = (Color)ois.readObject(); gradientStartColor = (Color)ois.readObject(); gradientAngle = ois.readDouble(); gradientMidPoint = ois.readDouble(); } else { hasShadow = DEFAULT_SHADOW_HAS; shadowAngle = DEFAULT_SHADOW_ANGLE; shadowSize = DEFAULT_SHADOW_SIZE; shadowColor = DEFAULT_SHADOW_COLOR; gradientEndColor = PSTricksConstants.DEFAULT_GRADIENT_END_COLOR; gradientStartColor = PSTricksConstants.DEFAULT_GRADIENT_START_COLOR; gradientAngle = DEFAULT_GRADIENT_ANGLE; gradientMidPoint = DEFAULT_GRADIENT_MID_POINT; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.8")>=0) //$NON-NLS-1$ hatchingSep = ois.readDouble(); else hatchingSep = DEFAULT_HATCH_SEP; canHaveShadow = true; setThickness(thick); updateStyleOfDelimitors(); shape = getInsideOutsideOrMiddleBorders(); } @Override public boolean isIn(LaTeXDrawPoint2D p) { LaTeXDrawPoint2D pt = rotateInvertPoint(p); if(isSelected() && (dNW.isIn(pt) || dSE.isIn(pt) || dSW.isIn(pt) || dNE.isIn(pt))) return true; LaTeXDrawPoint2D NW = getTheNWNonRotatedBoundPoint(); LaTeXDrawPoint2D SE = getTheSENonRotatedBoundPoint(); Rectangle2D.Double s = new Rectangle2D.Double(NW.x, NW.y, Math.abs(NW.x - SE.x), Math.abs(NW.y - SE.y)); if (!s.contains(pt)) return false; if(isFilled || hasShadow || hasGradient()) return true; Shape s2; if (hasDoubleBoundary) s2 = new Rectangle2D.Double(NW.x + thickness * 2 + doubleSep, NW.y + thickness * 2 + doubleSep, Math.abs(NW.x - SE.x) - 4 * thickness - 2 * doubleSep, Math.abs(NW.y - SE.y) - 4 * thickness - 2 * doubleSep); else s2 = new Rectangle2D.Double(NW.x + thickness, NW.y + thickness, Math.abs(NW.x - SE.x) - 2 * thickness, Math.abs(NW.y - SE.y) - 2 * thickness); return !s2.contains(pt); } @Override public synchronized void onClick(Point p) { updateNSEWDelimitors(); LaTeXDrawPoint2D pt = rotateInvertPoint(p); if(dSE.isIn(pt)) dSelected = dSE; else if(dNW.isIn(pt)) dSelected = dNW; else if(dNE.isIn(pt)) dSelected = dNE; else if(dSW.isIn(pt)) dSelected = dSW; isSelected = true; } @Override public void updateToGrid(MagneticGrid grid) { LaTeXDrawPoint2D pt0 = getPoint(0); LaTeXDrawPoint2D pt1 = getPoint(1); LaTeXDrawPoint2D pt2 = getPoint(2); LaTeXDrawPoint2D pt3 = getPoint(3); pt0.setLocation(grid.getTransformedPointToGrid(pt0, false)); pt1.setLocation(grid.getTransformedPointToGrid(pt1, false)); width = Math.abs(pt0.x-pt1.x); pt2.x = pt0.x; pt2.y = pt0.y + width; pt3.x = pt1.x; pt3.y = pt1.y + width; dNW.setCoordinates(pt0); dNE.setCoordinates(pt1); dSW.setCoordinates(getPoint(2)); dSE.setCoordinates(getPoint(3)); updateShape(); } @Override public int hashCode() { return super.hashCode()+(int)width; } } latexdraw-2.0.8+1.orig/latexDraw/figures/Grid.java0000644000000000000000000004712611347255510016641 0ustar package latexDraw.figures; import java.awt.*; import java.awt.geom.Line2D; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.ObjectInputStream; import latexDraw.psTricks.DviPsColors; import latexDraw.psTricks.PSTricksConstants; import latexDraw.ui.LaTeXDrawFrame; import latexDraw.ui.components.MagneticGrid; import latexDraw.util.LaTeXDrawNumber; import latexDraw.util.LaTeXDrawPoint2D; /** * This class defines a grid.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 06/06/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class Grid extends GridShape { private static final long serialVersionUID = 1L; /** The colour of the sub-grid. */ protected Color subGridColor; /** The size of the labels. */ protected int gridLabelsSize; /** The number of division in a sub-grid. */ protected int subGridDiv; /** The thickness of the main borders of the grid. */ protected float gridWidth; /** The colour of the labels */ protected Color gridLabelsColor; /** The number of dots in the lines of the grid * ( if >0, replace a plain line) */ protected int gridDots; /** The thickness of the lines of the sub-grid */ protected float subGridWidth; /** The number of dots in the lines of the sub-grid * ( if >0, replace a plain line) */ protected int subGridDots; /** The unit of the grid */ protected double unit; /** The minimum possible size of the labels */ public static final int MIN_LABELS_SIZE = 5; /** The size of the label by default */ public static final int DEFAULT_LABELSSIZE = (int)PSTricksConstants.DEFAULT_GRID_LABEL; /** * The constructor using two arguments. * @param pos The current position of the south-west point of the grid. */ public Grid(LaTeXDrawPoint2D pos, boolean increaseMeter) { super(pos, increaseMeter); gridDots = PSTricksConstants.DEFAULT_GRIDDOTS; gridLabelsColor = PSTricksConstants.DEFAULT_LABELGRIDCOLOR; gridLabelsSize = DEFAULT_LABELSSIZE; gridWidth = (float)PSTricksConstants.DEFAULT_GRID_WIDTH*PPC; subGridColor = PSTricksConstants.DEFAULT_SUB_GRID_COLOR; subGridDiv = PSTricksConstants.DEFAULT_SUBGRIDDIV; subGridDots = PSTricksConstants.DEFAULT_SUBGRIDDOTS; subGridWidth = (float)PSTricksConstants.DEFAULT_SUB_GRID_WIDTH*PPC; unit = PSTricksConstants.DEFAULT_UNIT; BufferedImage bufferImage = new BufferedImage(2, 2, BufferedImage.TYPE_INT_RGB); Graphics2D g = bufferImage.createGraphics(); font = new Font(g.getFont().getName(), Font.PLAIN, gridLabelsSize); g.dispose(); bufferImage.flush(); updateFonts(); updateShape(); } /** * @return Returns the gridDots. */ public synchronized int getGridDots() { return gridDots; } /** * @param gridDots The gridDots to set. */ public synchronized void setGridDots(int gridDots) { if(gridDots>=0) this.gridDots = gridDots; } /** * @return Returns the gridLabelsColor. */ public synchronized Color getGridLabelsColor() { return gridLabelsColor; } /** * @param gridLabelsColor The gridLabelsColor to set. */ public synchronized void setGridLabelsColor(Color gridLabelsColor) { if(gridLabelsColor!=null) this.gridLabelsColor = gridLabelsColor; } /** * @return Returns the gridLabelsSize. */ public synchronized int getGridLabelsSize() { return gridLabelsSize; } /** * @param gridLabelsSize The gridLabelsSize to set. */ public synchronized void setGridLabelsSize(int gridLabelsSize) { this.gridLabelsSize = gridLabelsSize; if(gridLabelsSize>0) updateFonts(); } /** * @return Returns the gridWidth. */ public synchronized float getGridWidth() { return gridWidth; } /** * @param gridWidth The gridWidth to set. */ public synchronized void setGridWidth(float gridWidth) { if(gridWidth>0) this.gridWidth = gridWidth; } /** * @return Returns the subGridColor. */ public synchronized Color getSubGridColor() { return subGridColor; } /** * @param subGridColor The subGridColor to set. */ public synchronized void setSubGridColor(Color subGridColor) { if(subGridColor!=null) this.subGridColor = subGridColor; } /** * @return Returns the subGridDiv. */ public synchronized int getSubGridDiv() { return subGridDiv; } /** * @param subGridDiv The subGridDiv to set. */ public synchronized void setSubGridDiv(int subGridDiv) { if(subGridDiv>=0) this.subGridDiv = subGridDiv; } /** * @return Returns the subGridDots. */ public synchronized int getSubGridDots() { return subGridDots; } /** * @param subGridDots The subGridDots to set. */ public synchronized void setSubGridDots(int subGridDots) { if(subGridDots>=0) this.subGridDots = subGridDots; } /** * @return Returns the subGridWidth. */ public synchronized float getSubGridWidth() { return subGridWidth; } /** * @param subGridWidth The subGridWidth to set. */ public synchronized void setSubGridWidth(float subGridWidth) { if(subGridWidth>0) this.subGridWidth = subGridWidth; } @Override public Object clone() throws CloneNotSupportedException { Grid g = (Grid)super.clone(); g.gridDots = gridDots; g.gridLabelsColor = gridLabelsColor; g.gridLabelsSize = gridLabelsSize; g.gridWidth = gridWidth; g.subGridColor = subGridColor; g.subGridDiv = subGridDiv; g.subGridDots = subGridDots; g.subGridWidth = subGridWidth; g.unit = unit; return g; } @Override public void draw(Graphics2D g, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering) { if(g==null || antiAlias==null || rendering==null || alphaInter==null || colorRendering==null) throw new IllegalArgumentException(); Font formerFont = g.getFont(); Color formerCol = g.getColor(); g.setFont(getFont()); updateBorders(); double XStep = PPC*unit, i, j, XSubStep, k, l, m, n; double YStep = XStep, YSubStep; XStep *= gridEnd.x0) { double dotStep = (unit*PPC)/(subGridDots*subGridDiv); double nbX = (maxX-minX)*subGridDiv; double nbY = (maxY-minY)*subGridDiv; g.setStroke(new BasicStroke(subGridWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER)); for(i=0, n=NW.x; i1) { g.setStroke(new BasicStroke(subGridWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER)); for(k=minX, i=posX; k0) { double dotStep = (unit*PPC)/gridDots; g.setStroke(new BasicStroke(gridWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER)); for(k=minX, i=posX; k<=maxX; i+=XStep, k++) for(m=NW.y, n=minY; n0) { // We draw the labels float labelHeight = fontMetrics.getAscent(); float labelWidth = fontMetrics.stringWidth(String.valueOf((int)maxX)); String label; double xorigin = position.x+XStep*origin.x; double yorigin = isXLabelSouth ? position.y-YStep*origin.y+labelHeight : position.y-YStep*origin.y-2; double width=gridWidth/2., tmp = isXLabelSouth ? width : -width; g.setColor(gridLabelsColor); for(i=NW.x + (isYLabelWest ? width+gridLabelsSize/4. : -width-labelWidth-gridLabelsSize/4.), j=minX; j<=maxX; i+=absStep, j++) g.drawString(String.valueOf((int)j), (int)i, (int)(yorigin+tmp)); if(isYLabelWest) for(i=NW.y + (isXLabelSouth ? -width-gridLabelsSize/4. : width+labelHeight), j=maxY ; j>=minY; i+=absStep, j--) { label = String.valueOf((int)j); g.drawString(label, (int)(xorigin-fontMetrics.stringWidth(label)-gridLabelsSize/4.-width), (int)i); } else for(i=NW.y + (isXLabelSouth ? -width-gridLabelsSize/4. : width+labelHeight), j=maxY; j>=minY; i+=absStep, j--) { label = String.valueOf((int)j); g.drawString(label, (int)(xorigin+gridLabelsSize/4.+width), (int)i); } } if(rotationAngle%(Math.PI*2)!=0) { g.translate(-c3x, -c3y); g.rotate(-rotationAngle); } g.setFont(formerFont); g.setColor(formerCol); updateBorders(fontMetrics); if(isSelected) borders.draw(g, false, antiAlias, rendering, alphaInter, colorRendering); } /** * Allows to update the borders of the grid (without labels) */ @Override public synchronized void updateBorders() { if(borders==null) borders = new LaTeXDrawRectangle(false); double step = PPC*unit; double posX = position.x; double posY = position.y; double minX = gridEnd.xlabelMin.length() ? labelMax : labelMin; double NWxGap=0; double NWyGap=0; double SExGap=0; double SEyGap=0; double step = PPC*unit; if(gridStart.x>origin.x) NWxGap=origin.x-gridStart.x; else if(gridEnd.xorigin.y) SEyGap=gridStart.y-origin.y; else if(gridEnd.y *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class Dot extends Figure { private static final long serialVersionUID = 1L; /** The centre of the dot */ private LaTeXDrawPoint2D center; /** The thickness of the dot by default */ public static final int DEFAULT_WIDTH = 6; /** Useful to calculate the thickness of dot with o style */ public static final float THICKNESS_o_STYLE_FACTOR = 16 ; /** The style of the dot by default */ public static final String DEFAULT_DOT_STYLE = PSTricksConstants.DEFAULT_DOT_STYLE; /** Corresponds to the golden angle (Useful for golden diamond) */ public final double GOLDEN_ANGLE = 0.553574; /** The gap used to draw a plus */ private double plusGap; /** The thickness of the plus shape is computes with that coefficient */ public static final double PLUS_COEFF_WIDTH = 6.5; /** The gap used to draw a cross */ private double crossGap; /** The gap used to draw a vertical bar */ private double barGap; /** The thickness used to draw a vertical bar */ private double barThickness; /** The current style of the circle */ private String currentStyle; /** The width of the circle */ private float width; private Delimitor d; /** * The constructor by default. */ public Dot(boolean increaseMeter) { this(new LaTeXDrawPoint2D(), increaseMeter); } /** * The constructor by copy. * @param pt The new centre of the dot. */ public Dot(LaTeXDrawPoint2D pt, boolean increaseMeter) { this(pt, DEFAULT_DOT_STYLE, DEFAULT_WIDTH, increaseMeter); } /** * The constructor by copy. * @param pt The new centre of the dot. * @param style The style of the dot. * @param size The size of the dot. */ public Dot(LaTeXDrawPoint2D pt, String style, float size, boolean increaseMeter) { super(increaseMeter); canHaveShadow = false; isBordersMovable = false; isDashableOrDotable = false; isDoubleBoundaryable= false; isResizable = false; isThicknessable = false; d = new Delimitor(); center = pt; width = size; updateGap(); currentStyle = style; updateDelimitor(); updateBorders(); updateShape(); updateCanBeFilled(); updateGravityCenter(); } @Deprecated @Override public synchronized void setIsFilled(boolean state) { /* * A dot is always filled. */ } /** * Allows to update the delimiter following the size of the dot */ public void updateDelimitor() { if(width<30) d.setCoordinates(center.x+width*2./3., center.y-width*2./3.); else d.setCoordinates(center.x+width/2., center.y-width/2.); } /** * Allows to get the centre of the dot * @return The centre of the dot */ public synchronized LaTeXDrawPoint2D getCenter() { return center; } /** * Allows to update the values of the gaps */ public void updateGap() { plusGap = width/160.; crossGap = width/10.; barGap = width/3.75; barThickness = width/8.; } /** * Allows to set the width of the dot * @param w The width of the dot */ public synchronized void setWidth(float w) { if(w<=0) throw new IllegalArgumentException(); width = w; updateGap(); updateDelimitor(); updateBorders(); updateShape(); } /** * Allows to get the width of the circle * @return The width of the circle */ public synchronized float getWidth() { return width; } /** * Allows to set the style of the dot * @param newStyle The new style of the dot * @throws IllegalArgumentException If the new style is not valid. */ public synchronized void setCurrentStyle(String newStyle) { if(!PSTricksConstants.isValidDotStyle(newStyle)) throw new IllegalArgumentException(); currentStyle = newStyle; updateCanBeFilled(); updateBorders(); updateShape(); updateGravityCenter(); } public void updateBorders() { updateGap(); Shape s = createNonRotatedShape2D(); Rectangle2D rec = s.getBounds2D(); if(borders==null) borders = new LaTeXDrawRectangle(false); borders.setFirstPoint(new LaTeXDrawPoint2D(rec.getMinX(), rec.getMinY())); borders.setLastPoint(new LaTeXDrawPoint2D(rec.getMaxX(), rec.getMaxY())); } /** * Allows to get the current style of the dot * @return The current style of the dot */ public synchronized String getCurrentStyle() { return currentStyle; } @Override public void onDragged(Point formerPt, Point newPt) { if(formerPt.equals(newPt)) return; if(dSelected==d) { if(isOnRotation) rotate(formerPt, newPt); else { LaTeXDrawPoint2D pt = Figure.rotatePoint(new LaTeXDrawPoint2D(newPt), borders.gravityCenter, -rotationAngle); float w = (float)(Math.abs(pt.x-center.x)*2.); if(w>0) setWidth(w); updateDelimitor(); } updateShape(); } else shift(formerPt, newPt); } @Override public synchronized Color getInteriorColor() { if(canBeFilled) return interiorColor; return Color.BLACK; } @Override public void draw(Graphics2D g, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering) { LaTeXDrawPoint2D NW = new LaTeXDrawPoint2D(center.x-width/2., center.y-width/2.); LaTeXDrawPoint2D SE = new LaTeXDrawPoint2D(center.x+width/2., center.y+width/2.); LaTeXDrawPoint2D NW2 = getTheNWPoint(), SE2 = getTheSEPoint(); float dec = width/THICKNESS_o_STYLE_FACTOR; double cx = (NW2.x+SE2.x)/2., cy = (NW2.y+SE2.y)/2.; double c2x = Math.cos(rotationAngle)*cx - Math.sin(rotationAngle)*cy; double c2y = Math.sin(rotationAngle)*cx + Math.cos(rotationAngle)*cy; double c3x = Math.cos(-rotationAngle)*(cx-c2x) - Math.sin(-rotationAngle)*(cy-c2y); double c3y = Math.sin(-rotationAngle)*(cx-c2x) + Math.cos(-rotationAngle)*(cy-c2y); if(rotationAngle%(Math.PI*2)!=0) { g.rotate(rotationAngle); g.translate(c3x,c3y); } Color formerCol = g.getColor(); if(currentStyle.equals(PSTricksConstants.DOT_STYLE)) { g.setColor(linesColor); Ellipse2D.Double e = new Ellipse2D.Double(NW.x, NW.y, width, width); g.fill(e); } else if(currentStyle.equals(PSTricksConstants.O_STYLE) || currentStyle.equals(PSTricksConstants.OPLUS_STYLE) || currentStyle.equals(PSTricksConstants.OTIMES_STYLE)) { if(currentStyle.equals(PSTricksConstants.O_STYLE)) dec = (float)(width*(0.1/3.6))*2; else dec = (float)(width*(0.1/2.6))*2; Ellipse2D.Double e = new Ellipse2D.Double(NW.x+dec/2., NW.y+dec/2., width-dec, width-dec); if(!currentStyle.equals(PSTricksConstants.OPLUS_STYLE) && !currentStyle.equals(PSTricksConstants.OTIMES_STYLE)) { g.setColor(isFilled ? interiorColor : Color.WHITE); g.fill(e); } g.setColor(linesColor); g.setStroke(new BasicStroke(dec, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.draw(e); if(currentStyle.equals(PSTricksConstants.OPLUS_STYLE)) { g.draw(new Line2D.Double((NW.x+SE.x)/2., NW.y+dec*2, (NW.x+SE.x)/2., SE.y-dec*2)); g.draw(new Line2D.Double(NW.x+dec*2, (NW.y+SE.y)/2., SE.x-dec*2, (NW.y+SE.y)/2.)); } else if(currentStyle.equals(PSTricksConstants.OTIMES_STYLE)) { LaTeXDrawPoint2D p1 = new LaTeXDrawPoint2D((NW.x+SE.x)/2., NW.y+dec*2); LaTeXDrawPoint2D p2 = new LaTeXDrawPoint2D((NW.x+SE.x)/2., SE.y-dec*2); p1 = rotatePoint(p1, Math.PI/4.); p2 = rotatePoint(p2, Math.PI/4.); g.draw(new Line2D.Double(p1.x, p1.y, p2.x, p2.y)); p1.setLocation(NW.x+dec*2, (NW.y+SE.y)/2.); p2.setLocation(SE.x-dec*2, (NW.y+SE.y)/2.); p1 = rotatePoint(p1, Math.PI/4.); p2 = rotatePoint(p2, Math.PI/4.); g.draw(new Line2D.Double(p1.x, p1.y, p2.x, p2.y)); } } else if(currentStyle.equals(PSTricksConstants.BAR_STYLE)) { g.setColor(linesColor); g.setStroke(new BasicStroke((float)barThickness, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER)); g.draw(new Line2D.Double((NW.x+SE.x)/2.,NW.y+barThickness/2.,(NW.x+SE.x)/2., SE.y+ barGap)); } else if(currentStyle.equals(PSTricksConstants.PLUS_STYLE)) { g.setColor(linesColor); g.setStroke(new BasicStroke((float) (width/PLUS_COEFF_WIDTH), BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER)); GeneralPath gp = new GeneralPath(); gp.moveTo((float)((NW.x+SE.x)/2.), (float)(NW.y-plusGap)); gp.lineTo((float)((NW.x+SE.x)/2.), (float)(SE.y+plusGap)); gp.moveTo((float)(NW.x-plusGap), (float)((NW.y+SE.y)/2.)); gp.lineTo((float)(SE.x+plusGap), (float)((NW.y+SE.y)/2.)); g.draw(gp); } else if(currentStyle.equals(PSTricksConstants.SQUARE_STYLE) || currentStyle.equals(PSTricksConstants.FSQUARE_STYLE)) { if(currentStyle.equals(PSTricksConstants.SQUARE_STYLE)) if(isFilled) g.setColor(interiorColor); else g.setColor(Color.WHITE); else g.setColor(linesColor); dec = (float)(width*(0.1/4))*2; g.fill(new Rectangle2D.Double(NW.x+dec*1.5, NW.y+dec*1.5, width-dec*3, width-dec*3)); g.setStroke(new BasicStroke(dec, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.setColor(linesColor); g.draw(new Rectangle2D.Double(NW.x+dec+dec/2., NW.y+dec+dec/2., width-dec*3, width-dec*3)); } else if(currentStyle.equals(PSTricksConstants.TRIANGLE_STYLE) || currentStyle.equals(PSTricksConstants.FTRIANGLE_STYLE) || currentStyle.equals(PSTricksConstants.DIAMOND_STYLE) || currentStyle.equals(PSTricksConstants.FDIAMOND_STYLE) || currentStyle.equals(PSTricksConstants.PENTAGON_STYLE) || currentStyle.equals(PSTricksConstants.FPENTAGON_STYLE)) { Polygon p; if(currentStyle.equals(PSTricksConstants.TRIANGLE_STYLE) || currentStyle.equals(PSTricksConstants.FTRIANGLE_STYLE)) p = createTriangle(); else if(currentStyle.equals(PSTricksConstants.DIAMOND_STYLE) || currentStyle.equals(PSTricksConstants.FDIAMOND_STYLE)) p = createDiamond(); else p = createPentagon(); if(currentStyle.equals(PSTricksConstants.TRIANGLE_STYLE) || currentStyle.equals(PSTricksConstants.DIAMOND_STYLE) || currentStyle.equals(PSTricksConstants.PENTAGON_STYLE)) if(isFilled) g.setColor(interiorColor); else g.setColor(Color.WHITE); else g.setColor(linesColor); g.fill(p); g.setStroke(new BasicStroke(dec, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER)); g.setColor(linesColor); g.draw(p); } else if(currentStyle.equals(PSTricksConstants.X_STYLE)) { g.setColor(linesColor); g.setStroke(new BasicStroke((float)crossGap, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER)); GeneralPath gp = new GeneralPath(); gp.moveTo((float)(NW.x+crossGap), (float)(NW.y+crossGap)); gp.lineTo((float)(SE.x-crossGap), (float)(SE.y-crossGap)); gp.moveTo((float)(SE.x-crossGap), (float)(NW.y+crossGap)); gp.lineTo((float)(NW.x+crossGap), (float)(SE.y-crossGap)); g.draw(gp); } else if(currentStyle.equals(PSTricksConstants.ASTERISK_STYLE)) { g.setColor(linesColor); g.setStroke(new BasicStroke(dec, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER)); double xCenter = (NW.x+SE.x)/2., yCenter = (NW.y+SE.y)/2.; double radius = Math.abs((NW.y+width/10.)-(SE.y-width/10.))/2. + dec; g.draw(new Line2D.Double((NW.x+SE.x)/2.,NW.y+width/10.-dec, (NW.x+SE.x)/2.,SE.y-width/10.+dec)); g.draw(new Line2D.Double((Math.cos(Math.PI/6.)*radius+xCenter), radius/2. + yCenter, Math.cos(7*Math.PI/6.)*radius+xCenter, Math.sin(7*Math.PI/6.)*radius+yCenter)); g.draw(new Line2D.Double((Math.cos(5*Math.PI/6.)*radius+xCenter), Math.sin(5*Math.PI/6.)*radius+yCenter, Math.cos(11*Math.PI/6.)*radius+xCenter, Math.sin(11*Math.PI/6.)*radius+yCenter)); } if(d!=null && isSelected) d.draw(g); g.setColor(formerCol); if(rotationAngle%(Math.PI*2)!=0) { g.translate(-c3x,-c3y); g.rotate(-rotationAngle); } } /** * Allows to create a triangle (one of the possibles shapes of a dot). * @return The triangle */ public Polygon createTriangle() { double NWx = center.x-width/2., NWy = center.y-width/2.; double SEx = center.x+width/2., SEy = center.y+width/2.; float dec = width/THICKNESS_o_STYLE_FACTOR; int nbPts = 3, xs[] = new int[nbPts], ys[] = new int[nbPts]; xs[0] = (int) ((SEx + NWx)/2); ys[0] = (int) (NWy-1.5*dec); xs[1] = (int) ((int) (NWx)-0.3*dec); ys[1] = (int) (SEy-3*dec); xs[2] = (int) ((int) (SEx)+0.3*dec); ys[2] = (int) (SEy-3*dec); return new Polygon(xs, ys, nbPts); } /** * Allows to create a pentagon (one of the possibles shapes of a dot) * @return The pentagon */ public Polygon createPentagon() { double NWx = center.x-width/2., NWy = center.y-width/2.; double SEx = center.x+width/2., SEy = center.y+width/2.; float dec = width/THICKNESS_o_STYLE_FACTOR; int nbPts = 5, xs[] = new int[nbPts], ys[] = new int[nbPts]; double yCenter = (NWy+SEy)/2. - dec; double xCenter = (NWx+SEx)/2.; double dist = Math.abs(NWy-SEy)/2. + dec; double c1 = 0.25*(Math.sqrt(5)-1.)*dist, s1 = Math.sin(2*Math.PI/5.)*dist, c2 = 0.25*(Math.sqrt(5)+1.)*dist, s2 = Math.sin(4*Math.PI/5.)*dist; xs[0] = (int)xCenter; xs[1] = (int)(s1 + xCenter); xs[2] = (int)(s2 + xCenter); xs[3] = (int)(-s2 + xCenter); xs[4] = (int)(-s1 + xCenter); ys[0] = (int)(NWy-dec); ys[1] = ys[4] = (int) (-c1 + yCenter + dec); ys[2] = ys[3] = (int) (c2 + yCenter + dec); return new Polygon(xs, ys, nbPts); } /** * Allows to create a list of the different style of the dot * @return The list */ public static LaTeXDrawComboBox createDotStyleChoice() { LaTeXDrawComboBox dotChoice = new LaTeXDrawComboBox(); dotChoice.setRenderer(new LabelListCellRenderer()); JLabel label = new JLabel(PSTricksConstants.DOT_STYLE); label.setName(PSTricksConstants.DOT_STYLE); label.setIcon(LaTeXDrawResources.dotStyleNoneIcon); dotChoice.addItem(label); label = new JLabel(PSTricksConstants.ASTERISK_STYLE); label.setName(PSTricksConstants.ASTERISK_STYLE); label.setIcon(LaTeXDrawResources.dotStyleAsteriskIcon); dotChoice.addItem(label); label = new JLabel(PSTricksConstants.BAR_STYLE); label.setName(PSTricksConstants.BAR_STYLE); label.setIcon(LaTeXDrawResources.dotStyleBarIcon); dotChoice.addItem(label); label = new JLabel(PSTricksConstants.DIAMOND_STYLE); label.setName(PSTricksConstants.DIAMOND_STYLE); label.setIcon(LaTeXDrawResources.dotStyleDiamondIcon); dotChoice.addItem(label); label = new JLabel(PSTricksConstants.FDIAMOND_STYLE); label.setName(PSTricksConstants.FDIAMOND_STYLE); label.setIcon(LaTeXDrawResources.dotStyleDiamondFIcon); dotChoice.addItem(label); label = new JLabel(PSTricksConstants.O_STYLE); label.setName(PSTricksConstants.O_STYLE); label.setIcon(LaTeXDrawResources.dotStyleOIcon); dotChoice.addItem(label); label = new JLabel(PSTricksConstants.OPLUS_STYLE); label.setName(PSTricksConstants.OPLUS_STYLE); label.setIcon(LaTeXDrawResources.dotStyleOPlusIcon); dotChoice.addItem(label); label = new JLabel(PSTricksConstants.OTIMES_STYLE); label.setName(PSTricksConstants.OTIMES_STYLE); label.setIcon(LaTeXDrawResources.dotStyleOCrossIcon); dotChoice.addItem(label); label = new JLabel(PSTricksConstants.PLUS_STYLE); label.setName(PSTricksConstants.PLUS_STYLE); label.setIcon(LaTeXDrawResources.dotStylePlusIcon); dotChoice.addItem(label); label = new JLabel(PSTricksConstants.X_STYLE); label.setName(PSTricksConstants.X_STYLE); label.setIcon(LaTeXDrawResources.dotStyleCrossIcon); dotChoice.addItem(label); label = new JLabel(PSTricksConstants.TRIANGLE_STYLE); label.setName(PSTricksConstants.TRIANGLE_STYLE); label.setIcon(LaTeXDrawResources.dotStyleTriangleIcon); dotChoice.addItem(label); label = new JLabel(PSTricksConstants.FTRIANGLE_STYLE); label.setName(PSTricksConstants.FTRIANGLE_STYLE); label.setIcon(LaTeXDrawResources.dotStyleTriangleFIcon); dotChoice.addItem(label); label = new JLabel(PSTricksConstants.PENTAGON_STYLE); label.setName(PSTricksConstants.PENTAGON_STYLE); label.setIcon(LaTeXDrawResources.dotStylePentagonIcon); dotChoice.addItem(label); label = new JLabel(PSTricksConstants.FPENTAGON_STYLE); label.setName(PSTricksConstants.FPENTAGON_STYLE); label.setIcon(LaTeXDrawResources.dotStylePentagonFIcon); dotChoice.addItem(label); label = new JLabel(PSTricksConstants.SQUARE_STYLE); label.setName(PSTricksConstants.SQUARE_STYLE); label.setIcon(LaTeXDrawResources.dotStyleSquareIcon); dotChoice.addItem(label); label = new JLabel(PSTricksConstants.FSQUARE_STYLE); label.setName(PSTricksConstants.FSQUARE_STYLE); label.setIcon(LaTeXDrawResources.dotStyleSquareFIcon); dotChoice.addItem(label); return dotChoice; } /** * Allows to create a diamond (one of the possibles shapes of a dot) * @return The golden diamond */ public Polygon createDiamond() { double NWx = center.x-width/2., NWy = center.y-width/2.; double SEx = center.x+width/2., SEy = center.y+width/2.; float dec = width/THICKNESS_o_STYLE_FACTOR; // This diamond is a golden diamond // cf. http://mathworld.wolfram.com/GoldenRhombus.html int nbPts = 4, xs[] = new int[nbPts], ys[] = new int[nbPts]; double a = Math.abs((NWx-SEx))/(2.*Math.sin(GOLDEN_ANGLE)); double p = 2*a*Math.cos(GOLDEN_ANGLE); xs[1] = (int) ((SEx)-dec-.5*dec); ys[1] = (int)(NWy+SEy)/2; xs[3] = (int) ((NWx)+dec+.5*dec); ys[3] = (int)(NWy+SEy)/2; xs[0] = (xs[1]+xs[3])>>>1; ys[0] = (int) ((NWy+SEy)/2+p/2.-dec-.5*dec); xs[2] = (xs[1]+xs[3])>>>1; ys[2] = (int) ((NWy+SEy)/2-p/2.+dec+.5*dec); return new Polygon(xs, ys, nbPts); } @Override public boolean isIn(LaTeXDrawPoint2D pt) { if(isSelected() && d.isIn(Figure.rotatePoint(pt, borders.gravityCenter, -rotationAngle))) return true; if(shape==null) updateShape(); boolean ok = shape.contains(pt); if(!ok && isFilled) ok = createUnstrokedShape2D().contains(pt); return ok; } @Override public String getCodePSTricks(DrawBorders drawBorders, float ppc) { double threshold = 0.001; LaTeXDrawPoint2D o = drawBorders.getOriginPoint(); double x = center.x - o.x, y = o.y - center.y; String start = "", end = "", add = ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ if(!linesColor.equals(PSTricksConstants.DEFAULT_LINE_COLOR)) { // add colour code String name = DviPsColors.getColourName(linesColor); if(name==null) { name = "color"+number;//$NON-NLS-1$ DviPsColors.addUserColour(linesColor, name); } add += ",linecolor="+name; //$NON-NLS-1$ } if(canBeFilled) { add+= ",fillstyle=solid"; //$NON-NLS-1$ if(!interiorColor.equals(PSTricksConstants.DEFAULT_INTERIOR_COLOR)) { String name = DviPsColors.getColourName(interiorColor); if(name==null) { name = "color"+number+'b';//$NON-NLS-1$ DviPsColors.addUserColour(interiorColor, name); } add+= ",fillcolor="+name; //$NON-NLS-1$ } } if(rotationAngle%(Math.PI*2)!=0.) { LaTeXDrawPoint2D tmp = Figure.rotatePoint(center, borders.gravityCenter, rotationAngle); float tmpX = (float)(tmp.x-center.x), tmpY = (float)(center.y-tmp.y) ; add +=",dotangle="+(float)(Math.toDegrees(-rotationAngle)); //$NON-NLS-1$ if(tmpX!=0f && tmpY!=0f) { start = "\\rput("+LaTeXDrawNumber.getCutNumber(tmpX/ppc,threshold)+", "+ LaTeXDrawNumber.getCutNumber(tmpY/ppc,threshold) +"){"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ end = "}"; //$NON-NLS-1$ } } if(!currentStyle.equals(PSTricksConstants.DOT_STYLE)) add +=",dotstyle="+currentStyle; //$NON-NLS-1$ return start + "\\psdots[dotsize=" + LaTeXDrawNumber.getCutNumber(width/ppc,threshold) + add //$NON-NLS-1$ + "](" + LaTeXDrawNumber.getCutNumber((float)(x/ppc),threshold) + ',' + LaTeXDrawNumber.getCutNumber((float)(y/ppc),threshold) + ')' + end;//$NON-NLS-1$ } @Override public void onClick(Point p) { isSelected = true; LaTeXDrawPoint2D pt = Figure.rotatePoint(new LaTeXDrawPoint2D(p), borders.gravityCenter, -rotationAngle); if(d.isIn(pt)) dSelected = d; } @Override public synchronized void onRelease() { isSelected = false; dSelected = null; setOnRotation(false); } @Override public void shift(double shiftX, double shiftY) { if(shiftX==0 && shiftY==0) return ; center.x+=shiftX; center.y+=shiftY; updateDelimitor(); updateBorders(); updateShape(); updateGravityCenter(); } @Override @Deprecated public synchronized void setLastPoint(double x, double y) { /* * Nothing to do. */ } @Override @Deprecated public synchronized void setFirstPoint(double x, double y) { /* * Nothing to do. */ } @Override public boolean canBeHatched() { return false; } @Override public Object clone() throws CloneNotSupportedException { Dot dot = (Dot) super.clone(); dot.center = (LaTeXDrawPoint2D)center.clone(); dot.barGap = barGap; dot.barThickness = barThickness; dot.crossGap = crossGap; dot.currentStyle = currentStyle; dot.plusGap = plusGap; dot.width = width; dot.d = (Delimitor) d.clone(); dot.updateShape(); dot.borders = null; dot.updateBorders(); dot.updateCanBeFilled(); dot.updateGravityCenter(); return dot; } @Override public void updateStyleOfDelimitors() { if(isOnRotation) d.setColorSet4(); else d.setColorSet1(); } @Override public Shape createNonRotatedShape2D() { LaTeXDrawPoint2D NW = new LaTeXDrawPoint2D(center.x-width/2., center.y-width/2.); LaTeXDrawPoint2D SE = new LaTeXDrawPoint2D(center.x+width/2., center.y+width/2.); float dec = width/THICKNESS_o_STYLE_FACTOR; if(currentStyle.equals(PSTricksConstants.DOT_STYLE) || currentStyle.equals(PSTricksConstants.O_STYLE) || currentStyle.equals(PSTricksConstants.OPLUS_STYLE) || currentStyle.equals(PSTricksConstants.OTIMES_STYLE)) return new Ellipse2D.Double(NW.x, NW.y, width, width); if(currentStyle.equals(PSTricksConstants.BAR_STYLE)) { BasicStroke wideline = new BasicStroke((float)barThickness); Shape outline = wideline.createStrokedShape(new Line2D.Double((NW.x+SE.x)/2., NW.y+barThickness/2.,(NW.x+SE.x)/2., SE.y + barGap)); return outline; } if(currentStyle.equals(PSTricksConstants.PLUS_STYLE)) { GeneralPath gp = new GeneralPath(); gp.moveTo((float)((NW.x+SE.x)/2.), (float)(NW.y-plusGap)); gp.lineTo((float)((NW.x+SE.x)/2.), (float)(SE.y+plusGap)); gp.moveTo((float)(NW.x-plusGap), (float)((NW.y+SE.y)/2.)); gp.lineTo((float)(SE.x+plusGap), (float)((NW.y+SE.y)/2.)); BasicStroke wideline = new BasicStroke((float) (width/PLUS_COEFF_WIDTH)); Shape outline = wideline.createStrokedShape(gp); return outline; } if(currentStyle.equals(PSTricksConstants.SQUARE_STYLE) || currentStyle.equals(PSTricksConstants.FSQUARE_STYLE)) { BasicStroke wideline = new BasicStroke(dec); Shape outline = wideline.createStrokedShape( new Rectangle2D.Double(NW.x+dec, NW.y+dec, Math.abs(NW.x-SE.x)-2*dec, Math.abs(NW.y - SE.y)-2*dec)); return outline; } if(currentStyle.equals(PSTricksConstants.TRIANGLE_STYLE) || currentStyle.equals(PSTricksConstants.FTRIANGLE_STYLE)) { BasicStroke wideline = new BasicStroke(dec); Shape outline = wideline.createStrokedShape(createTriangle()); return outline; } if(currentStyle.equals(PSTricksConstants.DIAMOND_STYLE) || currentStyle.equals(PSTricksConstants.FDIAMOND_STYLE)) { BasicStroke wideline = new BasicStroke(dec); Shape outline = wideline.createStrokedShape(createDiamond()); return outline; } if(currentStyle.equals(PSTricksConstants.PENTAGON_STYLE) || currentStyle.equals(PSTricksConstants.FPENTAGON_STYLE)) { BasicStroke wideline = new BasicStroke(dec); Shape outline = wideline.createStrokedShape(createPentagon()); return outline; } if(currentStyle.equals(PSTricksConstants.X_STYLE)) { GeneralPath gp = new GeneralPath(); gp.moveTo((float)(NW.x+crossGap), (float)(NW.y+crossGap)); gp.lineTo((float)(SE.x-crossGap), (float)(SE.y-crossGap)); gp.moveTo((float)(SE.x-crossGap), (float)(NW.y+crossGap)); gp.lineTo((float)(NW.x+crossGap), (float)(SE.y-crossGap)); BasicStroke wideline = new BasicStroke((float)crossGap); Shape outline = wideline.createStrokedShape(gp); return outline; } if(currentStyle.equals(PSTricksConstants.ASTERISK_STYLE)) { double xCenter = (NW.x+SE.x)/2., yCenter = (NW.y+SE.y)/2.; double radius = Math.abs((NW.y+width/10.)-(SE.y-width/10.))/2. + dec; GeneralPath gp = new GeneralPath(); gp.moveTo((float)((NW.x+SE.x)/2.), (float)(NW.y+width/10.)-dec); gp.lineTo((float)((NW.x+SE.x)/2.), (float)(SE.y-width/10.)+dec); gp.moveTo((float)((Math.cos(Math.PI/6.)*radius+xCenter)), (float)(radius/2. + yCenter)); gp.lineTo((float)(Math.cos(7*Math.PI/6.)*radius+xCenter), (float)(Math.sin(7*Math.PI/6.)*radius+yCenter)); gp.moveTo((float)(Math.cos(5*Math.PI/6.)*radius+xCenter), (float)(Math.sin(5*Math.PI/6.)*radius+yCenter)); gp.lineTo((float)(Math.cos(11*Math.PI/6.)*radius+xCenter), (float)(Math.sin(11*Math.PI/6.)*radius+yCenter)); BasicStroke wideline = new BasicStroke(dec); Shape outline = wideline.createStrokedShape(gp); return outline; } return null; } /** * @return The rotated shape of the dot but the stroke is not taken in account. * @since 1.9.1 */ public synchronized Shape createUnstrokedShape2D() { Shape area = createNonRotatedUnstrokedShape2D(); if((rotationAngle % (2*PI)) != 0) { LaTeXDrawPoint2D NW = getTheNWPoint(), SE = getTheSEPoint(); double cx = (NW.x+SE.x)/2., cy = (NW.y+SE.y)/2.; double c2x = cos(rotationAngle)*cx - sin(rotationAngle)*cy; double c2y = sin(rotationAngle)*cx + cos(rotationAngle)*cy; AffineTransform at = AffineTransform.getTranslateInstance(cx - c2x, cy - c2y); at.rotate(rotationAngle); area = at.createTransformedShape(area); } return area; } /** * @return The shape of the dot but the stroke is not taken in account. * @since 1.9.1 */ public Shape createNonRotatedUnstrokedShape2D() { LaTeXDrawPoint2D NW = new LaTeXDrawPoint2D(center.x-width/2., center.y-width/2.); LaTeXDrawPoint2D SE = new LaTeXDrawPoint2D(center.x+width/2., center.y+width/2.); float dec = width/THICKNESS_o_STYLE_FACTOR; if(currentStyle.equals(PSTricksConstants.DOT_STYLE) || currentStyle.equals(PSTricksConstants.O_STYLE) || currentStyle.equals(PSTricksConstants.OPLUS_STYLE) || currentStyle.equals(PSTricksConstants.OTIMES_STYLE)) return new Ellipse2D.Double(NW.x, NW.y, width, width); if(currentStyle.equals(PSTricksConstants.BAR_STYLE)) return new Line2D.Double((NW.x+SE.x)/2.,NW.y+barThickness/2.,(NW.x+SE.x)/2., SE.y + barGap); if(currentStyle.equals(PSTricksConstants.PLUS_STYLE)) { GeneralPath gp = new GeneralPath(); gp.moveTo((float)((NW.x+SE.x)/2.), (float)(NW.y-plusGap)); gp.lineTo((float)((NW.x+SE.x)/2.), (float)(SE.y+plusGap)); gp.moveTo((float)(NW.x-plusGap), (float)((NW.y+SE.y)/2.)); gp.lineTo((float)(SE.x+plusGap), (float)((NW.y+SE.y)/2.)); return gp; } if(currentStyle.equals(PSTricksConstants.SQUARE_STYLE) || currentStyle.equals(PSTricksConstants.FSQUARE_STYLE)) return new Rectangle2D.Double(NW.x+dec, NW.y+dec, Math.abs(NW.x-SE.x)-2*dec, Math.abs(NW.y - SE.y)-2*dec); if(currentStyle.equals(PSTricksConstants.TRIANGLE_STYLE) || currentStyle.equals(PSTricksConstants.FTRIANGLE_STYLE)) return createTriangle(); if(currentStyle.equals(PSTricksConstants.DIAMOND_STYLE) || currentStyle.equals(PSTricksConstants.FDIAMOND_STYLE)) return createDiamond(); if(currentStyle.equals(PSTricksConstants.PENTAGON_STYLE) || currentStyle.equals(PSTricksConstants.FPENTAGON_STYLE)) return createPentagon(); if(currentStyle.equals(PSTricksConstants.X_STYLE)) { GeneralPath gp = new GeneralPath(); gp.moveTo((float)(NW.x+crossGap), (float)(NW.y+crossGap)); gp.lineTo((float)(SE.x-crossGap), (float)(SE.y-crossGap)); gp.moveTo((float)(SE.x-crossGap), (float)(NW.y+crossGap)); gp.lineTo((float)(NW.x+crossGap), (float)(SE.y-crossGap)); return gp; } if(currentStyle.equals(PSTricksConstants.ASTERISK_STYLE)) { double xCenter = (NW.x+SE.x)/2., yCenter = (NW.y+SE.y)/2.; double radius = Math.abs((NW.y+width/10.)-(SE.y-width/10.))/2. + dec; GeneralPath gp = new GeneralPath(); gp.moveTo((float)((NW.x+SE.x)/2.), (float)(NW.y+width/10.)-dec); gp.lineTo((float)((NW.x+SE.x)/2.), (float)(SE.y-width/10.)+dec); gp.moveTo((float)((Math.cos(Math.PI/6.)*radius+xCenter)), (float)(radius/2. + yCenter)); gp.lineTo((float)(Math.cos(7*Math.PI/6.)*radius+xCenter), (float)(Math.sin(7*Math.PI/6.)*radius+yCenter)); gp.moveTo((float)(Math.cos(5*Math.PI/6.)*radius+xCenter), (float)(Math.sin(5*Math.PI/6.)*radius+yCenter)); gp.lineTo((float)(Math.cos(11*Math.PI/6.)*radius+xCenter), (float)(Math.sin(11*Math.PI/6.)*radius+yCenter)); return gp; } return null; } @Override public void rescaleX(double formerX, double newX, double percent, LaTeXDrawRectangle bound) { if(percent==1.) return ; LaTeXDrawPoint2D NW = bound.getTheNWPoint(), SE = bound.getTheSEPoint(),farest; if(Math.abs(newX-SE.x) *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class Line extends LaTeXDrawPolygon implements Arrowable { private static final long serialVersionUID = 1L; /** the arrowhead of the first point */ private ArrowHead arrowHeadL; /** The arrow head of the second point */ private ArrowHead arrowHeadR; /** The director coefficient" of the line (y=ax+b) */ private double a; /** y=ax+b */ private double b; /** The number of points in a line */ public static final short LINE_NB_POINTS = 2; /** The constructor by default */ public Line(boolean increaseMeter) { this(new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(), increaseMeter); } public Line(double a, double b, boolean increaseMeter) { super(increaseMeter); canHaveArrow = true; borders=null; this.a = a; this.b = b; bordersPosition = PSTricksConstants.BORDERS_MIDDLE; isBordersMovable = false; LaTeXDrawPoint2D pt1 = new LaTeXDrawPoint2D(0,(int) b); addPoint(pt1); LaTeXDrawPoint2D pt2s[]; try { pt2s = findPoints(pt1, 10.); if(pt2s==null) throw new IllegalArgumentException(); if(pt2s.length==0) throw new IllegalArgumentException(); addPoint(pt2s[0]); arrowHeadL = new ArrowHead(pt1, this, this); arrowHeadR = new ArrowHead(pt2s[0], this, this); } catch(LaTeXDrawException e) { throw new IllegalArgumentException(); } updateGravityCenter(); shape = createShape2D(); } /** * Create a line by creating a second point with : * @param b y = ax+ b * @param p1 The first point */ public Line(double b, LaTeXDrawPoint2D p1, boolean increaseMeter) { this(p1,Double.isInfinite(b) || Double.isNaN(b) ? new LaTeXDrawPoint2D(p1.x,p1.y-10) : new LaTeXDrawPoint2D(0,b),increaseMeter); } /** * Constructs a line with a line2D */ public Line(Line2D.Double l, boolean increaseMeter) { this(new LaTeXDrawPoint2D(l.x1, l.y1), new LaTeXDrawPoint2D(l.x2, l.y2), increaseMeter); } /** * The constructor using two points to create the line. * */ public Line(double x1, double y1, double x2, double y2, boolean increaseMeter) { this(new LaTeXDrawPoint2D(x1, y1), new LaTeXDrawPoint2D(x2, y2), increaseMeter); } /** * The constructor using two points in order to create the line * @param p1 The first point of the line * @param p2 The second point of the line */ public Line(LaTeXDrawPoint2D p1, LaTeXDrawPoint2D p2, boolean increaseMeter) { super(increaseMeter); canHaveArrow = true; isBordersMovable = false; bordersPosition = PSTricksConstants.BORDERS_MIDDLE; borders=null; addPoint(p1); addPoint(p2); updateGravityCenter(); updateAandB(); arrowHeadL = new ArrowHead(p1, this, this); arrowHeadR = new ArrowHead(p2, this, this); canBeFilled = false; shape = createShape2D(); } /** * @return Creates a Line2D.Double shape from the Line. * @since 2.0.0 */ public Line2D toLine2D() { return new Line2D.Double(getPt1().x, getPt1().y, getPt2().x, getPt2().y); } /** * Allows to update the y-intercept b and slope a */ public void updateAandB() { LaTeXDrawPoint2D pt1 = getPoint(0); LaTeXDrawPoint2D pt2 = getPoint(1); a = (pt1.y - pt2.y)/(pt1.x - pt2.x); b = (pt1.y - a * pt1.x); updateGravityCenter(); } @Override public void shift(double shiftX, double shiftY) { if(shiftX==0 && shiftY==0) return ; super.shift(shiftX, shiftY); updateAandB(); shape = createShape2D(); } @Override public void draw(Graphics2D g, Object antiAlias, Object rendering, Object alphaInter, Object colorRendering) { LaTeXDrawPoint2D pt1 = getPoint(0); LaTeXDrawPoint2D pt2 = getPoint(1); Color formerCol = g.getColor(); g.setColor(linesColor); double x1, y1, x2, y2; double dx=0, dy=0; boolean arrow1Drawable = arrowHeadL.isDrawable() && arrowHeadL.getArrowStyle().compareTo(PSTricksConstants.NONEARROW_STYLE)!=0; boolean arrow2Drawable = arrowHeadR.isDrawable() && arrowHeadR.getArrowStyle().compareTo(PSTricksConstants.NONEARROW_STYLE)!=0; updateAandB(); if(arrow1Drawable) { double lineAngle = Math.atan(getA()); double xRot,yRot; Point2D.Double pos = arrowHeadL.getPosition()==pt1 ? pt1 : pt2; double lgth = arrowHeadL.getArrowHeadLength(); if(Math.abs(lineAngle)==(Math.PI/2.)) { y1 = pt1.ypt1.y ? y1+thickness/2. : y1-thickness/2.; else { xRot = Math.cos(-lineAngle)*x1-Math.sin(-lineAngle)*(y1-b); yRot = Math.sin(-lineAngle)*x1+Math.cos(-lineAngle)*(y1-b)+b; if(pt2.x>pt1.x) xRot+=thickness/2.; else xRot-=thickness/2.; x1 = Math.cos(lineAngle)*xRot-Math.sin(lineAngle)*(yRot-b); y1 = Math.sin(lineAngle)*xRot+Math.cos(lineAngle)*(yRot-b)+b; } } if(hasShadow) { LaTeXDrawPoint2D cg = getGravityCenter(); LaTeXDrawPoint2D shadowCg = (LaTeXDrawPoint2D)cg.clone(); shadowCg.setLocation(cg.x+shadowSize, cg.y); shadowCg = Figure.rotatePoint(shadowCg, cg, shadowAngle); dx = shadowCg.x-cg.x; dy = cg.y-shadowCg.y; } if(((float)x1)==((float)x2) && ((float)y1)==((float)y2)) x2--; Line2D.Double l = new Line2D.Double(x1, y1, x2, y2); if(hasDoubleBoundary) { if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) { Shape s[] = getDbleBoundariesOutInOrMiddle(l); if(hasShadow) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.draw(s[0]); g.draw(s[1]); Line2D l1 = (Line2D)s[0], l2 = (Line2D)s[1]; int[] xs = {(int)l1.getX1(), (int)l1.getX2(), (int)l2.getX2(), (int)l2.getX1()}; int[] ys = {(int)l1.getY1(), (int)l1.getY2(), (int)l2.getY2(), (int)l2.getY1()}; Polygon p = new Polygon(xs, ys, 4); g.fill(p); g.draw(p); if(arrow1Drawable) { Stroke stroke = g.getStroke(); Color old = linesColor; linesColor = shadowColor; g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); arrowHeadL.draw(g, interiorColor, true); linesColor = old; g.setStroke(stroke); } if(arrow2Drawable) { Stroke stroke = g.getStroke(); Color old = linesColor; linesColor = shadowColor; g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); arrowHeadR.draw(g, interiorColor, true); linesColor = old; g.setStroke(stroke); } g.translate(-dx, -dy); } g.setColor(doubleColor); g.setStroke(new BasicStroke((float)(doubleSep + thickness), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.draw(l); g.setColor(linesColor); g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.draw(s[0]); g.draw(s[1]); } else { if(hasShadow) { Stroke stroke = g.getStroke(); Shape s[] = getDbleBoundariesOutInOrMiddle(l); g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.draw(s[0]); g.draw(s[1]); Line2D l1 = (Line2D)s[0], l2 = (Line2D)s[1]; int[] xs = {(int)l1.getX1(), (int)l1.getX2(), (int)l2.getX2(), (int)l2.getX1()}; int[] ys = {(int)l1.getY1(), (int)l1.getY2(), (int)l2.getY2(), (int)l2.getY1()}; Polygon p = new Polygon(xs, ys, 4); g.fill(p); g.draw(p); if(arrow1Drawable) { Stroke stroke2 = g.getStroke(); Color old = linesColor; linesColor = shadowColor; g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); arrowHeadL.draw(g, interiorColor, true); linesColor = old; g.setStroke(stroke2); } if(arrow2Drawable) { Stroke stroke2 = g.getStroke(); Color old = linesColor; linesColor = shadowColor; g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); arrowHeadR.draw(g, interiorColor, true); linesColor = old; g.setStroke(stroke2); } g.translate(-dx, -dy); g.setStroke(stroke); } if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER,1.f,new float[]{0,(float)(thickness*2+doubleSep+dotSep)},0)); else g.setStroke(new BasicStroke((float)(thickness*2+doubleSep), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[] { blackDashLength, whiteDashLength }, 0)); g.setColor(linesColor); g.draw(l); g.setStroke(new BasicStroke((float)doubleSep, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.setColor(doubleColor); g.draw(l); } } else { if(hasShadow) { g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); g.translate(dx, dy); g.setColor(shadowColor); g.draw(l); if(arrow1Drawable) { Color old = linesColor; linesColor = shadowColor; arrowHeadL.draw(g, interiorColor, true); linesColor = old; } if(arrow1Drawable) { Color old = linesColor; linesColor = shadowColor; arrowHeadR.draw(g, interiorColor, true); linesColor = old; } g.translate(-dx, -dy); } if(lineStyle.equals(PSTricksConstants.LINE_NONE_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); else if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.f, new float[] { 0, thickness + dotSep }, 0)); else g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.f, new float[] { blackDashLength, whiteDashLength }, 0)); g.setColor(linesColor); g.draw(l); } g.setStroke(new BasicStroke(hasDoubleBoundary() ? thickness*2f+(float)getDoubleSep() : thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); if(arrow1Drawable) arrowHeadL.draw(g, interiorColor, false); if(arrow2Drawable) arrowHeadR.draw(g, interiorColor, false); g.setColor(formerCol); if(isSelected && delimiters.size()==2) { delimiters.elementAt(0).draw(g); delimiters.elementAt(1).draw(g); } } @Override public synchronized void setIsFilled(boolean filled) { /* A line cannot be filled. */ } /** * Allows to set the style of the left arrow of the line * @param style The new style of the left arrow of the line */ public synchronized void setArrow1Style(String style) { arrowHeadL.setArrowStyle(style); } /** * Allows to set the style of the right arrow of the line * @param style The new style of the right arrow of the line */ public synchronized void setArrow2Style(String style) { arrowHeadR.setArrowStyle(style); } @Override public synchronized void setLastPoint(LaTeXDrawPoint2D pt) { LaTeXDrawPoint2D pt1 = getPoint(0); LaTeXDrawPoint2D pt2 = getPoint(1); if(pt1.x!=pt.x || pt1.y!=pt.y) { pt2.x = pt.x; pt2.y = pt.y; updateAandB(); shape = createShape2D(); } } @Override public synchronized void setFirstPoint(LaTeXDrawPoint2D pt) { LaTeXDrawPoint2D pt1 = getPoint(0); LaTeXDrawPoint2D pt2 = getPoint(1); if(pt2.x!=pt.x || pt2.y!=pt.y) { pt1.x = pt.x; pt1.y = pt.y; updateAandB(); shape = createShape2D(); } } @Override public synchronized void setRotationAngle(double theta) { super.setRotationAngle(theta); updateAandB(); shape = createShape2D(); } @Override public synchronized void setThickness(float val) { super.setThickness(val); if(!Double.isInfinite(val) && !Double.isNaN(val) && val>0) { double dim = 1.33*val+3.33 +1; if(dim<6.) dim = 6; Delimitor d1 = delimiters.elementAt(0); Delimitor d2 = delimiters.elementAt(1); if(d1!=null) d1.setDim(dim); if(d2!=null) d2.setDim(dim); shape = createShape2D(); } } @Override public LaTeXDrawPoint2D getTheNWPoint() { LaTeXDrawPoint2D pt1 = getPoint(0); LaTeXDrawPoint2D pt2 = getPoint(1); return new LaTeXDrawPoint2D(pt1.xpt2.y+dec) in = false; } else if(pt.y>pt1.y+dec || pt.ypt2.x+dec) in = false; } else if(pt.x>pt1.x+dec || pt.x=pt2.x-dec && pt1.x<=pt2.x+dec) return true; // Calculate the equation of the line (y = ax + b) double axb = a*pt.x+b; if(in && a==0) // If the equation is y = alpha { if(pt1.x=pt1.x-dec && pt.x<=pt2.x+dec; else in = pt.x>=pt2.x-dec && pt.x<=pt1.x+dec; } if(in) in = pt.y>=axb-dec && pt.y<=axb+dec; return in; } @Override public synchronized String getCodePSTricks(DrawBorders drawBorders, float ppc) { LaTeXDrawPoint2D d = drawBorders.getOriginPoint(); LaTeXDrawPoint2D pt1 = getPoint(0); LaTeXDrawPoint2D pt2 = getPoint(1); double x1 = pt1.x - d.x, x2 = pt2.x - d.x, y1 = d.y - pt1.y, y2 = d.y - pt2.y; String add ="", arrowsCode=""; //$NON-NLS-1$ //$NON-NLS-2$ double threshold = 0.001; if(!linesColor.equals(PSTricksConstants.DEFAULT_LINE_COLOR)) { String name = DviPsColors.getColourName(linesColor); if(name==null) { name = "color"+number;//$NON-NLS-1$ DviPsColors.addUserColour(linesColor, name); } add += ",linecolor="+name; //$NON-NLS-1$ } if(hasShadow) { add+=",shadow=true";//$NON-NLS-1$ if(Math.toDegrees(shadowAngle)!=PSTricksConstants.DEFAULT_SHADOW_ANGLE) add+=",shadowangle="+(float)Math.toDegrees(shadowAngle);//$NON-NLS-1$ if(((float)shadowSize)!=((float)DEFAULT_SHADOW_SIZE)) add+=",shadowsize="+LaTeXDrawNumber.getCutNumber((float)(shadowSize/PPC), threshold);//$NON-NLS-1$ if(!shadowColor.equals(PSTricksConstants.DEFAULT_SHADOW_COLOR)) { String name = DviPsColors.getColourName(shadowColor); if(name==null) { name = "color"+number+'e';//$NON-NLS-1$ DviPsColors.addUserColour(shadowColor, name); } add += ",shadowcolor=" + name; //$NON-NLS-1$ } } if(!interiorColor.equals(PSTricksConstants.DEFAULT_INTERIOR_COLOR)) { String name = DviPsColors.getColourName(interiorColor); if(name==null) { name = "color"+number+'b';//$NON-NLS-1$ DviPsColors.addUserColour(interiorColor, name); } add += ",fillcolor=" + name; //$NON-NLS-1$ } if(lineStyle.equals(PSTricksConstants.LINE_DOTTED_STYLE)) add += ",linestyle="+lineStyle+",dotsep="+ //$NON-NLS-1$ //$NON-NLS-2$ LaTeXDrawNumber.getCutNumber(dotSep/ppc, threshold)+ "cm"; //$NON-NLS-1$ else if(lineStyle.equals(PSTricksConstants.LINE_DASHED_STYLE)) add += ",linestyle="+lineStyle+",dash=" + //$NON-NLS-1$ //$NON-NLS-2$ LaTeXDrawNumber.getCutNumber(blackDashLength/ppc, threshold) + "cm "+ //$NON-NLS-1$ LaTeXDrawNumber.getCutNumber(whiteDashLength/ppc, threshold) + "cm"; //$NON-NLS-1$ String currentArrowLStyle = arrowHeadL.getArrowStyle(); String currentArrowRStyle = arrowHeadR.getArrowStyle(); String paramsR = ","+ arrowHeadR.getParametersCode(); //$NON-NLS-1$ String paramsL = ","+ arrowHeadL.getParametersCode(); //$NON-NLS-1$ if(paramsR.equals(",")) paramsR = ""; //$NON-NLS-1$ //$NON-NLS-2$ if(paramsL.equals(",")) paramsL = ""; //$NON-NLS-1$ //$NON-NLS-2$ if(!currentArrowLStyle.equals(PSTricksConstants.NONEARROW_STYLE)) { arrowsCode="{"+currentArrowLStyle+'-'; //$NON-NLS-1$ if(!currentArrowRStyle.equals(PSTricksConstants.NONEARROW_STYLE)) arrowsCode+=currentArrowRStyle; arrowsCode+='}'; if(!arrowHeadL.isOfTheSameTypeAs(arrowHeadR)) { if((currentArrowRStyle.equals(PSTricksConstants.LRBRACKET_STYLE) || currentArrowRStyle.equals(PSTricksConstants.RRBRACKET_STYLE) || currentArrowRStyle.equals(PSTricksConstants.RSBRACKET_STYLE) || currentArrowRStyle.equals(PSTricksConstants.RSBRACKET_STYLE)) && (currentArrowLStyle.equals(PSTricksConstants.BAREND_STYLE) || currentArrowLStyle.equals(PSTricksConstants.BARIN_STYLE) || currentArrowLStyle.equals(PSTricksConstants.LRBRACKET_STYLE) || currentArrowLStyle.equals(PSTricksConstants.RRBRACKET_STYLE) || currentArrowLStyle.equals(PSTricksConstants.RSBRACKET_STYLE) || currentArrowLStyle.equals(PSTricksConstants.RSBRACKET_STYLE))) add = paramsR; else add+= paramsL + paramsR; }else add+=paramsR; } else if(!currentArrowRStyle.equals(PSTricksConstants.NONEARROW_STYLE)) { add+=paramsR; arrowsCode="{-"+currentArrowRStyle+'}'; //$NON-NLS-1$ } if(hasDoubleBoundary) { add+=",doubleline=true,doublesep="+LaTeXDrawNumber.getCutNumber((float)(doubleSep/ppc), threshold); //$NON-NLS-1$ if(doubleColor!=PSTricksConstants.DEFAULT_DOUBLE_COLOR) { String name = DviPsColors.getColourName(doubleColor); if(name==null) { name = "color"+number+'d';//$NON-NLS-1$ DviPsColors.addUserColour(doubleColor, name); } add+= ",doublecolor="+name; //$NON-NLS-1$ } } return "\\psline[linewidth=" + LaTeXDrawNumber.getCutNumber(thickness/ppc, threshold)+"cm" //$NON-NLS-1$ //$NON-NLS-2$ + add + "]"+ arrowsCode + "(" + LaTeXDrawNumber.getCutNumber((float)(x1/ppc), threshold) + "," //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + LaTeXDrawNumber.getCutNumber((float)(y1/ppc), threshold) + ")(" //$NON-NLS-1$ + LaTeXDrawNumber.getCutNumber((float)(x2/ppc), threshold) + "," //$NON-NLS-1$ + LaTeXDrawNumber.getCutNumber((float)(y2/ppc), threshold) + ")"; //$NON-NLS-1$ } /** * Allows to get the X-coordinate thanks to the equation of the * line and the Y-coordinate of the point * @param y The Y-coordinate of the point * @return The X-coordinate of the point */ public double getXWithEquation(double y) { updateAandB(); return (y-b)/a; } /** * Allows to get the Y-coordinate thanks to the equation of the * line and the X-coordinate of the point * @param x The X-coordinate of the point * @return The Y-coordinate of the point */ public double getYWithEquation(double x) { updateAandB(); return a*x+b; } /** * Allows to get the points which are on the line and at the distance * "distance" of the point "p" of the line. * @param p The point of reference * @param distance The distance between p and the points we must find * @return The points found * @throws LaTeXDrawException */ public LaTeXDrawPoint2D[] findPoints(Point p, double distance) throws LaTeXDrawException { return findPoints(p.x, p.y, distance); } /** * Allows to get the points which are on the line and at the distance * "distance" of the point "p" of the line. * @param p The point of reference * @param distance The distance between p and the points we must find * @return The points found * @throws LaTeXDrawException */ public LaTeXDrawPoint2D[] findPoints(LaTeXDrawPoint2D p, double distance) throws LaTeXDrawException { return findPoints(p.x, p.y, distance); } /** * Allows to get the points which are on the line and at the distance * "distance" of the point "p" of the line. * @param x The x-coordinate of the point of reference * @param y The y-coordinate of the point of reference * @param distance The distance between p and the points we must find * @return The found points * @throws LaTeXDrawException */ public LaTeXDrawPoint2D[] findPoints(double x, double y, double distance) throws LaTeXDrawException { if(distance==0) { LaTeXDrawPoint2D[] sol = new LaTeXDrawPoint2D[1]; sol[0] = new LaTeXDrawPoint2D(x,y); return sol; } updateAandB(); if(Double.isInfinite(b) || Double.isNaN(b)) {// A vertical line LaTeXDrawPoint2D sol[] = new LaTeXDrawPoint2D[2]; sol[0] = new LaTeXDrawPoint2D(x, y-distance); sol[1] = new LaTeXDrawPoint2D(x, y+distance); return sol; } double A = a*a+1, B = -2*(x+y*a-a*b); double C = b*b-(2*y*b)+y*y+x*x-(distance*distance); double delta = B*B-4*A*C; if(delta>0) { double x1, x2, y1, y2; LaTeXDrawPoint2D sol[] = new LaTeXDrawPoint2D[2]; x1 = (-B+Math.sqrt(delta))/(2*A); x2 = (-B-Math.sqrt(delta))/(2*A); y1 = a*x1+b; y2 = a*x2+b; sol[0] = new LaTeXDrawPoint2D(x1, y1); sol[1] = new LaTeXDrawPoint2D(x2, y2); return sol; } else if(delta==0) { double x2, y2; LaTeXDrawPoint2D sol[] = new LaTeXDrawPoint2D[1]; x2 = -B/2*A; y2 = a*x2+b; sol[0] = new LaTeXDrawPoint2D(x2, y2); return sol; } else throw new LaTeXDrawException(LaTeXDrawException.INCORRECT_VALUE); } /** * Allows to create the line which is perpendicular to the current * line at the point pt * @param pt The point of crossing between the two lines * @return The perpendicular line */ public Line getPerpendicularLine(LaTeXDrawPoint2D pt, boolean increaseMeter) { if(pt.x==0) { LaTeXDrawPoint2D pt3 = getPt2(); LaTeXDrawPoint2D pt2 = Figure.rotatePoint(pt3, pt, Math.PI/2.); return new Line(pt2, pt, increaseMeter); } double a2 = -1./a; return new Line(pt.y-a2*pt.x, pt, increaseMeter); } /** * Allows to translate the line following a gap t. In fact, we only * change the y-intersect * @param t The gap * @return A new line, result of this translation */ public Line translate(double t, boolean increaseMeter) { return new Line(a, b+t, increaseMeter); } @Override public Object clone() throws CloneNotSupportedException { Line l = (Line) super.clone(); l.borders = null; updateGravityCenter(); l.arrowHeadL = arrowHeadL.clone(false); l.arrowHeadL.setPosition(l.getPoint(0)); l.arrowHeadL.setLine(l); l.arrowHeadL.setFigure(l); l.arrowHeadR = arrowHeadR.clone(false); l.arrowHeadR.setPosition(l.getPoint(1)); l.arrowHeadR.setLine(l); l.arrowHeadR.setFigure(l); l.canBeFilled = false; l.a = a; l.b = b; l.shape = l.createShape2D(); return l; } @Override public synchronized void updateGravityCenter() { if(pts.size()==LINE_NB_POINTS) { LaTeXDrawPoint2D pt1 = getPoint(0); LaTeXDrawPoint2D pt2 = getPoint(1); gravityCenter.setLocation((pt1.x+pt2.x)/2., (pt1.y+pt2.y)/2.); } } /** * Allows to get the a from y=ax+b * @return The a */ public double getA() { return a; } /** * Allows to get the b from y=ax+b * @return The b */ public double getB() { return b; } @Override public synchronized LaTeXDrawRectangle getBorders() { LaTeXDrawPoint2D NW = (LaTeXDrawPoint2D)getTheNWPoint().clone(); LaTeXDrawPoint2D SE = (LaTeXDrawPoint2D)getTheSEPoint().clone(); return new LaTeXDrawRectangle((LaTeXDrawPoint2D)NW.clone(), new LaTeXDrawPoint2D(SE.x,NW.y), new LaTeXDrawPoint2D(NW.x,SE.y),SE, false); } @Deprecated @Override public void updateBorders(LaTeXDrawPoint2D pt) { /* */ } @Deprecated @Override public void updateBorders() { /* */ } @Override public void removePointAt(int id) { if(id<0 || id>pts.size()) return ; if(pts.size()>2) { pts.remove(id); delimiters.remove(id); if(id==0) { arrowHeadL.setPosition(getPoint(0)); arrowHeadR.setPosition(getPoint(1)); } else if(id==0) arrowHeadR.setPosition(getPoint(1)); updateAandB(); } } @Override public void onDragged(Point formerPt, Point newPt) throws Exception { if(formerPt.equals(newPt)) return; if(isOnRotation && dSelected!=null) { double theta = computeRotationAngle(formerPt, newPt); double rotationA = rotationAngle+ theta; rotationA%=(Math.PI*2); setRotationAngle(rotationA); } else if(dSelected==null)// We dragged the figure or a delimiter of the shift(formerPt, newPt); else dSelected.setCoordinates(newPt.x, newPt.y); updateGravityCenter(); updateShape(); } @Override public synchronized LaTeXDrawPoint2D getBordersPoint(int id) { LaTeXDrawPoint2D NW = getTheNWPoint(); LaTeXDrawPoint2D SE = getTheSEPoint(); if(id==-1 || id==3) return SE; if(id<0 || id>LaTeXDrawRectangle.NB_POINTS_FRAME-1) throw new IllegalArgumentException(); if(id==0) return NW; if(id==1) return new LaTeXDrawPoint2D(SE.x,NW.y); if(id==2) return new LaTeXDrawPoint2D(NW.x,SE.y); return null; } @SuppressWarnings("unchecked") private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { canHaveShadow = true; canHaveArrow = true; interiorColor = (Color) ois.readObject(); lineStyle = (String) ois.readObject(); rotationAngle = ois.readDouble(); thickness = ois.readFloat(); isFilled = ois.readBoolean(); isSelected = ois.readBoolean(); isOnRotation = ois.readBoolean(); linesColor = (Color) ois.readObject(); blackDashLength = ois.readFloat(); dotSep = ois.readFloat(); whiteDashLength = ois.readFloat(); pts = (Vector) ois.readObject(); arrowHeadL = (ArrowHead) ois.readObject(); arrowHeadR = (ArrowHead) ois.readObject(); arrowHeadR.setArrowInset(arrowHeadL.getArrowInset()); arrowHeadR.setArrowLength(arrowHeadL.getArrowLength()); arrowHeadR.setArrowSizeDim(arrowHeadL.getArrowSizeDim()); arrowHeadR.setArrowSizeNum(arrowHeadL.getArrowSizeNum()); arrowHeadR.setBracketNum(arrowHeadL.getBracketNum()); arrowHeadR.setDotSizeDim(arrowHeadL.getDotSizeDim()); arrowHeadR.setDotSizeNum(arrowHeadL.getDotSizeNum()); arrowHeadR.setRBracketNum(arrowHeadL.getRBracketNum()); arrowHeadR.setTBarSizeDim(arrowHeadL.getTBarSizeDim()); arrowHeadR.setTBarSizeNum(arrowHeadL.getTBarSizeNum()); if(pts.size()!=LINE_NB_POINTS) throw new ArrayIndexOutOfBoundsException(); arrowHeadL.setPosition(pts.firstElement()); arrowHeadR.setPosition(pts.elementAt(1)); arrowHeadL.setFigure(this); arrowHeadR.setFigure(this); delimiters = new Vector(); for(int i=0, size = pts.size();i=0)//$NON-NLS-1$ { hasDoubleBoundary = ois.readBoolean(); doubleColor = (Color)ois.readObject(); doubleSep = ois.readDouble(); } else { hasDoubleBoundary = DEFAULT_HAS_DOUBLE_BOUNDARY; doubleColor = DEFAULT_DOUBLE_COLOR; doubleSep = DEFAULT_DOUBLESEP; } if(LaTeXDrawFrame.getVersionOfFile().compareTo("1.7")>=0) //$NON-NLS-1$ { hasShadow = ois.readBoolean(); shadowAngle = ois.readDouble(); shadowSize = ois.readDouble(); shadowColor = (Color)ois.readObject(); } else { hasShadow = DEFAULT_SHADOW_HAS; shadowAngle = DEFAULT_SHADOW_ANGLE; shadowSize = DEFAULT_SHADOW_SIZE; shadowColor = DEFAULT_SHADOW_COLOR; } } @Override public Shape createShape2D() { if(getNbPoints()<2) return null; Shape area; Shape s = new Line2D.Double(getPt1(), getPt2()); if(hasDoubleBoundary) {//Fixes #1557509 Line2D.Double[] s2 = (Line2D.Double[])getDbleBoundariesMiddle(s); int[] xs = new int[4], ys = new int[5]; xs[0] = (int)s2[0].x1; xs[1] = (int)s2[0].x2; xs[2] = (int)s2[1].x1; xs[3] = (int)s2[1].x2; ys[0] = (int)s2[0].y1; ys[1] = (int)s2[0].y2; ys[2] = (int)s2[1].y1; ys[3] = (int)s2[1].y2; area = new Polygon(xs, ys, 4); } else area = s; return area; } /** * @return Returns the arrowHead1. */ public ArrowHead getArrowHead1() { return arrowHeadL; } /** * @return Returns the arrowHead2. */ public ArrowHead getArrowHead2() { return arrowHeadR; } /** * Allows to get the intersection between two lines * @param l The second lines * @return The intersection */ public LaTeXDrawPoint2D getIntersection(Line l) { if(l==null) return null; boolean bInf = false; double y; if(Double.isInfinite(b) || Double.isNaN(b)) // The equation is x = alpha; bInf = true; if(Double.isInfinite(l.b) || Double.isNaN(l.b)) {// The equation is x = alpha; if(bInf)// The two lines a parallels return null; y = a*l.getPt1().x+b; return new LaTeXDrawPoint2D((y-b)/a, y); } if(bInf) { y = l.a*getPt1().x+l.b; return new LaTeXDrawPoint2D((y-l.b)/l.a, y); } double x = (b-l.b)/(l.a-a); return new LaTeXDrawPoint2D(x, a*x+b); } @Override public Shape[] getDbleBoundariesMiddle(Shape classicBord) { try { Point2D.Double p1 = (Point2D.Double)((Line2D.Double)classicBord).getP1(); Point2D.Double p2 = (Point2D.Double)((Line2D.Double)classicBord).getP2(); Line l = new Line(new LaTeXDrawPoint2D(p1.x, p1.y), new LaTeXDrawPoint2D(p2.x, p2.y), false); LaTeXDrawPoint2D[] pts1 = l.getPerpendicularLine( (LaTeXDrawPoint2D)l.getPt1().clone(), false).findPoints( l.getPt1(), (doubleSep+thickness)/2.); LaTeXDrawPoint2D[] pts2 =l.getPerpendicularLine( (LaTeXDrawPoint2D)l.getPt2().clone(), false).findPoints( l.getPt2(), (doubleSep+thickness)/2.); if(pts1.length<2 || pts2.length<2) throw new IndexOutOfBoundsException(); Shape[] s = new Line2D.Double[2]; s[0] = new Line2D.Double(pts1[0], pts2[0]); s[1] = new Line2D.Double(pts1[1], pts2[1]); return s; }catch(Exception e) { e.printStackTrace(); return null; } } /** * Allow to get the first point of the line * @return The first point of the line */ public LaTeXDrawPoint2D getPt1() { return getPoint(0); } /** * Allow to get the second point o the line * @return The second point of the line */ public LaTeXDrawPoint2D getPt2() { return getPoint(1); } /** * Allows to get the middle point of the line * @return The middle point of the line */ public LaTeXDrawPoint2D getMiddlePt() { LaTeXDrawPoint2D p1 = pts.elementAt(0); LaTeXDrawPoint2D p2 = pts.elementAt(1); return new LaTeXDrawPoint2D((p1.x+p2.x)/2., (p1.y+p2.y)/2.); } /** * Allows to get the point of the intersection between of the two segments * @param l The second line * @return The intersection point */ public LaTeXDrawPoint2D getIntersectsSegment(Line l) { if(l==null) return null; LaTeXDrawPoint2D p = getIntersection(l); if(p==null) return null; LaTeXDrawPoint2D NW = getTheNWPoint(); LaTeXDrawPoint2D SE = getTheSEPoint(); LaTeXDrawPoint2D NW2 = l.getTheNWPoint(); LaTeXDrawPoint2D SE2 = l.getTheSEPoint(); if( (p.x>NW.x && p.xNW.y && p.yNW2.x && p.xNW2.y && p.y *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class LaTeXDrawFilter extends FileFilter { @Override public boolean accept(File file) { return file.getName().endsWith(LaTeXDrawResources.PROJECT_EXTENSION)|| file.isDirectory(); } @Override public String getDescription() { return "*" + LaTeXDrawResources.PROJECT_EXTENSION; //$NON-NLS-1$ } } latexdraw-2.0.8+1.orig/latexDraw/filters/GIFFilter.java0000644000000000000000000000232011347255510017516 0ustar /* * GIFFilter.java */ package latexDraw.filters; import java.io.File; import javax.swing.filechooser.FileFilter; import latexDraw.util.LaTeXDrawResources; /** * This class defines a filter for gif files (*.gif)
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 01/03/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class GIFFilter extends FileFilter { @Override public boolean accept(File file) { return file.getName().endsWith(LaTeXDrawResources.GIF_EXTENSION) || file.isDirectory(); } @Override public String getDescription() { return "*" + LaTeXDrawResources.GIF_EXTENSION; //$NON-NLS-1$ } } latexdraw-2.0.8+1.orig/latexDraw/filters/LaTeXDrawTemplateFilter.java0000644000000000000000000000234711347255510022411 0ustar /* * LaTeXDrawFilter.java */ package latexDraw.filters; import java.io.File; import javax.swing.filechooser.FileFilter; import latexDraw.util.LaTeXDrawResources; /** * This class defines a filter for LaTeXDraw templates files (*.ldt)
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class LaTeXDrawTemplateFilter extends FileFilter { @Override public boolean accept(File file) { return file.getName().endsWith(LaTeXDrawResources.TEMPLATE_EXTENSION); } @Override public String getDescription() { return "*" + LaTeXDrawResources.TEMPLATE_EXTENSION;//$NON-NLS-1$ } } latexdraw-2.0.8+1.orig/latexDraw/filters/TeXFilter.java0000644000000000000000000000271211347255510017616 0ustar /* * TeXFilter.java */ package latexDraw.filters; import java.io.File; import javax.swing.filechooser.FileFilter; /** * This class define a filter for TeX files (*.tex)
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * * *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    > * history :
    * - 09/02/05 : creation of this file
    * - 09/09/05 : version 0.5
    * - 10/09/05 : version 1
    * - 01/11/06 : version 1.5
    * - 01/20/06 : version 1.5.1
    */ public class TeXFilter extends FileFilter { /** The name of the extension of TeX file*/ public final static String TEX_EXTENSION = ".tex"; //$NON-NLS-1$ @Override public boolean accept(File file) { return file.getName().endsWith(TEX_EXTENSION)|| file.isDirectory(); } @Override public String getDescription() { return "*" + TEX_EXTENSION;//$NON-NLS-1$ } } latexdraw-2.0.8+1.orig/latexDraw/filters/PDFFilter.java0000644000000000000000000000222211347255510017523 0ustar package latexDraw.filters; import java.io.File; import javax.swing.filechooser.FileFilter; /** * This class defines a filter for pdf documents (*.pdf)
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 12/08/08
    * @author Arnaud BLOUIN
    * @version 2.0.3
    * @since 2.0.3 */ public class PDFFilter extends FileFilter { public static final String PDF_EXTENSION = ".pdf";//$NON-NLS-1$ @Override public boolean accept(File f) { return f!=null && (f.getName().endsWith(PDF_EXTENSION)|| f.isDirectory()); } @Override public String getDescription() { return "*" + PDF_EXTENSION; //$NON-NLS-1$ //$NON-NLS-2$ } } latexdraw-2.0.8+1.orig/latexDraw/filters/BMPFilter.java0000644000000000000000000000231711347255510017535 0ustar /* * BMPFilter.java */ package latexDraw.filters; import java.io.File; import javax.swing.filechooser.FileFilter; import latexDraw.util.LaTeXDrawResources; /** * This class defines a filter for bmp files (*.bmp)
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 02/04/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class BMPFilter extends FileFilter { @Override public boolean accept(File file) { return file.getName().endsWith(LaTeXDrawResources.BMP_EXTENSION)|| file.isDirectory(); } @Override public String getDescription() { return "*" + LaTeXDrawResources.BMP_EXTENSION; //$NON-NLS-1$ } } latexdraw-2.0.8+1.orig/latexDraw/filters/PNGFilter.java0000644000000000000000000000231711347255510017543 0ustar /* * PNGFilter.java */ package latexDraw.filters; import java.io.File; import javax.swing.filechooser.FileFilter; import latexDraw.util.LaTeXDrawResources; /** * This class defines a filter for png files (*.png)
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 01/27/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class PNGFilter extends FileFilter { @Override public boolean accept(File file) { return file.getName().endsWith(LaTeXDrawResources.PNG_EXTENSION)|| file.isDirectory(); } @Override public String getDescription() { return "*" + LaTeXDrawResources.PNG_EXTENSION; //$NON-NLS-1$ } } latexdraw-2.0.8+1.orig/latexDraw/filters/SVGFilter.java0000644000000000000000000000224311347255510017554 0ustar /* * SVGFilter.java */ package latexDraw.filters; import java.io.File; import javax.swing.filechooser.FileFilter; /** * This class define a filter for SVG files (*.svg).
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 09/06/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    * @since 2.0.0 */ public class SVGFilter extends FileFilter { public static final String SVG_EXTENSION = ".svg";//$NON-NLS-1$ @Override public boolean accept(File file) { return file.getName().endsWith(SVG_EXTENSION)|| file.isDirectory(); } @Override public String getDescription() { return "*" + SVG_EXTENSION; //$NON-NLS-1$ } } latexdraw-2.0.8+1.orig/latexDraw/filters/EPSFilter.java0000644000000000000000000000232111347255510017541 0ustar /* * EPSFilter.java */ package latexDraw.filters; import java.io.File; import javax.swing.filechooser.FileFilter; import latexDraw.util.LaTeXDrawResources; /** * This class defines a filter for eps files (*.eps)
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class EPSFilter extends FileFilter { @Override public boolean accept(File file) { return file.getName().endsWith(LaTeXDrawResources.EPS_EXTENSION)|| file.isDirectory(); } @Override public String getDescription() { return "*" + LaTeXDrawResources.EPS_EXTENSION; //$NON-NLS-1$ } } latexdraw-2.0.8+1.orig/latexDraw/filters/JPGFilter.java0000644000000000000000000000232111347255510017532 0ustar /* * JPGFilter.java */ package latexDraw.filters; import java.io.File; import javax.swing.filechooser.FileFilter; import latexDraw.util.LaTeXDrawResources; /** * This class defines a filter for jpg files (*.jpg)
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 01/20/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class JPGFilter extends FileFilter { @Override public boolean accept(File file) { return file.getName().endsWith(LaTeXDrawResources.JPG_EXTENSION)|| file.isDirectory(); } @Override public String getDescription() { return "*" + LaTeXDrawResources.JPG_EXTENSION; //$NON-NLS-1$ } } latexdraw-2.0.8+1.orig/latexDraw/filters/PSFilter.java0000644000000000000000000000221611347255510017437 0ustar package latexDraw.filters; import java.io.File; import javax.swing.filechooser.FileFilter; /** * This class defines a filter for ps documents (*.ps)
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 12/08/08
    * @author Arnaud BLOUIN
    * @version 2.0.3
    * @since 2.0.3 */ public class PSFilter extends FileFilter { public static final String PS_EXTENSION = ".ps";//$NON-NLS-1$ @Override public boolean accept(File f) { return f!=null && (f.getName().endsWith(PS_EXTENSION)|| f.isDirectory()); } @Override public String getDescription() { return "*" + PS_EXTENSION; //$NON-NLS-1$ //$NON-NLS-2$ } } latexdraw-2.0.8+1.orig/latexDraw/psTricks/0000755000000000000000000000000011347255510015235 5ustar latexdraw-2.0.8+1.orig/latexDraw/psTricks/PSTricksConstants.java0000644000000000000000000005677511347255510021523 0ustar package latexDraw.psTricks; import java.awt.Color; import java.awt.geom.Point2D; /** * This class contains several constants of pstricks
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 06/06/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public abstract class PSTricksConstants { /** The size in centimetres of an inch */ public static final double INCH_VAL_CM = 2.54; /** A inch is 72 postscript points */ public static final double INCH_VAL_PT = 72; /** A point is INCH_VAL_PT/INCH_VAL_CM postscript points */ public static final double CM_VAL_PT = INCH_VAL_PT/INCH_VAL_CM; /** For psaxes, the Ox value by default. */ public static final int DEFAULT_OX = 0; /** For psaxes, the Oy value by default. */ public static final int DEFAULT_OY = 0; /** For psaxes, the dx value by default. */ public static final int DEFAULT_DX = 1; /** For psaxes, the dy value by default. */ public static final int DEFAULT_DY = 1; /** The distance between each X label in cm (Dx). */ public static final double DEFAULT_DIST_X_LABEL = 0./CM_VAL_PT; /** The distance between each Y label in cm (Dy). */ public static final double DEFAULT_DIST_Y_LABEL = 0./CM_VAL_PT; /** For psaxes, the showorigin value by default. */ public static final boolean DEFAULT_SHOW_ORIGIN = true; /** The default size of the ticks in cm. */ public static final double DEFAULT_TICKS_SIZE = 3./CM_VAL_PT; /** The text to display when all the labels must be displayed. */ public static final String TOKEN_LABELS_DISPLAYED_ALL = "all"; //$NON-NLS-1$ /** The text to display when only the X labels must be displayed. */ public static final String TOKEN_LABELS_DISPLAYED_X = "x"; //$NON-NLS-1$ /** The text to display when only the Y labels must be displayed. */ public static final String TOKEN_LABELS_DISPLAYED_Y = "y";//$NON-NLS-1$ /** The text to display when no labels must be displayed. */ public static final String TOKEN_LABELS_DISPLAYED_NON = "none";//$NON-NLS-1$ /** The token when the ticks must be fully shown. */ public static final String TOKEN_TICKS_STYLE_FULL = "full";//$NON-NLS-1$ /** The token when the ticks only the top of them must be shown. */ public static final String TOKEN_TICKS_STYLE_TOP = "top";//$NON-NLS-1$ /** The token when the ticks only the bottom of them must be shown. */ public static final String TOKEN_TICKS_STYLE_BOTTOM = "bottom";//$NON-NLS-1$ /** The text to display when the axes have the axes shape. */ public static final String TOKEN_AXES_STYLE_AXES = "axes";//$NON-NLS-1$ /** The text to display when the axes have the frame shape. */ public static final String TOKEN_AXES_STYLE_FRAME = "frame";//$NON-NLS-1$ /** The text to display when the axes must not be shown. */ public static final String TOKEN_AXES_STYLE_NONE = "none";//$NON-NLS-1$ public static final String DEFAULT_AXES_STYLE = TOKEN_AXES_STYLE_AXES; public static final String DEFAULT_TICKS_STYLE = TOKEN_TICKS_STYLE_FULL; public static final String DEFAULT_LABELS_DISPLAYED = TOKEN_LABELS_DISPLAYED_ALL; public static final String DEFAULT_TICKS_DISPLAYED = TOKEN_LABELS_DISPLAYED_ALL; /** The first colour of a gradient by default. */ public static final Color DEFAULT_GRADIENT_START_COLOR = new Color(0, (int)(.1*255), (int)(.95*255)); /** The second color of a gradient by default. */ public static final Color DEFAULT_GRADIENT_END_COLOR = new Color(0, 255, 255); /** The position of the midpoint, as a fraction of the distance from top to bottom. Should be between 0 and 1. */ public static final double DEFAULT_GRADIENT_MID_POINT = .9; /** The number of lines. More lines means finer gradation. */ public static final int DEFAULT_GRADIENT_LINES = 500; /** The angle of the gradient in degree. */ public static final double DEFAULT_GRADIENT_ANGLE = 0; /** The value by default of a missing coordinate : (5,) */ public static final int DEFAULT_VALUE_MISSING_COORDINATE = 1; public static final String TOKEN_PUT_ANGLE_0 = "U";//$NON-NLS-1$ public static final String TOKEN_PUT_ANGLE_90 = "L";//$NON-NLS-1$ public static final String TOKEN_PUT_ANGLE_180 = "D";//$NON-NLS-1$ public static final String TOKEN_PUT_ANGLE_270 = "R";//$NON-NLS-1$ public static final String TOKEN_PUT_ANGLE_0_STAR = "N";//$NON-NLS-1$ public static final String TOKEN_PUT_ANGLE_90_STAR = "W";//$NON-NLS-1$ public static final String TOKEN_PUT_ANGLE_180_STAR = "S";//$NON-NLS-1$ public static final String TOKEN_PUT_ANGLE_270_STAR = "E";//$NON-NLS-1$ public static final char TOKEN_RPUT_TOP = 't'; public static final char TOKEN_RPUT_BOTTOM = 'b'; public static final char TOKEN_RPUT_BASE = 'B'; public static final char TOKEN_RPUT_LEFT = 'l'; public static final char TOKEN_RPUT_RIGHT = 'r'; public static final char TOKEN_UPUT_DOWN = 'd'; public static final char TOKEN_UPUT_UP = 'u'; public static final char TOKEN_UPUT_RIGHT = 'r'; public static final char TOKEN_UPUT_LEFT = 'l'; public static final double DEFAULT_UPUT_DOWN_ANGLE = 270; public static final double DEFAULT_UPUT_UP_ANGLE = 90; public static final double DEFAULT_UPUT_RIGHT_ANGLE = 0; public static final double DEFAULT_UPUT_LEFT_ANGLE = 180; public static final double DEFAULT_UPUT_DOWN_LEFT_ANGLE = 225; public static final double DEFAULT_UPUT_UP_LEFT_ANGLE = 135; public static final double DEFAULT_UPUT_DOWN_RIGHT_ANGLE = 315; public static final double DEFAULT_UPUT_UP_RIGHT_ANGLE = 45; public static final String COMMAND_TEXT_LARGE = "\\large ";//$NON-NLS-1$ public static final String COMMAND_TEXT_TINY = "\\tiny ";//$NON-NLS-1$ public static final String COMMAND_TEXT_SCRIPT = "\\scriptsize ";//$NON-NLS-1$ public static final String COMMAND_TEXT_FOOTNOTE = "\\footnotesize ";//$NON-NLS-1$ public static final String COMMAND_TEXT_SMALL = "\\small ";//$NON-NLS-1$ public static final String COMMAND_TEXT_NORMAL = "\\normalsize ";//$NON-NLS-1$ public static final String COMMAND_TEXT_LARGE1 = "\\large ";//$NON-NLS-1$ public static final String COMMAND_TEXT_LARGE2 = "\\Large ";//$NON-NLS-1$ public static final String COMMAND_TEXT_LARGE3 = "\\LARGE ";//$NON-NLS-1$ public static final String COMMAND_TEXT_HUGE1 = "\\huge ";//$NON-NLS-1$ public static final String COMMAND_TEXT_HUGE2 = "\\Huge ";//$NON-NLS-1$ /** gangle is the angle of rotation of a diamond and a triangle * around their centre. */ public static final double DEFAULT_GANGLE = 0; public static final String TOKEN_COLOR_TYPE_NAMED = "named"; //$NON-NLS-1$ public static final String TOKEN_COLOR_TYPE_CMYK = "cmyk"; //$NON-NLS-1$ public static final String TOKEN_COLOR_TYPE_HSB = "hsb"; //$NON-NLS-1$ public static final String TOKEN_COLOR_TYPE_GRAY = "gray"; //$NON-NLS-1$ public static final String TOKEN_COLOR_TYPE_RGB = "rgb"; //$NON-NLS-1$ /** The token of the parameters : fillstyle = none */ public static final String TOKEN_FILL_NONE = "none";//$NON-NLS-1$ /** The token of the parameters : fillstyle = gradient */ public static final String TOKEN_FILL_GRADIENT = "gradient";//$NON-NLS-1$ /** The token of the parameters : fillstyle = solid */ public static final String TOKEN_FILL_SOLID = "solid";//$NON-NLS-1$ /** The token of the parameters : fillstyle = vlines */ public static final String TOKEN_FILL_VLINES = "vlines";//$NON-NLS-1$ /** The token of the parameters : fillstyle = vlines* */ public static final String TOKEN_FILL_VLINES_F = "vlines*";//$NON-NLS-1$ /** The token of the parameters : fillstyle = hlines */ public static final String TOKEN_FILL_HLINES = "hlines";//$NON-NLS-1$ /** The token of the parameters : fillstyle = hlines* */ public static final String TOKEN_FILL_HLINES_F = "hlines*";//$NON-NLS-1$ /** The token of the parameters : fillstyle = crosshatch */ public static final String TOKEN_FILL_CROSSHATCH = "crosshatch";//$NON-NLS-1$ /** The token of the parameters : fillstyle = crosshatch* */ public static final String TOKEN_FILL_CROSSHATCH_F = "crosshatch*";//$NON-NLS-1$ /** The token of the parameters : cornersize = relative */ public static final String TOKEN_RELATIVE = "relative";//$NON-NLS-1$ /** The token of the parameters : cornersize = absolute */ public static final String TOKEN_ABSOLUTE = "absolute";//$NON-NLS-1$ /** The token of the postscript point unit of length */ public static final String TOKEN_PS_PT = "pt";//$NON-NLS-1$ /** The token of the unit of length : centimeter */ public static final String TOKEN_CM = "cm";//$NON-NLS-1$ /** The token of the unit of length : millimeter */ public static final String TOKEN_MM = "mm";//$NON-NLS-1$ /** The token of the unit of length : inch */ public static final String TOKEN_INCH = "in";//$NON-NLS-1$ /** The style which draw a o and aplus */ public static final String OPLUS_STYLE = "oplus"; //$NON-NLS-1$ /** The style which draw a o and a cross */ public static final String OTIMES_STYLE = "otimes"; //$NON-NLS-1$ /** The style which draw a plus */ public static final String PLUS_STYLE = "+"; //$NON-NLS-1$ /** The style which draw an asterisk */ public static final String ASTERISK_STYLE = "asterisk"; //$NON-NLS-1$ /** The style which draw a triangle */ public static final String TRIANGLE_STYLE = "triangle"; //$NON-NLS-1$ /** The style which draw a square */ public static final String SQUARE_STYLE = "square"; //$NON-NLS-1$ /** The style which draw a diamond */ public static final String DIAMOND_STYLE = "diamond"; //$NON-NLS-1$ /** The style which draw a pentagon */ public static final String PENTAGON_STYLE = "pentagon"; //$NON-NLS-1$ /** The style which draw a o */ public static final String O_STYLE = "o"; //$NON-NLS-1$ /** The style which draw a dot */ public static final String DOT_STYLE = "dot"; //$NON-NLS-1$ /** The style which draw a cross */ public static final String X_STYLE = "x"; //$NON-NLS-1$ /** The style which draw a vertical bar */ public static final String BAR_STYLE = "|"; //$NON-NLS-1$ /** The style which draw a full triangle */ public static final String FTRIANGLE_STYLE = "triangle*"; //$NON-NLS-1$ /** The style which draw a full square */ public static final String FSQUARE_STYLE = "square*"; //$NON-NLS-1$ /** The style which draw a full diamond */ public static final String FDIAMOND_STYLE = "diamond*"; //$NON-NLS-1$ /** The style which draw a full pentagon */ public static final String FPENTAGON_STYLE = "pentagon*"; //$NON-NLS-1$ /** Is the special coor activated by default */ public static final boolean DEFAULT_SPECIAL_COOR = false; /** Is the unit of length is rad by default */ public static final boolean DEFAULT_ON_RADIANS = false; /** The angle in degrees by default */ public static final double DEFAULT_DEGREES = 360; /** The width of the line by default (in cm) */ public static final double DEFAULT_LINE_WIDTH = 0.8/CM_VAL_PT; /** Is points are displayed by default */ public static final boolean DEFAULT_SHOW_POINTS = false; /** The radius of arcs drawn at the corner of lines by default (in pt) **/ public static final double DEFAULT_LINE_ARC = 0; /** The radius of rounded corners by default (between 0 and 1)
    * The radius is compute with :
    * radius = min(width, height)*1.5*frameArc **/ public static final double DEFAULT_FRAME_ARC = 0; /** Is the corner size relative by default (if not, it's absolute)
    * If cornersize is relative, then the framearc parameter determines * the radius of the rounded corners for \psframe. If * cornersize is absolute, then the linearc parameter determines the * radius of the rounded corners for \psframe.*/ public static final boolean DEFAULT_CORNER_SIZE_RELATIVE = true; /** The value of arcsepA by default (in pt)*/ public static final double DEFAULT_ARC_SEP_A = 0; /** The value of arcsepB by default (in pt)*/ public static final double DEFAULT_ARC_SEP_B = 0; public static final double DEFAULT_ARC_SEP = 0; /** The curvature parameters control the curvature of a parabola */ public static final double DEFAULT_CURVATURE_NUM1 = 1; /** The curvature parameters control the curvature of a parabola */ public static final double DEFAULT_CRUVATURE_NUM2 = 0.1; /** The curvature parameters control the curvature of a parabola */ public static final double DEFAULT_CRUVATURE_NUM3 = 0; /** The type of the dot by default */ public static final String DEFAULT_DOT_STYLE = DOT_STYLE; /** The scale of the dot by default */ public static final double DEFAULT_DOT_SCALE1 = 1; /** The scale of the dot by default */ public static final double DEFAULT_DOT_SCALE2 = 1; /** The angle of the dot by default */ public static final double DEFAULT_DOT_ANGLE = 0; /** The width of the main lines of the grid by default in cm */ public static final double DEFAULT_GRID_WIDTH = 0.8/CM_VAL_PT; /** The size of the labels of a grid by default */ public static final double DEFAULT_GRID_LABEL = 10; /** The size of the sub-grid lines of a grid by default in cm */ public static final double DEFAULT_SUB_GRID_WIDTH = 0.4/CM_VAL_PT; /** The colour of the sub grid by default */ public static final Color DEFAULT_SUB_GRID_COLOR = Color.GRAY; /** The dimensions of the figure are with reference to the inner boundary. */ public static final String BORDERS_INSIDE = "outer"; //$NON-NLS-1$ /** The dimensions of the figure are with reference to the outter boundary. */ public static final String BORDERS_OUTSIDE = "inner"; //$NON-NLS-1$ /** The dimensions of the figure are with reference to the middle boundary. */ public static final String BORDERS_MIDDLE = "middle"; //$NON-NLS-1$ /** The position of the borders by default */ public static final String DEFAULT_BORDERS_POS = BORDERS_INSIDE; /** The colour of the double boundary of the figure by default */ public static final Color DEFAULT_DOUBLE_COLOR = Color.WHITE; /** The colour of the hatching of the figure by default */ public static final Color DEFAULT_HATCHING_COLOR = Color.BLACK; /** The colour of the interior of the figure by default */ public static final Color DEFAULT_INTERIOR_COLOR = Color.WHITE; /** The colour of the borders of the figure by default */ public static final Color DEFAULT_LINE_COLOR = Color.BLACK; /** The colour of the labels by default */ public static final Color DEFAULT_LABELGRIDCOLOR = Color.BLACK; /** The colour of the grid by default */ public static final Color DEFAULT_GRIDCOLOR = Color.BLACK; /** The number of division in a sub-grid by default */ public static final int DEFAULT_SUBGRIDDIV = 5; /** The number of dots in a line of the grid by default */ public static final int DEFAULT_GRIDDOTS = 0; /** The number of dots in a line of the sub-grid by default */ public static final int DEFAULT_SUBGRIDDOTS = 0; /** The unit by default in cm */ public static final double DEFAULT_UNIT = 1; public static final int DEFAULT_PLOT_POINTS = 50; /** The origin of the coordinate system by default */ public static final Point2D.Double DEFAULT_ORIGIN = new Point2D.Double(0,0); /** Is the axes swept by default */ public static final boolean DEFAULT_SWAP_AXES = false; /** The line(s) of the figure are dotted */ public static final String LINE_DOTTED_STYLE = "dotted"; //$NON-NLS-1$ /** The line(s) of the figure are dashed */ public static final String LINE_DASHED_STYLE = "dashed"; //$NON-NLS-1$ /** The line(s) of the figure have no style */ public static final String LINE_NONE_STYLE = "none"; //$NON-NLS-1$ /** The style of the lines by default */ public static final String DEFAULT_LINE_STYLE = LINE_NONE_STYLE; /** The black-white dash pattern for the dashed line style (in cm) */ public static final double DEFAULT_DASH_BLACK = 5./CM_VAL_PT; /** The black-white dash pattern for the dashed line style (in cm) */ public static final double DEFAULT_DASH_WHITE = 3./CM_VAL_PT; /** The distance between dots in the dotted line style (in cm) */ public static final double DEFAULT_DOT_STEP = 3./CM_VAL_PT; /** A positive value draws a border of width DEFAULT_BORDER. */ public static final double DEFAULT_BORDER = 0.; /** The colour by default of the border */ public static final Color DEFAULT_BORDER_COLOR = Color.WHITE; /** Is a double line by default */ public static final boolean DEFAULT_DOUBLE_LINE = false; /** The width of the separation between the double lines */ public static final double DEFAULT_DOUBLE_SEP = (1.25/(DEFAULT_LINE_WIDTH*CM_VAL_PT))/CM_VAL_PT; /** Is there shadow by default */ public static final boolean DEFAULT_SHADOW = false; /** The size of the shadow by default in cm */ public static final double DEFAULT_SHADOW_SIZE = 3/CM_VAL_PT; /** The angle of the shadow by default in degrees */ public static final double DEFAULT_SHADOW_ANGLE = -45; /** The colour of the shadow by default */ public static final Color DEFAULT_SHADOW_COLOR = Color.DARK_GRAY; /** The type of the fill by default */ public static final String DEFAULT_FILL_STYLE = "none"; //$NON-NLS-1$ /** The colour of the filling */ public static final Color DEFAULT_FILL_COLOR = Color.WHITE; /** The width of the hatching in cm */ public static final double DEFAULT_HATCH_WIDTH = 0.8/CM_VAL_PT; /** The separation between the lines of the hatching in cm */ public static final double DEFAULT_HATCH_SEP = 4/CM_VAL_PT; /** The angle of the hatching by default */ public static final double DEFAULT_HATCH_ANGLE = 45; public static final String NONEARROW_STYLE = "-"; //$NON-NLS-1$ public static final String LARROW_STYLE = "<"; //$NON-NLS-1$ public static final String RARROW_STYLE = ">"; //$NON-NLS-1$ public static final String DLARROW_STYLE = "<<";//$NON-NLS-1$ public static final String DRARROW_STYLE = ">>";//$NON-NLS-1$ public static final String BAREND_STYLE = "|*";//$NON-NLS-1$ public static final String BARIN_STYLE = "|";//$NON-NLS-1$ public static final String LSBRACKET_STYLE = "[";//$NON-NLS-1$ public static final String RSBRACKET_STYLE = "]";//$NON-NLS-1$ public static final String LRBRACKET_STYLE = "(";//$NON-NLS-1$ public static final String RRBRACKET_STYLE = ")";//$NON-NLS-1$ public static final String CIRCLEEND_STYLE = "o";//$NON-NLS-1$ public static final String CIRCLEIN_STYLE = "oo";//$NON-NLS-1$ public static final String DISKEND_STYLE = "*";//$NON-NLS-1$ public static final String DISKIN_STYLE = "**";//$NON-NLS-1$ public static final String ROUNDEND_STYLE = "c";//$NON-NLS-1$ public static final String ROUNDIN_STYLE = "cc";//$NON-NLS-1$ public static final String SQUAREEND_STYLE = "C";//$NON-NLS-1$ /** The style of the arrow by default */ public static final String DEFAULT_ARROW_STYLE = NONEARROW_STYLE; /** Width of arrowheads, in cm */ public static final double DEFAULT_ARROW_SIZE_DIM = 1.5/CM_VAL_PT; /** Width of arrowheads */ public static final double DEFAULT_ARROW_SIZE_NUM = 2.; /** The length of the arrowhead by default*/ public static final double DEFAULT_ARROW_LENGTH = 1.4; /** The inset of the arrowhead by default */ public static final double DEFAULT_ARROW_INSET = 0.4; /** The width of a t-bar,in cm */ public static final double DEFAULT_ARROW_TBARSIZE_DIM = 2/CM_VAL_PT; /** The width of a t-bar */ public static final double DEFAULT_ARROW_TBARSIZE_NUM = 5; /** The height of a square bracket */ public static final double DEFAULT_ARROW_BRACKET_LGTH = 0.15; /** The height of a round bracket */ public static final double DEFAULT_ARROW_RBRACKET_LGTH = 0.15; /** The diameter of a circle in cm */ public static final double DEFAULT_ARROW_DOTSIZE_DIM = 2/CM_VAL_PT; /** The diameter of a circle */ public static final double DEFAULT_ARROW_DOTSIZE_NUM = 2; /** The scale of the arrowhead */ public static final double DEFAULT_ARROW_SCALE1 = 1; /** The scale of the arrowhead */ public static final double DEFAULT_ARROW_SCALE2 = 1; /** The value by default of labelsep of the command uput (in cm)*/ public static final double DEFAULT_LABEL_SEP = 5/CM_VAL_PT; /** Distance between each side of a frame and the enclosed box (in cm). */ public static final double DEFAULT_FRAME_SEP = 3/CM_VAL_PT; /** When true, the box that is produced is the size of the frame or whatever that is drawn around the object. */ public static final boolean DEFAULT_BOX_SEP = true; /** * Allows to know if the new style is valid * @param newStyle The style which must be checked * @return True if the style is valid */ public static boolean isValidDotStyle(String newStyle) { if(newStyle==null) return false; return newStyle.equals(OPLUS_STYLE) || newStyle.equals(DOT_STYLE) || newStyle.equals(OTIMES_STYLE) || newStyle.equals(O_STYLE) || newStyle.equals(X_STYLE) || newStyle.equals(FTRIANGLE_STYLE) || newStyle.equals(FSQUARE_STYLE) || newStyle.equals(FPENTAGON_STYLE) || newStyle.equals(FDIAMOND_STYLE) || newStyle.equals(TRIANGLE_STYLE) || newStyle.equals(PENTAGON_STYLE) || newStyle.equals(PLUS_STYLE) || newStyle.equals(SQUARE_STYLE) || newStyle.equals(BAR_STYLE) || newStyle.equals(DIAMOND_STYLE) || newStyle.equals(ASTERISK_STYLE); } /** * Allows to know if the kind of filling is valid or not. * @param style The style to check. * @return True is the style is valid. */ public static boolean isValidFillStyle(String style) { if(style==null) return false; return style.equals(TOKEN_FILL_NONE) || style.equals(TOKEN_FILL_HLINES) || style.equals(TOKEN_FILL_HLINES_F) || style.equals(TOKEN_FILL_CROSSHATCH) || style.equals(TOKEN_FILL_CROSSHATCH_F) || style.equals(TOKEN_FILL_VLINES) || style.equals(TOKEN_FILL_VLINES_F) || style.equals(TOKEN_FILL_GRADIENT) || style.equals(TOKEN_FILL_SOLID); } /** * Allows to check if the style is possible * @param style The style to check * @return True if the style is valid */ public static boolean isValidArrowStyle(String style) { if(style==null) return false; if( style.equals(NONEARROW_STYLE) || style.equals(RARROW_STYLE) || style.equals(RRBRACKET_STYLE) || style.equals(RSBRACKET_STYLE) || style.equals(LARROW_STYLE) || style.equals(LRBRACKET_STYLE) || style.equals(LSBRACKET_STYLE) || style.equals(SQUAREEND_STYLE) || style.equals(ROUNDIN_STYLE) || style.equals(ROUNDEND_STYLE) || style.equals(BARIN_STYLE) || style.equals(CIRCLEEND_STYLE) || style.equals(CIRCLEIN_STYLE) || style.equals(DISKEND_STYLE) || style.equals(DLARROW_STYLE) || style.equals(DRARROW_STYLE) || style.equals(DISKIN_STYLE) || style.equals(BAREND_STYLE)) return true; return false; } } latexdraw-2.0.8+1.orig/latexDraw/psTricks/DviPsColors.java0000644000000000000000000005461511347255510020322 0ustar package latexDraw.psTricks; import java.awt.Color; import java.util.Hashtable; import java.util.Vector; /** * This class Defines colours used by pstricks.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 04/06/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public abstract class DviPsColors { public static final double MAX = 255.; public final static Color GREEN_YELLOW = new Color(216,255, 79); public final static Color YELLOW = new Color(255,255, 0); public final static Color GOLDEN_ROD = new Color(255,229, 40); public final static Color DANDELION = new Color(255,181, 40); public final static Color APRICOT = new Color(255,173,122); public final static Color PEACH = new Color(216,127, 76); public final static Color MELON = new Color(255,137,127); public final static Color YELLOW_ORANGE = new Color(216,147, 0); public final static Color ORANGE = new Color(255, 99, 33); public final static Color BURNT_ORANGE = new Color(255,124, 0); public final static Color BITTERSWEET = new Color(193, 2, 0); public final static Color RED_ORANGE = new Color(255, 58, 33); public final static Color MAHOGANY = new Color(165, 0, 0); public final static Color MAROON = new Color(173, 0, 0); public final static Color BRICKRED = new Color(183, 0, 0); public final static Color RED = new Color(255, 0, 0); public final static Color ORANGERED = new Color(255, 0,127); public final static Color RUBINERED = new Color(255, 0,221); public final static Color WILDSTRAWBERRY = new Color(255, 10,155); public final static Color SALMON = new Color(255,119,158); public final static Color CARNATIONPINK = new Color(255, 94,255); public final static Color MAGENTA = new Color(255, 0,255); public final static Color VIOLETRED = new Color(255, 48,255); public final static Color RHODAMINE = new Color(255, 45,255); public final static Color MULBERRY = new Color(163, 20,149); public final static Color REDVIOLET = new Color(150, 0,168); public final static Color FUSHIA = new Color(114, 2,234); public final static Color LAVENDER = new Color(255,132,255); public final static Color THISTLE = new Color(224,104,255); public final static Color ORCHID = new Color(173, 91,255); public final static Color DARKORCHID = new Color(153, 51,204); public final static Color PURPLE = new Color(140, 35,255); public final static Color PLUM = new Color(127, 0,255); public final static Color VIOLET = new Color( 53, 30,255); public final static Color ROYALPURPLE = new Color( 63, 25,255); public final static Color BLUEVIOLET = new Color( 25, 12,244); public final static Color PERIWINKLE = new Color(109,114,255); public final static Color CADETBLUE = new Color(140, 35,255); public final static Color CORNFLOWERBLUE = new Color( 89,221,255); public final static Color MIDNIGHTBLUE = new Color( 0,112,145); public final static Color NAVYBLUE = new Color( 15,117,255); public final static Color ROYALBLUE = new Color( 0,127,255); public final static Color BLUE = new Color( 0, 0,255); public final static Color CERULEAN = new Color( 15,226,255); public final static Color CYAN = new Color( 0,255,255); public final static Color PROCESSBLUE = new Color( 10,255,255); public final static Color SKYBLUE = new Color( 96,255,224); public final static Color TURQUOISE = new Color( 38,255,204); public final static Color TEALBLUE = new Color( 30,249,163); public final static Color AQUAMARINE = new Color( 45,255,178); public final static Color BLUEGREEN = new Color( 38,255,170); public final static Color EMERALD = new Color( 0,255,127); public final static Color JUNGLEGREEN = new Color( 2,255,122); public final static Color SEAGREEN = new Color( 79,255,127); public final static Color GREEN = new Color( 0,255, 0); public final static Color FORESTGREEN = new Color( 0,224, 0); public final static Color PINEGREEN = new Color( 0,191, 40); public final static Color LIMEGREEN = new Color(127,255, 0); public final static Color YELLOWGREEN = new Color(142,255, 66); public final static Color SPRINGGREEN = new Color(188,255, 61); public final static Color OLIVEGREEN = new Color( 0,153, 0); public final static Color RAWSIENNA = new Color(140, 0, 0); public final static Color SEPIA = new Color( 76, 0, 0); public final static Color BROWN = new Color(102, 0, 0); public final static Color TAN = new Color(219,147,112); public final static Color GRAY = new Color(127,127,127); public final static Color BLACK = new Color( 0, 0, 0); public final static Color WHITE = new Color(255,255,255); public final static Color PINK = new Color(255,192,203); public final static Color OLIVE = new Color(0.5f, 0.5f, 0f); public final static String N_GREEN_YELLOW = "GreenYellow"; //$NON-NLS-1$ public final static String N_YELLOW = "Yellow"; //$NON-NLS-1$ public final static String N_GOLDEN_ROD = "Goldenrod"; //$NON-NLS-1$ public final static String N_DANDELION = "Dandelion"; //$NON-NLS-1$ public final static String N_APRICOT = "Apricot"; //$NON-NLS-1$ public final static String N_PEACH = "Peach"; //$NON-NLS-1$ public final static String N_MELON = "Melon"; //$NON-NLS-1$ public final static String N_YELLOW_ORANGE = "YellowOrange"; //$NON-NLS-1$ public final static String N_ORANGE = "Orange"; //$NON-NLS-1$ public final static String N_BURNT_ORANGE = "BurntOrange"; //$NON-NLS-1$ public final static String N_BITTERSWEET = "Bittersweet"; //$NON-NLS-1$ public final static String N_RED_ORANGE = "RedOrange"; //$NON-NLS-1$ public final static String N_MAHOGANY = "Mahogany"; //$NON-NLS-1$ public final static String N_MAROON = "Maroon"; //$NON-NLS-1$ public final static String N_BRICKRED = "BrickRed"; //$NON-NLS-1$ public final static String N_RED = "Red"; //$NON-NLS-1$ public final static String N_ORANGERED = "OrangeRed"; //$NON-NLS-1$ public final static String N_RUBINERED = "RubineRed"; //$NON-NLS-1$ public final static String N_WILDSTRAWBERRY = "WildStrawberry"; //$NON-NLS-1$ public final static String N_SALMON = "Salmon"; //$NON-NLS-1$ public final static String N_CARNATIONPINK = "CarnationPink"; //$NON-NLS-1$ public final static String N_MAGENTA = "Magenta"; //$NON-NLS-1$ public final static String N_VIOLETRED = "VioletRed"; //$NON-NLS-1$ public final static String N_RHODAMINE = "Rhodamine"; //$NON-NLS-1$ public final static String N_MULBERRY = "Mulberry"; //$NON-NLS-1$ public final static String N_REDVIOLET = "RedViolet"; //$NON-NLS-1$ public final static String N_FUSHIA = "Fuchsia"; //$NON-NLS-1$ public final static String N_LAVENDER = "Lavender"; //$NON-NLS-1$ public final static String N_THISTLE = "Thistle"; //$NON-NLS-1$ public final static String N_ORCHID = "Orchid"; //$NON-NLS-1$ public final static String N_DARKORCHID = "DarkOrchid"; //$NON-NLS-1$ public final static String N_PURPLE = "Purple"; //$NON-NLS-1$ public final static String N_PLUM = "Plum"; //$NON-NLS-1$ public final static String N_VIOLET = "Violet"; //$NON-NLS-1$ public final static String N_ROYALPURPLE = "RoyalPurple"; //$NON-NLS-1$ public final static String N_BLUEVIOLET = "BlueViolet"; //$NON-NLS-1$ public final static String N_PERIWINKLE = "Periwinkle"; //$NON-NLS-1$ public final static String N_CADETBLUE = "CadetBlue"; //$NON-NLS-1$ public final static String N_CORNFLOWERBLUE = "CornflowerBlue"; //$NON-NLS-1$ public final static String N_MIDNIGHTBLUE = "MidnightBlue"; //$NON-NLS-1$ public final static String N_NAVYBLUE = "NavyBlue"; //$NON-NLS-1$ public final static String N_ROYALBLUE = "RoyalBlue"; //$NON-NLS-1$ public final static String N_BLUE = "Blue"; //$NON-NLS-1$ public final static String N_CERULEAN = "Cerulean"; //$NON-NLS-1$ public final static String N_CYAN = "Cyan"; //$NON-NLS-1$ public final static String N_PROCESSBLUE = "ProcessBlue"; //$NON-NLS-1$ public final static String N_SKYBLUE = "SkyBlue"; //$NON-NLS-1$ public final static String N_TURQUOISE = "Turquoise"; //$NON-NLS-1$ public final static String N_TEALBLUE = "TealBlue"; //$NON-NLS-1$ public final static String N_AQUAMARINE = "Aquamarine"; //$NON-NLS-1$ public final static String N_BLUEGREEN = "BlueGreen"; //$NON-NLS-1$ public final static String N_EMERALD = "Emerald"; //$NON-NLS-1$ public final static String N_JUNGLEGREEN = "JungleGreen"; //$NON-NLS-1$ public final static String N_SEAGREEN = "SeaGreen"; //$NON-NLS-1$ public final static String N_GREEN = "Green"; //$NON-NLS-1$ public final static String N_FORESTGREEN = "ForestGreen"; //$NON-NLS-1$ public final static String N_PINEGREEN = "PineGreen"; //$NON-NLS-1$ public final static String N_LIMEGREEN = "LimeGreen"; //$NON-NLS-1$ public final static String N_YELLOWGREEN = "YellowGreen"; //$NON-NLS-1$ public final static String N_SPRINGGREEN = "SpringGreen"; //$NON-NLS-1$ public final static String N_OLIVEGREEN = "OliveGreen"; //$NON-NLS-1$ public final static String N_RAWSIENNA = "RawSienna"; //$NON-NLS-1$ public final static String N_SEPIA = "Sepia"; //$NON-NLS-1$ public final static String N_BROWN = "Brown"; //$NON-NLS-1$ public final static String N_TAN = "Tan"; //$NON-NLS-1$ public final static String N_GRAY = "Gray"; //$NON-NLS-1$ public final static String N_BLACK = "Black"; //$NON-NLS-1$ public final static String N_WHITE = "White"; //$NON-NLS-1$ public final static String N_CYAN_2 = "cyan"; //$NON-NLS-1$ public final static String N_GRAY_2 = "gray"; //$NON-NLS-1$ public final static String N_BLACK_2 = "black"; //$NON-NLS-1$ public final static String N_WHITE_2 = "white"; //$NON-NLS-1$ public final static String N_YELLOW_2 = "yellow"; //$NON-NLS-1$ public final static String N_VIOLET_2 = "violet"; //$NON-NLS-1$ public final static String N_BLUE_2 = "blue"; //$NON-NLS-1$ public final static String N_PURPLE_2 = "purple"; //$NON-NLS-1$ public final static String N_RED_2 = "red"; //$NON-NLS-1$ public final static String N_ORANGE_2 = "orange"; //$NON-NLS-1$ public final static String N_GREEN_2 = "green"; //$NON-NLS-1$ public final static String N_MAGENTA_2 = "magenta"; //$NON-NLS-1$ public final static String N_BROWN_2 = "brown"; //$NON-NLS-1$ public final static String N_DARK_GRAY = "darkgray"; //$NON-NLS-1$ public final static String N_LIGHT_GRAY = "lightgray"; //$NON-NLS-1$ public final static String N_PINK = "pink"; //$NON-NLS-1$ public final static String N_OLIVE = "olive"; //$NON-NLS-1$ /** The colours defined by the user. */ protected final static Vector usercolors = new Vector(); /** The name of the colours defined by the user. */ protected final static Vector userNamecolors = new Vector(); protected final static Hashtable colourHT = new Hashtable(); protected final static Hashtable nameColourHT = new Hashtable(); /** * Creates the hashTable {@link #nameColourHT}. * @since 1.9.2 */ private static void createColourHashTable() { colourHT.clear(); colourHT.put(N_OLIVE, OLIVE); colourHT.put(N_CYAN_2, CYAN); colourHT.put(N_GRAY_2, GRAY); colourHT.put(N_BLACK_2, BLACK); colourHT.put(N_WHITE_2, WHITE); colourHT.put(N_YELLOW_2, YELLOW); colourHT.put(N_VIOLET_2, VIOLET); colourHT.put(N_BLUE_2, BLUE); colourHT.put(N_PURPLE_2, PURPLE); colourHT.put(N_RED_2, RED); colourHT.put(N_ORANGE_2, ORANGE); colourHT.put(N_GREEN_2, GREEN); colourHT.put(N_MAGENTA_2, MAGENTA); colourHT.put(N_BROWN_2, BROWN); colourHT.put(N_PINK, PINK); colourHT.put(N_GRAY, GRAY); colourHT.put(N_BLACK, BLACK); colourHT.put(N_WHITE, WHITE); colourHT.put(N_RED, RED); colourHT.put(N_GREEN, GREEN); colourHT.put(N_BLUE, BLUE); colourHT.put(N_VIOLET, VIOLET); colourHT.put(N_ORANGE, ORANGE); colourHT.put(N_PURPLE, PURPLE); colourHT.put(N_DARK_GRAY, Color.DARK_GRAY); colourHT.put(N_LIGHT_GRAY, Color.LIGHT_GRAY); colourHT.put(N_PINK, PINK); colourHT.put(N_GREEN_YELLOW, GREEN_YELLOW); colourHT.put(N_YELLOW, YELLOW); colourHT.put(N_GOLDEN_ROD, GOLDEN_ROD); colourHT.put(N_DANDELION, DANDELION); colourHT.put(N_APRICOT, APRICOT); colourHT.put(N_PEACH, PEACH); colourHT.put(N_MELON, MELON); colourHT.put(N_YELLOW_ORANGE, YELLOW_ORANGE); colourHT.put(N_BURNT_ORANGE, BURNT_ORANGE); colourHT.put(N_BITTERSWEET, BITTERSWEET); colourHT.put(N_RED_ORANGE, RED_ORANGE); colourHT.put(N_MAHOGANY, MAHOGANY); colourHT.put(N_MAROON, MAROON); colourHT.put(N_BRICKRED, BRICKRED); colourHT.put(N_ORANGERED, ORANGERED); colourHT.put(N_RUBINERED, RUBINERED); colourHT.put(N_WILDSTRAWBERRY, WILDSTRAWBERRY); colourHT.put(N_SALMON, SALMON); colourHT.put(N_CARNATIONPINK, CARNATIONPINK); colourHT.put(N_MAGENTA, MAGENTA); colourHT.put(N_VIOLETRED, VIOLETRED); colourHT.put(N_RHODAMINE, RHODAMINE); colourHT.put(N_MULBERRY, MULBERRY); colourHT.put(N_REDVIOLET, REDVIOLET); colourHT.put(N_FUSHIA, FUSHIA); colourHT.put(N_LAVENDER, LAVENDER); colourHT.put(N_THISTLE, THISTLE); colourHT.put(N_ORCHID, ORCHID); colourHT.put(N_DARKORCHID, DARKORCHID); colourHT.put(N_PLUM, PLUM); colourHT.put(N_ROYALPURPLE, ROYALPURPLE); colourHT.put(N_BLUEVIOLET, BLUEVIOLET); colourHT.put(N_PERIWINKLE, PERIWINKLE); colourHT.put(N_CADETBLUE, CADETBLUE); colourHT.put(N_CORNFLOWERBLUE, CORNFLOWERBLUE); colourHT.put(N_MIDNIGHTBLUE, MIDNIGHTBLUE); colourHT.put(N_NAVYBLUE, NAVYBLUE); colourHT.put(N_ROYALBLUE, ROYALBLUE); colourHT.put(N_CERULEAN, CERULEAN); colourHT.put(N_CYAN, CYAN); colourHT.put(N_PROCESSBLUE, PROCESSBLUE); colourHT.put(N_SKYBLUE, SKYBLUE); colourHT.put(N_TURQUOISE, TURQUOISE); colourHT.put(N_TEALBLUE, TEALBLUE); colourHT.put(N_AQUAMARINE, AQUAMARINE); colourHT.put(N_BLUEGREEN, BLUEGREEN); colourHT.put(N_EMERALD, EMERALD); colourHT.put(N_JUNGLEGREEN, JUNGLEGREEN); colourHT.put(N_SEAGREEN, SEAGREEN); colourHT.put(N_FORESTGREEN, FORESTGREEN); colourHT.put(N_PINEGREEN, PINEGREEN); colourHT.put(N_LIMEGREEN, LIMEGREEN); colourHT.put(N_YELLOWGREEN, YELLOWGREEN); colourHT.put(N_SPRINGGREEN, SPRINGGREEN); colourHT.put(N_OLIVEGREEN, OLIVEGREEN); colourHT.put(N_RAWSIENNA, RAWSIENNA); colourHT.put(N_SEPIA, SEPIA); colourHT.put(N_BROWN, BROWN); colourHT.put(N_TAN, TAN); } /** * Creates the hashTable {@link #colourHT}. * @since 1.9.2 */ private static void createNameColourHashTable() { nameColourHT.clear(); nameColourHT.put(OLIVE, N_OLIVE); nameColourHT.put(GRAY, N_GRAY_2); nameColourHT.put(BLACK, N_BLACK_2); nameColourHT.put(WHITE, N_WHITE_2); nameColourHT.put(RED, N_RED_2); nameColourHT.put(GREEN, N_GREEN_2); nameColourHT.put(BLUE, N_BLUE_2); nameColourHT.put(VIOLET, N_VIOLET_2); nameColourHT.put(ORANGE, N_ORANGE_2); nameColourHT.put(PURPLE, N_PURPLE_2); nameColourHT.put(Color.DARK_GRAY, N_DARK_GRAY); nameColourHT.put(Color.LIGHT_GRAY, N_LIGHT_GRAY); nameColourHT.put(PINK, N_PINK); nameColourHT.put(GREEN_YELLOW, N_GREEN_YELLOW); nameColourHT.put(YELLOW, N_YELLOW_2); nameColourHT.put(GOLDEN_ROD, N_GOLDEN_ROD); nameColourHT.put(DANDELION, N_DANDELION); nameColourHT.put(APRICOT, N_APRICOT); nameColourHT.put(PEACH, N_PEACH); nameColourHT.put(MELON, N_MELON); nameColourHT.put(YELLOW_ORANGE, N_YELLOW_ORANGE); nameColourHT.put(BURNT_ORANGE, N_BURNT_ORANGE); nameColourHT.put(BITTERSWEET, N_BITTERSWEET); nameColourHT.put(RED_ORANGE, N_RED_ORANGE); nameColourHT.put(MAHOGANY, N_MAHOGANY); nameColourHT.put(MAROON, N_MAROON); nameColourHT.put(BRICKRED, N_BRICKRED); nameColourHT.put(ORANGERED, N_ORANGERED); nameColourHT.put(RUBINERED, N_RUBINERED); nameColourHT.put(WILDSTRAWBERRY, N_WILDSTRAWBERRY); nameColourHT.put(SALMON, N_SALMON); nameColourHT.put(CARNATIONPINK, N_CARNATIONPINK); nameColourHT.put(MAGENTA, N_MAGENTA_2); nameColourHT.put(VIOLETRED, N_VIOLETRED); nameColourHT.put(RHODAMINE, N_RHODAMINE); nameColourHT.put(MULBERRY, N_MULBERRY); nameColourHT.put(REDVIOLET, N_REDVIOLET); nameColourHT.put(FUSHIA, N_FUSHIA); nameColourHT.put(LAVENDER, N_LAVENDER); nameColourHT.put(THISTLE, N_THISTLE); nameColourHT.put(ORCHID, N_ORCHID); nameColourHT.put(DARKORCHID, N_DARKORCHID); nameColourHT.put(PLUM, N_PLUM); nameColourHT.put(ROYALPURPLE, N_ROYALPURPLE); nameColourHT.put(BLUEVIOLET, N_BLUEVIOLET); nameColourHT.put(PERIWINKLE, N_PERIWINKLE); nameColourHT.put(CADETBLUE, N_CADETBLUE); nameColourHT.put(CORNFLOWERBLUE ,N_CORNFLOWERBLUE); nameColourHT.put(MIDNIGHTBLUE, N_MIDNIGHTBLUE); nameColourHT.put(NAVYBLUE, N_NAVYBLUE); nameColourHT.put(ROYALBLUE, N_ROYALBLUE); nameColourHT.put(CERULEAN, N_CERULEAN); nameColourHT.put(CYAN, N_CYAN_2); nameColourHT.put(PROCESSBLUE, N_PROCESSBLUE); nameColourHT.put(SKYBLUE, N_SKYBLUE); nameColourHT.put(TURQUOISE, N_TURQUOISE); nameColourHT.put(TEALBLUE, N_TEALBLUE); nameColourHT.put(AQUAMARINE, N_AQUAMARINE); nameColourHT.put(BLUEGREEN, N_BLUEGREEN); nameColourHT.put(EMERALD, N_EMERALD); nameColourHT.put(JUNGLEGREEN, N_JUNGLEGREEN); nameColourHT.put(SEAGREEN, N_SEAGREEN); nameColourHT.put(FORESTGREEN, N_FORESTGREEN); nameColourHT.put(PINEGREEN, N_PINEGREEN); nameColourHT.put(LIMEGREEN, N_LIMEGREEN); nameColourHT.put(YELLOWGREEN, N_YELLOWGREEN); nameColourHT.put(SPRINGGREEN, N_SPRINGGREEN); nameColourHT.put(OLIVEGREEN, N_OLIVEGREEN); nameColourHT.put(RAWSIENNA, N_RAWSIENNA); nameColourHT.put(SEPIA, N_SEPIA); nameColourHT.put(BROWN, N_BROWN_2); nameColourHT.put(TAN, N_TAN); } static { createColourHashTable(); createNameColourHashTable(); } /** * Allows to get the name of a given colour. * @param c The colour that we want the name . * @return The name of the colour : null if it can not be found. */ public static String getColourName(Color c) { if(c==null) return null; String name = nameColourHT.get(c); if(name!=null) return name; boolean found = false; int i=0, size = usercolors.size(); while(!found && iusercolors.size()) return null; Color c = usercolors.elementAt(indice); return "\\definecolor{"+userNamecolors.elementAt(indice)+"}{rgb}{" //$NON-NLS-1$ //$NON-NLS-2$ + c.getRed()/MAX + ',' + c.getGreen()/MAX +',' + c.getBlue()/MAX + "}\n"; //$NON-NLS-1$ } /** * Converts a CMYK colour to a RGB one. * @param c The c level between 0 and 1. * @param m The m level between 0 and 1. * @param y The y level between 0 and 1. * @param k The k level between 0 and 1. * @return The corresponding RBG colour. * @since 2.0.0 */ public static Color CMYK2RGB(double c, double m, double y, double k) { if(c < 0 || c > 1) throw new IllegalArgumentException(String.valueOf(c)); if(m < 0 || m > 1) throw new IllegalArgumentException(String.valueOf(m)); if(y < 0 || y > 1) throw new IllegalArgumentException(String.valueOf(y)); if(k < 0 || k > 1) throw new IllegalArgumentException(String.valueOf(k)); return new Color((float)(1 - (c * (1 - k) + k)), (float)(1-(m*(1-k)+k)), (float)(1-(y*(1-k)+k))); } /** * Converts a gray colour in an RBG one. * @param g The gray level between 0 an 1. * @return The corresponding RBG colour. * @since 2.0.0 */ public static Color gray2RBG(double g) { if(g < 0 || g > 1) throw new IllegalArgumentException(String.valueOf(g)); return new Color((float)g, (float)g, (float)g); } } latexdraw-2.0.8+1.orig/latexDraw/installer/0000755000000000000000000000000011347255510015430 5ustar latexdraw-2.0.8+1.orig/latexDraw/installer/InstallerUI.java0000644000000000000000000005224611347255510020477 0ustar package latexDraw.installer; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Toolkit; import java.io.*; import javax.swing.*; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import latexDraw.ui.listeners.InstallerListener; import latexDraw.util.LaTeXDrawPath; /** * This class defines the LaTeXDraw installer.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 05/11/07
    * @author Arnaud BLOUIN
    * @version 0.1
    */ public final class InstallerUI extends JFrame implements Runnable { private static final long serialVersionUID = 1L; /** The name of the os. */ protected String os; /** The java jre */ protected String javaVersion; /** The listener of the installer. */ protected transient InstallerListener listener; /** The current position of the slide of the installer. */ protected int slidePosition; /** The first slide. */ protected JPanel panel1; /** The second slide. */ protected JPanel panel2; /** The third slide. */ protected JPanel panel3; /** The button "previous". */ protected JButton previousB; /** The button "next". */ protected JButton nextB; /** The field that defines the path where we have to install LaTeXDraw. */ protected JTextField pathInstall; /** The progress bar of the installation. */ protected JProgressBar progressBar; /** Used to stop the thread of the installation. */ protected boolean continueInstall; /** The thread that installs LaTeXDraw. */ protected transient Thread installThread; /** The label that can appear during the installation. */ protected JLabel labelProgress; /** The path where the jar file is placed. */ protected String pathJar; /** The maximum number of slides. */ public static final int MAX_PANEL = 3; public static final String ACTION_NEXT = "next";//$NON-NLS-1$ public static final String ACTION_PREVIOUS = "previous";//$NON-NLS-1$ public static final String ACTION_CANCEL = "cancel";//$NON-NLS-1$ public static final String ACTION_TERMINATE = "terminate";//$NON-NLS-1$ public static final String LABEL_NEXT = "Next"; public static final String LABEL_TERMINATE = "Terminate"; public static final String ACTION_CHOOSE_FOLDER = "choose";//$NON-NLS-1$ /** The dimension of a slide. */ public static final Dimension PANEL_SIZE = new Dimension(650, 350); public static final String NAME_TEMPLATES_DIR = "templates";//$NON-NLS-1$ public static final String NAME_CACHE_TEMPLATES_DIR = ".cache";//$NON-NLS-1$ public static final String DATA_DIR = "data";//$NON-NLS-1$ /** * The main function: it creates an installer and launch it. * @param argc Useless. * @since 1.9.2 */ public static void main(String argc[]) { InstallerUI installer = new InstallerUI(); installer.launch(); } /** * The default constructor. */ public InstallerUI() { super("LaTeXDraw installer"); pathJar = LaTeXDrawPath.getPathJar(); os = System.getProperty("os.name");//$NON-NLS-1$ javaVersion = System.getProperty("java.version");//$NON-NLS-1$ listener = new InstallerListener(this); slidePosition = 1; if(os.toLowerCase().equals("linux") && System.getProperty("java.version").toLowerCase().compareTo("1.6")>=0)//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); }//$NON-NLS-1$ catch(Exception e) { /* Dommage ;) */ } if(os.toLowerCase().contains("win")) //$NON-NLS-1$ try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); }//$NON-NLS-1$ catch(Exception e) { /* Dommage ;) */ } setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getClassLoader().getResource("res/LaTeXDrawIcon.png")));//$NON-NLS-1$ setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); JPanel ctrlPanel = createControlButtonsPanel(); createStartPanel(); getContentPane().setLayout(new BorderLayout()); getContentPane().add(createHeaderPanel(), BorderLayout.NORTH); getContentPane().add(panel1, BorderLayout.CENTER); getContentPane().add(ctrlPanel, BorderLayout.SOUTH); previousB.setEnabled(false); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); pack(); setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2); setVisible(false); } /** * Creates the first slide. * @since 1.9.2 */ protected final void createStartPanel() { panel1 = new JPanel(); setPanelDimension(panel1); String plus; panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS)); if(javaVersion.startsWith("1.5")) { JTextArea textArea = new JTextArea(); JLabel label = new JLabel(); JLabel label2 = new JLabel(); JLabel label3 = new JLabel(); textArea.setEditable(false); label.setText("You must have Java 6 installed."); label2.setText("Your current version of Java is " + javaVersion + "."); label3.setText("You can download the last version of java here:"); textArea.setText("http://www.java.com/fr/download/index.jsp"); textArea.setMaximumSize(new Dimension(300,20)); label.setAlignmentX(Component.CENTER_ALIGNMENT); label2.setAlignmentX(Component.CENTER_ALIGNMENT); label3.setAlignmentX(Component.CENTER_ALIGNMENT); textArea.setAlignmentX(Component.CENTER_ALIGNMENT); panel1.add(Box.createVerticalStrut(60)); panel1.add(label); panel1.add(label2); panel1.add(label3); panel1.add(Box.createVerticalStrut(10)); panel1.add(textArea); nextB.setEnabled(false); } else { if(os.toLowerCase().contains("vista"))//$NON-NLS-1$ plus = "
  • Be careful with Vista! Files\".
    You must have launched this installer via the script install_vista.vbs."; else plus = "";//$NON-NLS-1$ panel1.add(new JLabel("


    • "+"This installer will, create the necessary directories, place the templates in your profile
      and place the latexdraw files in the chosen directory."+//$NON-NLS-1$ "

    • "+"You may need to be administrator/root to install LaTeXDraw."+ plus+"
    "));//$NON-NLS-1$//$NON-NLS-3$ } } /** * Creates the second slide. * @since 1.9.2 */ protected final void createPanelChoosePath() { JPanel p1 = new JPanel(); JPanel p2 = new JPanel(); panel2 = new JPanel(); panel2.setLayout(new BoxLayout(panel2, BoxLayout.PAGE_AXIS)); p1.setLayout(new BoxLayout(p1, BoxLayout.LINE_AXIS)); pathInstall = new JTextField(); pathInstall.setEditable(false); pathInstall.setPreferredSize(new Dimension(250, 35)); pathInstall.setMinimumSize(new Dimension(250, 35)); pathInstall.setMaximumSize(new Dimension(250, 35)); JButton chooseB = new JButton("Choose folder"); chooseB.setName(ACTION_CHOOSE_FOLDER); chooseB.setActionCommand(ACTION_CHOOSE_FOLDER); chooseB.addActionListener(listener); p2.add(new JLabel("Choose the path where the directory LaTeXDraw will be installed:")); p2.add(pathInstall); p2.add(chooseB); p2.setMaximumSize(new Dimension(450, 150)); p2.setMinimumSize(new Dimension(450, 150)); p2.setPreferredSize(new Dimension(450, 150)); p1.setMaximumSize(new Dimension(450, 300)); p1.setMinimumSize(new Dimension(450, 300)); p1.setPreferredSize(new Dimension(450, 300)); p1.add(p2); panel2.add(p1); setPanelDimension(panel2); if(os.equals("Linux"))//$NON-NLS-1$ pathInstall.setText("/opt");//$NON-NLS-1$ else if(os.toLowerCase().contains("windows"))//$NON-NLS-1$ { File dir = new File("C:\\Program Files\\");//$NON-NLS-1$ int cpt = 0, max = 10; while(!dir.exists() && cpt
    "+"Assistant of installation"+"
    "));//$NON-NLS-1$//$NON-NLS-3$ header.setBackground(new Color(90, 100, 130)); header.setBorder(new CompoundBorder(new TitledBorder(null, null, TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0))); return header; } /** * Launch the installer. * @since 1.9.2 */ public void launch() { setVisible(true); } /** * Allows to go to the next slide. * @since 1.9.2 */ public synchronized void incrementSlidePosition() { if(slidePosition1) { slidePosition--; switch(slidePosition) { case 1: getContentPane().remove(panel2); getContentPane().add(panel1, BorderLayout.CENTER); previousB.setEnabled(false); repaint(); pack(); break; case 2: File f = new File(pathInstall.getText()); getContentPane().remove(panel3); getContentPane().add(panel2, BorderLayout.CENTER); nextB.setText(LABEL_NEXT); nextB.setActionCommand(ACTION_NEXT); nextB.setName(ACTION_NEXT); nextB.setEnabled(f.exists() && f.isDirectory() && f.canRead()); repaint(); pack(); break; } } } /** * @param path the pathInstall to set. * @since 0.1 */ public synchronized void setPathInstall(String path) { pathInstall.setText(path); File f = new File(pathInstall.getText()); nextB.setEnabled(f.exists() && f.isDirectory() && f.canRead()); } public void run() { setContinueInstall(true); progressBar.setValue(progressBar.getMinimum()); LaTeXDrawPath.checkInstallDirectories(); LaTeXDrawPath.checkDirectories(); progressBar.setValue(progressBar.getValue()+20); boolean okInstall = false; boolean okCopying = true; if(!isContinueInstall()) return ; try { okCopying = okCopying && copyFiles(pathJar+File.separator+DATA_DIR+File.separator+NAME_TEMPLATES_DIR, LaTeXDrawPath.PATH_TEMPLATES_SHARED, false); okCopying = okCopying && copyFiles(pathJar+File.separator+DATA_DIR+File.separator+NAME_CACHE_TEMPLATES_DIR, LaTeXDrawPath.PATH_CACHE_SHARE_DIR, false); progressBar.setValue(progressBar.getValue()+20); if(!isContinueInstall()) return ; if(!isContinueInstall()) return ; String path = pathInstall.getText() + File.separator + "latexdraw";//$NON-NLS-1$ File mainDir = new File(path); if(mainDir.exists()) okCopying = delete(mainDir); okCopying = mainDir.mkdir(); okCopying = okCopying && mainDir.exists(); okCopying = okCopying && copyFile(pathJar+File.separator+DATA_DIR+File.separator+"LaTeXDraw.jar", path, true);//$NON-NLS-1$ okCopying = okCopying && copyFile(pathJar+File.separator+"license.txt", path, true);//$NON-NLS-1$ okCopying = okCopying && copyFile(pathJar+File.separator+"release_note.txt", path, true);//$NON-NLS-1$ okCopying = okCopying && copyFiles(pathJar+File.separator+DATA_DIR+File.separator+"lib", path+File.separator+"lib", true);//$NON-NLS-1$//$NON-NLS-2$ okCopying = okCopying && copyFiles(pathJar+File.separator+DATA_DIR+File.separator+"help", path+File.separator+"help", true);//$NON-NLS-1$//$NON-NLS-2$ progressBar.setValue(progressBar.getValue()+30); if(!isContinueInstall()) return ; createProgramLauncher(); progressBar.setValue(progressBar.getValue()+20); if(!isContinueInstall()) return ; okInstall = okCopying; }catch(Exception e) { okInstall = false; } if(okInstall) { progressBar.setValue(progressBar.getMaximum()); nextB.setEnabled(true); previousB.setEnabled(true); labelProgress.setText("" + "Installation succeeded!" + "
    ");//$NON-NLS-1$//$NON-NLS-3$ } else { getLabelProgress().setText("" + "Installation failed!" + "
    " + //$NON-NLS-1$//$NON-NLS-3$ "Launch the installer as administrator." + "
    ");//$NON-NLS-2$ previousB.setEnabled(true); } setContinueInstall(false); } /** * Creates the program launcher for the OS. * @return true if the creation succeeded. * @since 1.9.2 */ private final boolean createProgramLauncher() { try { if(os.toLowerCase().equals("linux"))//$NON-NLS-1$ { File f = new File("/usr/bin/latexdraw");//$NON-NLS-1$ if(!f.exists()) { FileOutputStream fos = new FileOutputStream(f); Writer osw = new OutputStreamWriter(fos); osw.write("#! /bin/sh\n");//$NON-NLS-1$ osw.write("java -jar "+getPathInstall().getText()+File.separator+"latexdraw"+File.separator+"LaTeXDraw.jar $@\n");//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ osw.close(); fos.close(); //JAVA6 Use f.setReadable() and f.setExecutable() Runtime.getRuntime().exec("chmod 755 /usr/bin/latexdraw");//$NON-NLS-1$ } } return true; }catch(Exception e) { return false; } } /** * Copy a file. * @param from The current path of the file to move. * @param here The directory where we have to move the file. * @param replace If set to true, the file will replace any file with the same name in "here". * @return True if the move succeeded * @throws FileNotFoundException If "from" is invalid. * @throws NullPointerException If you are not lucky. * @since 1.9.2 */ private final boolean copyFile(String from, String here, boolean replace) throws FileNotFoundException, NullPointerException { File source = new File(from); if(!source.exists() || !source.canRead()) throw new FileNotFoundException(); File dest = new File(here + File.separator + source.getName()); if(dest.exists() && replace) delete(dest); if(!dest.exists()) if(source.isDirectory()) copyFiles(from, here, replace); else return copy(source, dest); return true; } /** * Copy a file into another. * @param source The source file. * @param destination The output file. * @return True if no problem occurred. * @exception IllegalArgumentException If source or destination is null. */ private final static boolean copy(File source, File destination) { if(destination==null || source==null) throw new IllegalArgumentException(); if(!source.canRead()) return false; FileInputStream sourceFile; FileOutputStream destinationFile; try { destination.createNewFile(); sourceFile = new java.io.FileInputStream(source); destinationFile = new java.io.FileOutputStream(destination); byte buffer[]=new byte[512*1024]; int nbLecture; while( (nbLecture = sourceFile.read(buffer)) != -1 ) destinationFile.write(buffer, 0, nbLecture); sourceFile.close(); destinationFile.close(); return true; } catch(Exception e) { return false; } } /** * Move a couple of files but never replace an existing file. * @param from The directory where we have to find the files to move. * @param into The destination directory. * @param replace True : the file/directory will be replaced. * @throws FileNotFoundException If a problem occurred with a source file. * @throws NullPointerException If you are not lucky. * @since 1.9.2 */ private final boolean copyFiles(String from, String into, boolean replace) throws FileNotFoundException, NullPointerException { File src = new File(from); File here = new File(into); boolean ok = true; if(!src.exists() || !src.isDirectory() || !src.canRead()) throw new FileNotFoundException(); File[] files = src.listFiles(); File dest; here.mkdir(); for(File file : files) { dest = new File(into + File.separator + file.getName()); if(replace) delete(dest); if(!dest.exists()) if(file.isFile()) ok = copy(file, dest) && ok; else { String path = file.getPath(); path = path.substring(path.lastIndexOf(File.separator)); ok = copyFiles(file.getPath(), into+path, replace) && ok; } } return ok; } /** * Add progression to the progress bar. * @param add The value to add. * @since 1.9.2 */ public synchronized void addProgressBar(int add) { progressBar.setValue(progressBar.getValue()+add); } /** * @return the continueInstall. * @since 0.1 */ public synchronized boolean isContinueInstall() { return continueInstall; } /** * @param continueInstall the continueInstall to set. * @since 0.1 */ public synchronized void setContinueInstall(boolean continueInstall) { this.continueInstall = continueInstall; } /** * remove a file or directory even if it is not empty. * @param f The file to remove * @return True if the file/directory was removed. * @since 1.9.2 */ private final static boolean delete(File f) { boolean status = true; try { File fileCur; String[] lstFile; int idxFile; lstFile = f.list(); if(lstFile==null) { f.delete(); return true; } for(idxFile = 0; idxFile < lstFile.length && status; idxFile++) { fileCur = new File(f, lstFile[idxFile]); if(fileCur.isDirectory()) status = delete(fileCur); else status = fileCur.delete(); } f.delete(); } catch (SecurityException se) { return false; } return(status); } /** * @return the labelProgress. * @since 2.0.0 */ public final synchronized JLabel getLabelProgress() { return labelProgress; } /** * @return the pathInstall. * @since 2.0.0 */ public final synchronized JTextField getPathInstall() { return pathInstall; } } latexdraw-2.0.8+1.orig/junit/0000755000000000000000000000000011347255510012631 5ustar latexdraw-2.0.8+1.orig/junit/test/0000755000000000000000000000000011347255510013610 5ustar latexdraw-2.0.8+1.orig/junit/test/TestButtonIcon.java0000644000000000000000000000366511347255510017411 0ustar /* * TestButtonIcon.java */ package junit.test; import java.awt.Color; import javax.swing.JButton; import junit.framework.TestCase; import latexDraw.ui.components.ButtonIcon; import org.junit.Before; import org.junit.Test; /** * This class contains tests the methods on the class ButtonIcon.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 02/14/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestButtonIcon extends TestCase { private ButtonIcon bi; private final Color cNull = null; private final Color c1 = new Color(100, 100, 100); private final Color c2 = new Color(50, 50, 50); @Override @Before public void setUp() { bi = new ButtonIcon(c1); } @Test public void testConstructor() { try { new ButtonIcon(cNull); fail(); }catch(IllegalArgumentException e) { /* Good */ } } @Test public void testPaintIcon() { JButton b = new JButton(); b.setIcon(bi); b.repaint(); } @Test public void testGetSetColor() { try { bi.setColor(cNull); fail(); }catch(Exception e) { /* Good */ } bi.setColor(c2); assertEquals(c2, bi.getColor()); } @Test public void testGetIconWidthHeight() { assertEquals(bi.getIconWidth(), ButtonIcon.WIDTH); assertEquals(bi.getIconHeight(), ButtonIcon.HEIGHT); } } latexdraw-2.0.8+1.orig/junit/test/TestLatexDraw.java0000644000000000000000000000167611347255510017220 0ustar package junit.test; import latexDraw.ui.LaTeXDrawFrame; /** * This class contains tests to check the LaTeXDraw methods.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 12/18/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public abstract class TestLatexDraw { public static final LaTeXDrawFrame frame; static { String[] str = new String[0]; frame = new LaTeXDrawFrame(str, false); frame.setVisible(false); } } latexdraw-2.0.8+1.orig/junit/test/TestLaTeXDrawPoint2D.java0000644000000000000000000001247011347255510020312 0ustar /* * TestLaTeXDrawPoint2D.java */ package junit.test; import junit.framework.TestCase; import latexDraw.util.LaTeXDrawPoint2D; import org.junit.Test; /** * This class contains tests the methods of the class LaTeXDrawPoint2D.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 12/23/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestLaTeXDrawPoint2D extends TestCase { @Test public void testEquals() { LaTeXDrawPoint2D p1 = new LaTeXDrawPoint2D(); LaTeXDrawPoint2D p2 = new LaTeXDrawPoint2D(); LaTeXDrawPoint2D p3 = new LaTeXDrawPoint2D(1,0); LaTeXDrawPoint2D p4 = new LaTeXDrawPoint2D(1,1); assertTrue(p1.equals(p2, 0)); assertFalse(p1.equals(p3, 0)); assertFalse(p4.equals(p3, 0)); assertFalse(p4.equals(null, 0)); p1.x = 1./3.; p2.x = 1./3.; assertTrue(p1.equals(p2, 0)); p1.x = Math.PI; p2.x = Math.PI; assertTrue(p1.equals(p2, 0)); } @Test public void testGetMiddlePoint() { LaTeXDrawPoint2D p1 = new LaTeXDrawPoint2D(); LaTeXDrawPoint2D p2 = new LaTeXDrawPoint2D(); LaTeXDrawPoint2D p3 = new LaTeXDrawPoint2D(1,1); LaTeXDrawPoint2D p4 = new LaTeXDrawPoint2D(0.5,0.5); assertTrue(p1.getMiddlePoint(p2).equals(p1, 0)); assertTrue(p1.getMiddlePoint(p3).equals(p4, 0)); p3.x = 1./3.; p4.x = 1./6.; assertTrue(p1.getMiddlePoint(p3).equals(p4, 0)); assertFalse(p1.getMiddlePoint(p4).equals(p1, 0)); } @Test public void testMove() { LaTeXDrawPoint2D p1 = new LaTeXDrawPoint2D(); LaTeXDrawPoint2D p2 = new LaTeXDrawPoint2D(-12, 65); LaTeXDrawPoint2D p3 = new LaTeXDrawPoint2D(); LaTeXDrawPoint2D p4 = new LaTeXDrawPoint2D(); p1.move(p2, p3); p4.x = p3.x - p2.x; p4.y = p3.y - p2.y; assertTrue(p1.equals(p4, 0)); p1.move(p3, p3); assertTrue(p1.equals(p1)); assertFalse(p1.equals(p2)); } @Test public void testVerticalSymmetry() { LaTeXDrawPoint2D p1 = new LaTeXDrawPoint2D(-1, 0); LaTeXDrawPoint2D p2 = new LaTeXDrawPoint2D(-1, 0); LaTeXDrawPoint2D o = new LaTeXDrawPoint2D(); LaTeXDrawPoint2D res; res = new LaTeXDrawPoint2D(p1.verticalSymmetry(o)); assertTrue(res.equals(p2, 0)); p1.y = 3; p2.y = -3; res = new LaTeXDrawPoint2D(p1.verticalSymmetry(o)); assertTrue(res.equals(p2, 0)); } @Test public void testHorizontalSymmetry() { LaTeXDrawPoint2D p1 = new LaTeXDrawPoint2D(0, 1); LaTeXDrawPoint2D p2 = new LaTeXDrawPoint2D(0, 1); LaTeXDrawPoint2D o = new LaTeXDrawPoint2D(); LaTeXDrawPoint2D res; res = new LaTeXDrawPoint2D(p1.horizontalSymmetry(o)); assertTrue(res.equals(p2, 0)); p1.x = 3; p2.x = -3; res = new LaTeXDrawPoint2D(p1.horizontalSymmetry(o)); assertTrue(res.equals(p2, 0)); } @Test public void testCentralSymmetry() { LaTeXDrawPoint2D p1 = new LaTeXDrawPoint2D(1, 1); LaTeXDrawPoint2D p2 = new LaTeXDrawPoint2D(-1, -1); LaTeXDrawPoint2D o = new LaTeXDrawPoint2D(); LaTeXDrawPoint2D res; res = new LaTeXDrawPoint2D(p1.centralSymmetry(o)); assertTrue(res.equals(p2, 0)); p1.x = 3; p2.x = -3; res = new LaTeXDrawPoint2D(p1.centralSymmetry(o)); assertTrue(res.equals(p2, 0)); } @Test public void testRotatePoint() { LaTeXDrawPoint2D p1 = new LaTeXDrawPoint2D(1, 0); LaTeXDrawPoint2D p2 = new LaTeXDrawPoint2D(0, 1); LaTeXDrawPoint2D o = new LaTeXDrawPoint2D(); LaTeXDrawPoint2D res; res = new LaTeXDrawPoint2D(p1.rotatePoint(o, Math.PI/2.)); assertTrue(res.equals(p2, 0)); res = new LaTeXDrawPoint2D(p1.rotatePoint(o, 2*Math.PI+Math.PI/2.)); assertTrue(res.equals(p2, 0)); res = new LaTeXDrawPoint2D(p1.rotatePoint(o, -3.*Math.PI/2.)); assertTrue(res.equals(p2, 0)); p2.x = -1; p2.y = 0; res = new LaTeXDrawPoint2D(p1.rotatePoint(o, Math.PI)); assertTrue(res.equals(p2, 0)); res = new LaTeXDrawPoint2D(p1.rotatePoint(o, 2*Math.PI+Math.PI)); assertTrue(res.equals(p2, 0)); res = new LaTeXDrawPoint2D(p1.rotatePoint(o, -Math.PI)); assertTrue(res.equals(p2, 0)); p2.x = 0; p2.y = -1; res = new LaTeXDrawPoint2D(p1.rotatePoint(o, 3.*Math.PI/2.)); assertTrue(res.equals(p2, 0)); res = new LaTeXDrawPoint2D(p1.rotatePoint(o, 2*Math.PI+3.*Math.PI/2.)); assertTrue(res.equals(p2, 0)); res = new LaTeXDrawPoint2D(p1.rotatePoint(o, -Math.PI/2.)); assertTrue(res.equals(p2, 0)); p2.x = 1; p2.y = 0; res = new LaTeXDrawPoint2D(p1.rotatePoint(o, 2.*Math.PI)); assertTrue(res.equals(p2, 0)); res = new LaTeXDrawPoint2D(p1.rotatePoint(o, 4.*Math.PI)); assertTrue(res.equals(p2, 0)); res = new LaTeXDrawPoint2D(p1.rotatePoint(o, 0.)); assertTrue(res.equals(p2, 0)); res = new LaTeXDrawPoint2D(p1.rotatePoint(o, -2.*Math.PI)); assertTrue(res.equals(p2, 0)); } } latexdraw-2.0.8+1.orig/junit/test/TestPSTricksConstants.java0000644000000000000000000001147111347255510020716 0ustar /* * PSTricksConstantsTest.java */ package junit.test; import junit.framework.TestCase; import latexDraw.psTricks.PSTricksConstants; import org.junit.*; /** * This class contains tests for the {@link PSTricksConstants} class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 06/20/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestPSTricksConstants extends TestCase { @Test public void testIsValidDotStyle() { assertFalse(PSTricksConstants.isValidDotStyle(null)); assertFalse(PSTricksConstants.isValidDotStyle("coucou!!")); assertTrue(PSTricksConstants.isValidDotStyle(PSTricksConstants.DOT_STYLE)); assertTrue(PSTricksConstants.isValidDotStyle(PSTricksConstants.DIAMOND_STYLE)); assertTrue(PSTricksConstants.isValidDotStyle(PSTricksConstants.FDIAMOND_STYLE)); assertTrue(PSTricksConstants.isValidDotStyle(PSTricksConstants.FPENTAGON_STYLE)); assertTrue(PSTricksConstants.isValidDotStyle(PSTricksConstants.PENTAGON_STYLE)); assertTrue(PSTricksConstants.isValidDotStyle(PSTricksConstants.FSQUARE_STYLE)); assertTrue(PSTricksConstants.isValidDotStyle(PSTricksConstants.SQUARE_STYLE)); assertTrue(PSTricksConstants.isValidDotStyle(PSTricksConstants.FTRIANGLE_STYLE)); assertTrue(PSTricksConstants.isValidDotStyle(PSTricksConstants.TRIANGLE_STYLE)); assertTrue(PSTricksConstants.isValidDotStyle(PSTricksConstants.O_STYLE)); assertTrue(PSTricksConstants.isValidDotStyle(PSTricksConstants.OPLUS_STYLE)); assertTrue(PSTricksConstants.isValidDotStyle(PSTricksConstants.OTIMES_STYLE)); assertTrue(PSTricksConstants.isValidDotStyle(PSTricksConstants.X_STYLE)); assertTrue(PSTricksConstants.isValidDotStyle(PSTricksConstants.PLUS_STYLE)); assertTrue(PSTricksConstants.isValidDotStyle(PSTricksConstants.BAR_STYLE)); assertTrue(PSTricksConstants.isValidDotStyle(PSTricksConstants.ASTERISK_STYLE)); } @Test public void testIsValidFillStyle() { assertFalse(PSTricksConstants.isValidArrowStyle(null)); assertFalse(PSTricksConstants.isValidArrowStyle("coucou!!")); assertTrue(PSTricksConstants.isValidArrowStyle(PSTricksConstants.NONEARROW_STYLE)); assertTrue(PSTricksConstants.isValidArrowStyle(PSTricksConstants.RARROW_STYLE)); assertTrue(PSTricksConstants.isValidArrowStyle(PSTricksConstants.RRBRACKET_STYLE)); assertTrue(PSTricksConstants.isValidArrowStyle(PSTricksConstants.RSBRACKET_STYLE)); assertTrue(PSTricksConstants.isValidArrowStyle(PSTricksConstants.LARROW_STYLE)); assertTrue(PSTricksConstants.isValidArrowStyle(PSTricksConstants.LRBRACKET_STYLE)); assertTrue(PSTricksConstants.isValidArrowStyle(PSTricksConstants.LSBRACKET_STYLE)); assertTrue(PSTricksConstants.isValidArrowStyle(PSTricksConstants.SQUAREEND_STYLE)); assertTrue(PSTricksConstants.isValidArrowStyle(PSTricksConstants.ROUNDIN_STYLE)); assertTrue(PSTricksConstants.isValidArrowStyle(PSTricksConstants.BARIN_STYLE)); assertTrue(PSTricksConstants.isValidArrowStyle(PSTricksConstants.CIRCLEIN_STYLE)); assertTrue(PSTricksConstants.isValidArrowStyle(PSTricksConstants.DISKIN_STYLE)); assertTrue(PSTricksConstants.isValidArrowStyle(PSTricksConstants.BAREND_STYLE)); assertTrue(PSTricksConstants.isValidArrowStyle(PSTricksConstants.DISKEND_STYLE)); assertTrue(PSTricksConstants.isValidArrowStyle(PSTricksConstants.CIRCLEEND_STYLE)); assertTrue(PSTricksConstants.isValidArrowStyle(PSTricksConstants.ROUNDEND_STYLE)); } @Test public void testIsValidArrowStyle() { assertFalse(PSTricksConstants.isValidFillStyle(null)); assertFalse(PSTricksConstants.isValidFillStyle("coucou!!")); assertTrue(PSTricksConstants.isValidFillStyle(PSTricksConstants.TOKEN_FILL_CROSSHATCH)); assertTrue(PSTricksConstants.isValidFillStyle(PSTricksConstants.TOKEN_FILL_CROSSHATCH_F)); assertTrue(PSTricksConstants.isValidFillStyle(PSTricksConstants.TOKEN_FILL_GRADIENT)); assertTrue(PSTricksConstants.isValidFillStyle(PSTricksConstants.TOKEN_FILL_HLINES)); assertTrue(PSTricksConstants.isValidFillStyle(PSTricksConstants.TOKEN_FILL_HLINES_F)); assertTrue(PSTricksConstants.isValidFillStyle(PSTricksConstants.TOKEN_FILL_NONE)); assertTrue(PSTricksConstants.isValidFillStyle(PSTricksConstants.TOKEN_FILL_SOLID)); assertTrue(PSTricksConstants.isValidFillStyle(PSTricksConstants.TOKEN_FILL_VLINES)); assertTrue(PSTricksConstants.isValidFillStyle(PSTricksConstants.TOKEN_FILL_VLINES_F)); } } latexdraw-2.0.8+1.orig/junit/test/svg/0000755000000000000000000000000011347255510014407 5ustar latexdraw-2.0.8+1.orig/junit/test/svg/AbstractTestSVGElement.java0000644000000000000000000000452211347255510021552 0ustar package junit.test.svg; import junit.framework.TestCase; import latexDraw.parsers.svg.SVGAttr; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.SVGNodeList; import latexDraw.parsers.svg.elements.SVGElement; import org.junit.Before; import org.junit.Test; import org.w3c.dom.DOMException; public abstract class AbstractTestSVGElement extends TestCase { protected SVGElement node; protected SVGDocument doc = new SVGDocument(); public abstract String getNameNode(); @Override @Before public void setUp() { doc = new SVGDocument(); node = (SVGElement)doc.createElement(getNameNode()); } @Test public void testGetNodeName() { assertEquals(getNameNode(), node.getNodeName()); } @Test public void testSetNodeName() { node.setNodeName("test"); assertEquals("test", node.getNodeName()); node.setNodeName(getNameNode()); assertEquals(getNameNode(), node.getNodeName()); } @Test public void testSetParent() { SVGElement elt = (SVGElement)doc.createElement("elt"); node.setParent(null); assertNull(node.getParent()); node.setParent(elt); assertEquals(elt, node.getParent()); SVGNodeList list = elt.getChildren(getNameNode()); assertEquals(1, list.getLength()); node.setParent(null); list = elt.getChildren(getNameNode()); assertEquals(0, list.getLength()); } @Test public void testGetAttribute() { assertNull(node.getAttribute(null)); assertNull(node.getAttribute("")); node.setAttribute("testAttr", "valAttr"); assertEquals(node.getAttribute("testAttr"), "valAttr"); } @Test public void testGetAttributeNode() { assertNull(node.getAttributeNode(null)); assertNull(node.getAttributeNode("")); node.setAttribute("testAttr2", "valAttr2"); assertEquals(node.getAttributeNode("testAttr2").getNodeValue(), "valAttr2"); } @Test public void testGetTagName() { assertEquals(node.getNodeName(), node.getTagName()); } @Test public void testAppendChild() { try { node.appendChild(null); fail(); } catch(DOMException e) { /* ok */ } try { node.appendChild(new SVGAttr("", "", node)); fail(); } catch(DOMException e) { /* ok */ } SVGElement elt = (SVGElement)doc.createElement("eltAppendChild"); assertEquals(node.appendChild(elt), elt); assertEquals(node.getChildren("eltAppendChild").getLength(), 1); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGPathSegLinetoHorizontal.java0000644000000000000000000000425211347255510023255 0ustar package junit.test.svg; import java.text.ParseException; import junit.framework.TestCase; import latexDraw.parsers.svg.elements.path.SVGPathSeg; import latexDraw.parsers.svg.elements.path.SVGPathSegLinetoHorizontal; import latexDraw.parsers.svg.elements.path.SVGPathSegMoveto; import latexDraw.parsers.svg.elements.path.SVGPathSeg.PathSeg; import latexDraw.parsers.svg.parsers.SVGPathHandler; import latexDraw.parsers.svg.parsers.SVGPathParser; import org.junit.Test; /** * This class contains tests for the SVGPathSegLinetoHorizontal class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/23/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestSVGPathSegLinetoHorizontal extends TestCase implements SVGPathHandler { protected final SVGPathSegLinetoHorizontal seg = new SVGPathSegLinetoHorizontal(-1, false); protected int cpt = 0; @Test public void testGetters() { assertEquals(seg.getX(), -1.); assertFalse(seg.isRelative()); assertEquals(seg.getType(), PathSeg.LINETO_HORIZONTAL_ABS); } @Test public void testToString() { SVGPathSegMoveto m = new SVGPathSegMoveto(0, 0, false); SVGPathParser parser = new SVGPathParser(m.toString() + " " + seg.toString(), this); try { parser.parse(); } catch(ParseException e) { fail(); } } public void onPathSeg(SVGPathSeg pathSeg) { if((pathSeg instanceof SVGPathSegMoveto) && cpt==0) { cpt++; return ; } assertTrue(pathSeg instanceof SVGPathSegLinetoHorizontal); SVGPathSegLinetoHorizontal seg2 = (SVGPathSegLinetoHorizontal)pathSeg; assertEquals(seg.getX(), seg2.getX()); assertEquals(seg.isRelative(), seg2.isRelative()); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGPolylineElement.java0000644000000000000000000001057611347255510021610 0ustar package junit.test.svg; import java.awt.geom.Point2D; import java.text.ParseException; import java.util.Vector; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGElements; import latexDraw.parsers.svg.elements.SVGPolyLineElement; import org.junit.Test; /** * This class contains tests for the SVGPolylineElement class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/10/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestSVGPolylineElement extends AbstractTestSVGElement { @Test public void testGetPoints() { try { String path = "10,10 20,20"; node.setAttribute(SVGAttributes.SVG_POINTS, path); SVGPolyLineElement pl = new SVGPolyLineElement(node, null); assertEquals(pl.getPoints(), path); } catch(MalformedSVGDocument e) { fail(); } catch(ParseException e) { fail(); } } @Test public void testEnableRendering() { try { node.setAttribute(SVGAttributes.SVG_POINTS, "10,10 20,20"); SVGPolyLineElement pl = new SVGPolyLineElement(node, null); assertTrue(pl.enableRendering()); } catch(MalformedSVGDocument e) { fail(); } catch(ParseException e) { fail(); } } @Test public void testSetPoints() { try { String path = "10,10 20,20"; node.setAttribute(SVGAttributes.SVG_POINTS, "10,10 20,20"); SVGPolyLineElement pl = new SVGPolyLineElement(node, null); assertEquals(pl.getPoints(), path); pl.setPoints("10,10 20,20"); assertEquals(2, pl.getPoints2D().size()); assertEquals(new Point2D.Double(10, 10), pl.getPoints2D().firstElement()); assertEquals(new Point2D.Double(20, 20), pl.getPoints2D().lastElement()); try { pl.setPoints("10,,20fdsf"); fail(); } catch(ParseException e) { /* */ } } catch(MalformedSVGDocument e) { fail(); } catch(ParseException e) { fail(); } } @Test public void testGetPoints2D() { try { String path = " 10\t ,\n 10 \t 20 \t\n\t\r, \n20 \r30,30 \n"; node.setAttribute(SVGAttributes.SVG_POINTS, path); SVGPolyLineElement pl = new SVGPolyLineElement(node, null); Vector pts; pts = pl.getPoints2D(); assertNotNull(pts); assertEquals(3, pts.size()); assertEquals(new Point2D.Double(10, 10), pts.firstElement()); assertEquals(new Point2D.Double(20, 20), pts.elementAt(1)); assertEquals(new Point2D.Double(30, 30), pts.lastElement()); } catch(MalformedSVGDocument e) { fail(); } catch(ParseException e) { fail(); } } @Test public void testContructor() { try { new SVGPolyLineElement(null, null); fail(); } catch(Exception e){/**/} try { new SVGPolyLineElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} catch(ParseException e) {/**/} try { node.setAttribute(SVGAttributes.SVG_POINTS, ""); new SVGPolyLineElement(node, null); } catch(MalformedSVGDocument e){fail();} catch(ParseException e) {fail();} try { node.setAttribute(SVGAttributes.SVG_POINTS, "dsqdgfd"); new SVGPolyLineElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} catch(ParseException e) {/**/} try { node.setAttribute(SVGAttributes.SVG_POINTS, "10,10"); new SVGPolyLineElement(node, null); } catch(MalformedSVGDocument e){fail();} catch(ParseException e) {fail();} try { node.setAttribute(SVGAttributes.SVG_POINTS, ","); new SVGPolyLineElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} catch(ParseException e) {/**/} try { node.setAttribute(SVGAttributes.SVG_POINTS, "10,10 20,20"); new SVGPolyLineElement(node, null); } catch(MalformedSVGDocument e) { fail(); } catch(ParseException e) { fail(); } } @Override public String getNameNode() { return SVGElements.SVG_POLY_LINE; } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGSVGElement.java0000644000000000000000000001140611347255510020445 0ustar package junit.test.svg; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.SVGElements; import latexDraw.parsers.svg.elements.SVGSVGElement; import org.junit.Test; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * This class contains tests for the SVGSVGElement class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/12/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestSVGSVGElement extends AbstractTestSVGElement { @Test public void testContructor() { try { new SVGSVGElement(null); fail(); } catch(Exception e){/**/} try { new SVGSVGElement(node, null); } catch(MalformedSVGDocument e){ fail(); } } @Test public void testGetDefs() { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.newDocument(); Element elt, n; SVGSVGElement e = new SVGSVGElement(node, null); assertNull(e.getMeta()); n = document.createElement(SVGElements.SVG_SVG); n.setAttribute("xmlns", SVGDocument.SVG_NAMESPACE); elt = document.createElement(SVGElements.SVG_DEFS); n.appendChild(elt); e = new SVGSVGElement(n, null); assertNotNull(e.getDefs()); } catch(Exception e) { fail(); } } @Test public void testGetMeta() { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.newDocument(); Element elt, n; SVGSVGElement e = new SVGSVGElement(node, null); assertNull(e.getMeta()); n = document.createElement(SVGElements.SVG_SVG); n.setAttribute("xmlns", SVGDocument.SVG_NAMESPACE); elt = document.createElement(SVGElements.SVG_METADATA); n.appendChild(elt); e = new SVGSVGElement(n, null); assertNotNull(e.getMeta()); } catch(Exception e) { fail(); } } @Test public void testGetHeight() { try { node.setAttribute(SVGAttributes.SVG_HEIGHT, "200"); SVGSVGElement e = new SVGSVGElement(node, null); assertEquals(e.getHeight(), 200.); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testEnableRendering() { try { SVGSVGElement e = new SVGSVGElement(node, null); assertTrue(e.enableRendering()); node.setAttribute(SVGAttributes.SVG_WIDTH, "0"); e = new SVGSVGElement(node, null); assertFalse(e.enableRendering()); node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "0"); e = new SVGSVGElement(node, null); assertFalse(e.enableRendering()); node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "10"); e = new SVGSVGElement(node, null); assertTrue(e.enableRendering()); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetY() { try { SVGSVGElement e = new SVGSVGElement(node, null); assertEquals(e.getY(), 0.); node.setAttribute(SVGAttributes.SVG_Y, "-10"); e = new SVGSVGElement(node, null); assertEquals(e.getY(), -10.); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetX() { try { SVGSVGElement e = new SVGSVGElement(node, null); assertEquals(e.getX(), 0.); node.setAttribute(SVGAttributes.SVG_X, "10"); e = new SVGSVGElement(node, null); assertEquals(e.getX(), 10.); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetWidth() { try { node.setAttribute(SVGAttributes.SVG_WIDTH, "100"); SVGSVGElement e = new SVGSVGElement(node, null); assertEquals(e.getWidth(), 100.); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testVersion() { try { node.setAttribute(SVGAttributes.SVG_VERSION, "1.1"); SVGSVGElement e = new SVGSVGElement(node, null); assertEquals(e.getVersion(), "1.1"); } catch(MalformedSVGDocument e) { fail(); } } @Override public String getNameNode() { return SVGElements.SVG_SVG; } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGPathSegArc.java0000644000000000000000000000544011347255510020456 0ustar package junit.test.svg; import java.text.ParseException; import junit.framework.TestCase; import latexDraw.parsers.svg.elements.path.SVGPathSeg; import latexDraw.parsers.svg.elements.path.SVGPathSegArc; import latexDraw.parsers.svg.elements.path.SVGPathSegMoveto; import latexDraw.parsers.svg.elements.path.SVGPathSeg.PathSeg; import latexDraw.parsers.svg.parsers.SVGPathHandler; import latexDraw.parsers.svg.parsers.SVGPathParser; import org.junit.Test; /** * This class contains tests for the SVGPathSegArc class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/22/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestSVGPathSegArc extends TestCase implements SVGPathHandler { protected final SVGPathSegArc seg = new SVGPathSegArc(1, 2, 3, 4, 5, true, false, true); protected int cpt = 0; @Test public void testGetters() { SVGPathSegArc seg2 = new SVGPathSegArc(1, 2, 3, 4, 5, false, true, false); assertEquals(seg.getAngle(), 5.); assertEquals(seg.getRX(), 3.); assertEquals(seg.getRY(), 4.); assertEquals(seg.getX(), 1.); assertEquals(seg.getY(), 2.); assertTrue(seg.isLargeArcFlag()); assertFalse(seg.isSweepFlag()); assertTrue(seg.isRelative()); assertFalse(seg2.isLargeArcFlag()); assertTrue(seg2.isSweepFlag()); assertFalse(seg2.isRelative()); assertEquals(seg.getType(), PathSeg.ARC_REL); assertEquals(seg2.getType(), PathSeg.ARC_ABS); } @Test public void testToString() { SVGPathSegMoveto m = new SVGPathSegMoveto(0, 0, false); SVGPathParser parser = new SVGPathParser(m.toString() + " " + seg.toString(), this); try { parser.parse(); } catch(ParseException e) { fail(); } } public void onPathSeg(SVGPathSeg pathSeg) { if((pathSeg instanceof SVGPathSegMoveto) && cpt==0) { cpt++; return ; } assertTrue(pathSeg instanceof SVGPathSegArc); SVGPathSegArc seg2 = (SVGPathSegArc)pathSeg; assertEquals(seg.getAngle(), seg2.getAngle()); assertEquals(seg.getRX(), seg2.getRX()); assertEquals(seg.getRY(), seg2.getRY()); assertEquals(seg.getX(), seg2.getX()); assertEquals(seg.getY(), seg2.getY()); assertEquals(seg.isLargeArcFlag(), seg2.isLargeArcFlag()); assertEquals(seg.isRelative(), seg2.isRelative()); assertEquals(seg.isSweepFlag(), seg2.isSweepFlag()); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGImageElement.java0000644000000000000000000001212211347255510021024 0ustar package junit.test.svg; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGElements; import latexDraw.parsers.svg.elements.SVGImageElement; import org.junit.Test; /** * This class contains tests for the SVGImageElement class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/15/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestSVGImageElement extends AbstractTestSVGElement { @Test public void testContructor() { try { new SVGImageElement(null, ""); fail(); } catch(Exception e){/**/} try { new SVGImageElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_WIDTH, "dsd"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "dsd"); new SVGImageElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_WIDTH, "1"); new SVGImageElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_WIDTH, "-1"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "10"); new SVGImageElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "-1"); new SVGImageElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); new SVGImageElement(node, null); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetHeight() { try { node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); SVGImageElement e = new SVGImageElement(node, null); assertEquals(e.getHeight(), 20.); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetWidth() { try { node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); SVGImageElement e = new SVGImageElement(node, null); assertEquals(e.getWidth(), 10.); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetURI() { try { node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); SVGImageElement e = new SVGImageElement(node, null); assertNull(e.getURI()); node.setAttribute("xlink:href", "/dir/file"); e = new SVGImageElement(node, null); assertEquals(e.getURI(), "/dir/file"); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testEnableRendering() { try { node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); SVGImageElement e = new SVGImageElement(node, null); assertFalse(e.enableRendering()); node.setAttribute("xlink:href", "/rerzerojcsf/dsqdsdfgdre"); e = new SVGImageElement(node, null); assertFalse(e.enableRendering()); node.setAttribute("xlink:href", "build.xml"); e = new SVGImageElement(node, null); assertTrue(e.enableRendering()); node.setAttribute(SVGAttributes.SVG_WIDTH, "0"); e = new SVGImageElement(node, null); assertFalse(e.enableRendering()); node.setAttribute(SVGAttributes.SVG_HEIGHT, "0"); e = new SVGImageElement(node, null); assertFalse(e.enableRendering()); node.setAttribute(SVGAttributes.SVG_WIDTH, "20"); e = new SVGImageElement(node, null); assertFalse(e.enableRendering()); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetY() { try { node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); SVGImageElement e = new SVGImageElement(node, null); assertEquals(e.getY(), 0.); node.setAttribute(SVGAttributes.SVG_Y, "1"); e = new SVGImageElement(node, null); assertEquals(1., e.getY()); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetX() { try { node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); SVGImageElement e = new SVGImageElement(node, null); assertEquals(e.getX(), 0.); node.setAttribute(SVGAttributes.SVG_X, "1"); e = new SVGImageElement(node, null); assertEquals(1., e.getX()); } catch(MalformedSVGDocument e) { fail(); } } @Override public String getNameNode() { return SVGElements.SVG_IMAGE; } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGPathSegCurvetoCubicSmooth.java0000644000000000000000000000467111347255510023545 0ustar package junit.test.svg; import java.text.ParseException; import junit.framework.TestCase; import latexDraw.parsers.svg.elements.path.SVGPathSeg; import latexDraw.parsers.svg.elements.path.SVGPathSegCurvetoCubicSmooth; import latexDraw.parsers.svg.elements.path.SVGPathSegMoveto; import latexDraw.parsers.svg.elements.path.SVGPathSeg.PathSeg; import latexDraw.parsers.svg.parsers.SVGPathHandler; import latexDraw.parsers.svg.parsers.SVGPathParser; import org.junit.Test; /** * This class contains tests for the SVGPathSegCurvetoCubicSmooth class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/22/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestSVGPathSegCurvetoCubicSmooth extends TestCase implements SVGPathHandler { protected final SVGPathSegCurvetoCubicSmooth seg = new SVGPathSegCurvetoCubicSmooth(0.8E2, -2., -5.e-1, .5, false); protected int cpt = 0; @Test public void testGetters() { assertEquals(seg.getX(), 0.8E2); assertEquals(seg.getX2(), -5.e-1); assertEquals(seg.getY(), -2.); assertEquals(seg.getY2(), .5); assertFalse(seg.isRelative()); assertEquals(seg.getType(), PathSeg.CURVETO_CUBIC_SMOOTH_ABS); } @Test public void testToString() { SVGPathSegMoveto m = new SVGPathSegMoveto(0, 0, false); SVGPathParser parser = new SVGPathParser(m.toString() + " " + seg.toString(), this); try { parser.parse(); } catch(ParseException e) { fail(); } } public void onPathSeg(SVGPathSeg pathSeg) { if((pathSeg instanceof SVGPathSegMoveto) && cpt==0) { cpt++; return ; } assertTrue(pathSeg instanceof SVGPathSegCurvetoCubicSmooth); SVGPathSegCurvetoCubicSmooth seg2 = (SVGPathSegCurvetoCubicSmooth)pathSeg; assertEquals(seg.getX(), seg2.getX()); assertEquals(seg.getX2(), seg2.getX2()); assertEquals(seg.getY(), seg2.getY()); assertEquals(seg.getY2(), seg2.getY2()); assertEquals(seg.isRelative(), seg2.isRelative()); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGCircleElement.java0000644000000000000000000001036111347255510021206 0ustar package junit.test.svg; import latexDraw.parsers.svg.*; import latexDraw.parsers.svg.elements.SVGCircleElement; import latexDraw.parsers.svg.elements.SVGElement; import latexDraw.parsers.svg.parsers.UnitProcessor; import org.junit.Before; import org.junit.Test; /** * This class contains tests for the SVGCircleElement class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 02/02/08
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestSVGCircleElement extends AbstractTestSVGElement { @Override @Before public void setUp() { doc = new SVGDocument(); node = (SVGElement)doc.createElement(SVGElements.SVG_CIRCLE); } @Test public void testContructor() { try { new SVGCircleElement(null, null); fail(); } catch(Exception e){/**/} try { new SVGCircleElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_R, "dsd"); //$NON-NLS-1$ new SVGCircleElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_R, "-1"); //$NON-NLS-1$ new SVGCircleElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_R, "10"); //$NON-NLS-1$ new SVGCircleElement(node, null); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetCy() { try { node.setAttribute(SVGAttributes.SVG_R, "10"); //$NON-NLS-1$ SVGCircleElement e = new SVGCircleElement(node, null); assertEquals(e.getCy(), 0.); node.setAttribute(SVGAttributes.SVG_CY, "40"); //$NON-NLS-1$ e = new SVGCircleElement(node, null); assertEquals(e.getCy(), 40.); node.setAttribute(SVGAttributes.SVG_CY, "40px "); //$NON-NLS-1$ e = new SVGCircleElement(node, null); assertEquals(e.getCy(), 40.); node.setAttribute(SVGAttributes.SVG_CY, " 40 cm "); //$NON-NLS-1$ e = new SVGCircleElement(node, null); assertEquals(e.getCy(), UnitProcessor.toUserUnit(40, SVGLength.LengthType.CM)); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetCx() { try { node.setAttribute(SVGAttributes.SVG_R, "10"); //$NON-NLS-1$ SVGCircleElement e = new SVGCircleElement(node, null); assertEquals(e.getCx(), 0.); node.setAttribute(SVGAttributes.SVG_CX, "76.987"); //$NON-NLS-1$ e = new SVGCircleElement(node, null); assertEquals(e.getCx(), 76.987); node.setAttribute(SVGAttributes.SVG_CX, "40px "); //$NON-NLS-1$ e = new SVGCircleElement(node, null); assertEquals(e.getCx(), 40.); node.setAttribute(SVGAttributes.SVG_CX, " 30.5 mm "); //$NON-NLS-1$ e = new SVGCircleElement(node, null); assertEquals(e.getCx(), UnitProcessor.toUserUnit(30.5, SVGLength.LengthType.MM)); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testEnableRendering() { try { node.setAttribute(SVGAttributes.SVG_R, "0"); //$NON-NLS-1$ SVGCircleElement e = new SVGCircleElement(node, null); assertFalse(e.enableRendering()); node.setAttribute(SVGAttributes.SVG_R, "10"); //$NON-NLS-1$ e = new SVGCircleElement(node, null); assertTrue(e.enableRendering()); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetR() { try { node.setAttribute(SVGAttributes.SVG_R, "20"); //$NON-NLS-1$ SVGCircleElement e = new SVGCircleElement(node, null); assertEquals(e.getR(), 20.); node.setAttribute(SVGAttributes.SVG_R, "20 pt"); //$NON-NLS-1$ e = new SVGCircleElement(node, null); assertEquals(e.getR(), UnitProcessor.toUserUnit(20, SVGLength.LengthType.PT)); } catch(MalformedSVGDocument e) { fail(); } } @Override public String getNameNode() { return SVGElements.SVG_CIRCLE; } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGMatrix.java0000644000000000000000000000771011347255510017743 0ustar package junit.test.svg; import junit.framework.TestCase; import latexDraw.parsers.svg.SVGMatrix; import org.junit.Test; /** * Tests the class SVGMatrix.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/17/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1
    */ public class TestSVGMatrix extends TestCase { @Test public void testConstructor() { SVGMatrix m = new SVGMatrix(); assertEquals(m.getA(), 1.); assertEquals(m.getD(), 1.); assertEquals(m.getE(), 0.); assertEquals(m.getB(), 0.); assertEquals(m.getC(), 0.); assertEquals(m.getF(), 0.); } @Test public void testInitMatrix() { SVGMatrix m = new SVGMatrix(); m.initMatrix(); assertEquals(m.getA(), 1.); assertEquals(m.getD(), 1.); assertEquals(m.getE(), 0.); assertEquals(m.getB(), 0.); assertEquals(m.getC(), 0.); assertEquals(m.getF(), 0.); } @Test public void testRotate() { SVGMatrix m = new SVGMatrix(); double angle = 0.14; m.rotate(angle); assertEquals(m.getA(), Math.cos(angle)); assertEquals(m.getB(), Math.sin(angle)); assertEquals(m.getC(), -Math.sin(angle)); assertEquals(m.getD(), Math.cos(angle)); assertEquals(m.getE(), 0.); assertEquals(m.getF(), 0.); } @Test public void testTranslate() { SVGMatrix m = new SVGMatrix(); double tx = 1.4, ty = -0.4; m.translate(tx, ty); assertEquals(m.getA(), 1.); assertEquals(m.getB(), 0.); assertEquals(m.getC(), 0.); assertEquals(m.getD(), 1.); assertEquals(m.getE(), tx); assertEquals(m.getF(), ty); } @Test public void testScaleNonUniform() { SVGMatrix m = new SVGMatrix(); double sx = 5.877423, sy = -0.04; m.scaleNonUniform(sx, sy); assertEquals(m.getA(), sx); assertEquals(m.getB(), 0.); assertEquals(m.getC(), 0.); assertEquals(m.getD(), sy); assertEquals(m.getE(), 0.); assertEquals(m.getF(), 0.); } @Test public void testScale() { SVGMatrix m = new SVGMatrix(); double s = 5.877423; m.scale(s); assertEquals(m.getA(), s); assertEquals(m.getB(), 0.); assertEquals(m.getC(), 0.); assertEquals(m.getD(), s); assertEquals(m.getE(), 0.); assertEquals(m.getF(), 0.); } @Test public void testSkewX() { SVGMatrix m = new SVGMatrix(); double angle = 1.92837; m.skewX(angle); assertEquals(m.getA(), 1.); assertEquals(m.getB(), 0.); assertEquals(m.getC(), Math.tan(angle)); assertEquals(m.getD(), 1.); assertEquals(m.getE(), 0.); assertEquals(m.getF(), 0.); } @Test public void testSkewY() { SVGMatrix m = new SVGMatrix(); double angle = -7.7283; m.skewY(angle); assertEquals(m.getA(), 1.); assertEquals(m.getB(), Math.tan(angle)); assertEquals(m.getC(), 0.); assertEquals(m.getD(), 1.); assertEquals(m.getE(), 0.); assertEquals(m.getF(), 0.); } @Test public void testSetMatrix() { SVGMatrix m = new SVGMatrix(); m.setMatrix(2, 3, 4, 5, 6, 7); assertEquals(m.getA(), 2.); assertEquals(m.getB(), 3.); assertEquals(m.getC(), 4.); assertEquals(m.getD(), 5.); assertEquals(m.getE(), 6.); assertEquals(m.getF(), 7.); } @Test public void testMultiply() { SVGMatrix m1 = new SVGMatrix(); SVGMatrix m2 = new SVGMatrix(); SVGMatrix m3; m1.setMatrix(1, 2, 3, 4, 5, 6); m2.setMatrix(7, 8, 9, 10, 11, 12); m3 = m1.multiply(m2); assertEquals(m3.getA(), 31.); assertEquals(m3.getB(), 46.); assertEquals(m3.getC(), 39.); assertEquals(m3.getD(), 58.); assertEquals(m3.getE(), 52.); assertEquals(m3.getF(), 76.); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGPathSegCurvetoQuadratic.java0000644000000000000000000000464011347255510023237 0ustar package junit.test.svg; import java.text.ParseException; import junit.framework.TestCase; import latexDraw.parsers.svg.elements.path.SVGPathSeg; import latexDraw.parsers.svg.elements.path.SVGPathSegCurvetoQuadratic; import latexDraw.parsers.svg.elements.path.SVGPathSegMoveto; import latexDraw.parsers.svg.elements.path.SVGPathSeg.PathSeg; import latexDraw.parsers.svg.parsers.SVGPathHandler; import latexDraw.parsers.svg.parsers.SVGPathParser; import org.junit.Test; /** * This class contains tests for the SVGPathSegCurvetoQuadratic class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/23/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestSVGPathSegCurvetoQuadratic extends TestCase implements SVGPathHandler { protected final SVGPathSegCurvetoQuadratic seg = new SVGPathSegCurvetoQuadratic(3e1, 4e-1, -5e1, 6.5, true); protected int cpt = 0; @Test public void testGetters() { assertEquals(seg.getX1(), -5e1); assertEquals(seg.getY1(), 6.5); assertEquals(seg.getX(), 3e1); assertEquals(seg.getY(), 4e-1); assertTrue(seg.isRelative()); assertEquals(seg.getType(), PathSeg.CURVETO_QUADRATIC_REL); } @Test public void testToString() { SVGPathSegMoveto m = new SVGPathSegMoveto(0, 0, false); SVGPathParser parser = new SVGPathParser(m.toString() + " " + seg.toString(), this); try { parser.parse(); } catch(ParseException e) { fail(); } } public void onPathSeg(SVGPathSeg pathSeg) { if((pathSeg instanceof SVGPathSegMoveto) && cpt==0) { cpt++; return ; } assertTrue(pathSeg instanceof SVGPathSegCurvetoQuadratic); SVGPathSegCurvetoQuadratic seg2 = (SVGPathSegCurvetoQuadratic)pathSeg; assertEquals(seg.getX(), seg2.getX()); assertEquals(seg.getX1(), seg2.getX1()); assertEquals(seg.getY(), seg2.getY()); assertEquals(seg.getY1(), seg2.getY1()); assertEquals(seg.isRelative(), seg2.isRelative()); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGNamedNodeMap.java0000644000000000000000000001051711347255510020766 0ustar package junit.test.svg; import junit.framework.TestCase; import latexDraw.parsers.svg.SVGAttr; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.SVGNamedNodeMap; import org.junit.Before; import org.junit.Test; import org.w3c.dom.DOMException; /** * This class contains tests for the SVGNamedNodeMap class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 03/29/08
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestSVGNamedNodeMap extends TestCase { protected SVGNamedNodeMap map; protected SVGDocument doc; @Override @Before public void setUp() { doc = new SVGDocument(); map = new SVGNamedNodeMap(); } @Test public void testSVGNamedNodeMap() { assertNotNull(map.getAttributes()); } @Test public void testGetLength() { map.getAttributes().clear(); assertEquals(0, map.getLength()); map.getAttributes().add(new SVGAttr("", "", doc.createElement("elt"))); assertEquals(1, map.getLength()); map.getAttributes().clear(); } @Test public void testGetNamedItem() { map.getAttributes().clear(); assertNull(map.getNamedItem(null)); assertNull(map.getNamedItem("")); assertNull(map.getNamedItem("test")); map.getAttributes().add(new SVGAttr("test", "", doc.createElement("elt"))); assertNull(map.getNamedItem(null)); assertNull(map.getNamedItem("")); assertNotNull(map.getNamedItem("test")); map.getAttributes().clear(); } @Test public void testItem() { SVGAttr attr = new SVGAttr("test", "", doc.createElement("elt")); map.getAttributes().clear(); assertNull(map.item(0)); assertNull(map.item(-1)); assertNull(map.item(1)); map.getAttributes().add(attr); assertNull(map.item(-1)); assertNull(map.item(1)); assertEquals(map.item(0), attr); map.getAttributes().clear(); } @Test public void testRemoveNamedItem() { SVGAttr attr = new SVGAttr("test", "", doc.createElement("elt")); map.getAttributes().clear(); try { map.removeNamedItem(null); fail(); } catch(DOMException e) { /* ok */ } try { map.removeNamedItem(""); fail(); } catch(DOMException e) { /* ok */ } try { map.removeNamedItem("test"); fail(); } catch(DOMException e) { /* ok */ } map.getAttributes().add(attr); assertEquals(attr, map.removeNamedItem("test")); try { map.removeNamedItem("test"); fail(); } catch(DOMException e) { /* ok */ } map.getAttributes().clear(); } @Test public void testSetNamedItem() { SVGAttr attr1 = new SVGAttr("test1", "v1", doc.createElement("elt1")); SVGAttr attr2 = new SVGAttr("test2", "v2", doc.createElement("elt2")); SVGAttr attr3 = new SVGAttr("test1", "v1b", doc.createElement("elt1b")); map.getAttributes().clear(); assertNull(map.setNamedItem(null)); assertNull(map.setNamedItem(attr1)); assertEquals(attr1, map.getNamedItem("test1")); assertNull(map.setNamedItem(attr2)); assertEquals(attr1, map.getNamedItem("test1")); assertEquals(attr2, map.getNamedItem("test2")); assertEquals(attr1, map.setNamedItem(attr3)); assertEquals(attr3, map.getNamedItem("test1")); assertEquals(attr2, map.getNamedItem("test2")); map.getAttributes().clear(); } @Test public void testClone() { SVGAttr attr1 = new SVGAttr("test1", "v1", doc.createElement("elt1")); SVGAttr attr2 = new SVGAttr("test2", "v2", doc.createElement("elt2")); SVGNamedNodeMap map2; map.getAttributes().clear(); assertNull(map.setNamedItem(attr1)); assertNull(map.setNamedItem(attr2)); map2 = (SVGNamedNodeMap)map.clone(); assertEquals(map.getLength(), map2.getLength()); assertTrue(map.getNamedItem("test1").isEqualNode(map2.getNamedItem("test1"))); assertTrue(map.getNamedItem("test2").isEqualNode(map2.getNamedItem("test2"))); map.getAttributes().clear(); } @Test public void testGetAttributes() { assertNotNull(map.getAttributes()); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGText.java0000644000000000000000000000566011347255510017425 0ustar package junit.test.svg; import junit.framework.TestCase; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.SVGText; import org.junit.Before; import org.junit.Test; import org.w3c.dom.Node; /** * This class contains tests for the SVGText class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 03/30/08
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestSVGText extends TestCase { protected SVGDocument doc; @Override @Before public void setUp() { doc = new SVGDocument(); } @Test public void testConstructors() { SVGText txt; try { txt = createSVGText(null, null); fail(); } catch(IllegalArgumentException e) { /* ok */ } try { txt = createSVGText(null, doc); fail(); } catch(IllegalArgumentException e) { /* ok */ } txt = createSVGText("a", null); assertEquals("a", txt.getData()); assertNull(txt.getOwnerDocument()); txt = createSVGText("test", doc); assertEquals("test", txt.getData()); assertEquals(txt.getOwnerDocument(), doc); } @Test public void testGetNodeValue() { SVGText txt = createSVGText("test", doc); assertEquals("test", txt.getNodeValue()); txt = createSVGText("", doc); assertEquals("", txt.getNodeValue()); } @Test public void testAppendData() { SVGText txt = createSVGText("test", doc); txt.appendData(null); assertEquals("test", txt.getData()); txt.appendData("coucou"); assertEquals("testcoucou", txt.getData()); txt.appendData(""); assertEquals("testcoucou", txt.getData()); } @Test public void testGetData() { SVGText txt = createSVGText("test", doc); assertEquals("test", txt.getData()); txt = createSVGText("", doc); assertEquals("", txt.getData()); } @Test public void testGetLength() { SVGText txt = createSVGText("test", doc); assertEquals("text".length(), txt.getLength()); txt = createSVGText("", doc); assertEquals("".length(), txt.getLength()); } @Test public void testGetNodeType() { SVGText txt = createSVGText("test", doc); assertEquals(Node.TEXT_NODE, txt.getNodeType()); } @Test public void testSetData() { SVGText txt = createSVGText("test", doc); txt.setData(""); assertEquals(txt.getData(), ""); txt.setData("coucou"); assertEquals(txt.getData(), "coucou"); } protected SVGText createSVGText(String txt, SVGDocument document) throws IllegalArgumentException { return new SVGText(txt, document); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGPathSegLinetoVertical.java0000644000000000000000000000423011347255510022671 0ustar package junit.test.svg; import java.text.ParseException; import junit.framework.TestCase; import latexDraw.parsers.svg.elements.path.SVGPathSeg; import latexDraw.parsers.svg.elements.path.SVGPathSegLinetoVertical; import latexDraw.parsers.svg.elements.path.SVGPathSegMoveto; import latexDraw.parsers.svg.elements.path.SVGPathSeg.PathSeg; import latexDraw.parsers.svg.parsers.SVGPathHandler; import latexDraw.parsers.svg.parsers.SVGPathParser; import org.junit.Test; /** * This class contains tests for the SVGPathSegLinetoVertical class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/23/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestSVGPathSegLinetoVertical extends TestCase implements SVGPathHandler { protected final SVGPathSegLinetoVertical seg = new SVGPathSegLinetoVertical(-1, false); protected int cpt = 0; @Test public void testGetters() { assertEquals(seg.getY(), -1.); assertFalse(seg.isRelative()); assertEquals(seg.getType(), PathSeg.LINETO_VERTICAL_ABS); } @Test public void testToString() { SVGPathSegMoveto m = new SVGPathSegMoveto(0, 0, false); SVGPathParser parser = new SVGPathParser(m.toString() + " " + seg.toString(), this); try { parser.parse(); } catch(ParseException e) { fail(); } } public void onPathSeg(SVGPathSeg pathSeg) { if((pathSeg instanceof SVGPathSegMoveto) && cpt==0) { cpt++; return ; } assertTrue(pathSeg instanceof SVGPathSegLinetoVertical); SVGPathSegLinetoVertical seg2 = (SVGPathSegLinetoVertical)pathSeg; assertEquals(seg.getY(), seg2.getY()); assertEquals(seg.isRelative(), seg2.isRelative()); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGPolygonElement.java0000644000000000000000000001055711347255510021443 0ustar package junit.test.svg; import java.awt.geom.Point2D; import java.text.ParseException; import java.util.Vector; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGElements; import latexDraw.parsers.svg.elements.SVGPolygonElement; import org.junit.Test; /** * This class contains tests for the SVGPolygonElement class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/10/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestSVGPolygonElement extends AbstractTestSVGElement { @Test public void testEnableRendering() { try { node.setAttribute(SVGAttributes.SVG_POINTS, "10,10 20,20"); SVGPolygonElement pl = new SVGPolygonElement(node, null); assertTrue(pl.enableRendering()); } catch(MalformedSVGDocument e) { fail(); } catch(ParseException e) { fail(); } } @Test public void testSetPoints() { try { String path = "10,10 20,20"; node.setAttribute(SVGAttributes.SVG_POINTS, "10,10 20,20"); SVGPolygonElement pl = new SVGPolygonElement(node, null); assertEquals(pl.getPoints(), path); pl.setPoints("10,10 20,20"); assertEquals(2, pl.getPoints2D().size()); assertEquals(new Point2D.Double(10, 10), pl.getPoints2D().firstElement()); assertEquals(new Point2D.Double(20, 20), pl.getPoints2D().lastElement()); try { pl.setPoints("10,,20fdsf"); fail(); } catch(ParseException e) { /* */ } } catch(MalformedSVGDocument e) { fail(); } catch(ParseException e) { fail(); } } @Test public void testGetPoints() { try { String path = "10,10 20,20"; node.setAttribute(SVGAttributes.SVG_POINTS, "10,10 20,20"); SVGPolygonElement pl = new SVGPolygonElement(node, null); assertEquals(pl.getPoints(), path); } catch(MalformedSVGDocument e) { fail(); } catch(ParseException e) { fail(); } } @Test public void testGetPoints2D() { try { String path = " 10\t ,\n 10 \t 20 \t\n\t\r, \n20 \r30,30 \n"; node.setAttribute(SVGAttributes.SVG_POINTS, path); SVGPolygonElement pl = new SVGPolygonElement(node, null); Vector pts; pts = pl.getPoints2D(); assertNotNull(pts); assertEquals(3, pts.size()); assertEquals(new Point2D.Double(10, 10), pts.firstElement()); assertEquals(new Point2D.Double(20, 20), pts.elementAt(1)); assertEquals(new Point2D.Double(30, 30), pts.lastElement()); } catch(MalformedSVGDocument e) { fail(); } catch(ParseException e) { fail(); } } @Test public void testContructor() { try { new SVGPolygonElement(null, null); fail(); } catch(Exception e){/**/} try { new SVGPolygonElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} catch(ParseException e) {/**/} try { node.setAttribute(SVGAttributes.SVG_POINTS, ""); new SVGPolygonElement(node, null); } catch(MalformedSVGDocument e){fail();} catch(ParseException e) {fail();} try { node.setAttribute(SVGAttributes.SVG_POINTS, "dsqdgfd"); new SVGPolygonElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} catch(ParseException e) {/**/} try { node.setAttribute(SVGAttributes.SVG_POINTS, "10,10"); new SVGPolygonElement(node, null); } catch(MalformedSVGDocument e){fail();} catch(ParseException e) {fail();} try { node.setAttribute(SVGAttributes.SVG_POINTS, ","); new SVGPolygonElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} catch(ParseException e) {/**/} try { node.setAttribute(SVGAttributes.SVG_POINTS, "10,10 20,20"); new SVGPolygonElement(node, null); } catch(MalformedSVGDocument e) { fail(); } catch(ParseException e) { fail(); } } @Override public String getNameNode() { return SVGElements.SVG_POLYGON; } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGRectElement.java0000644000000000000000000001252711347255510020710 0ustar package junit.test.svg; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGElements; import latexDraw.parsers.svg.elements.SVGRectElement; import org.junit.Test; /** * This class contains tests for the SVGRectElement class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/10/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestSVGRectElement extends AbstractTestSVGElement { @Test public void testContructor() { try { new SVGRectElement(null, null); fail(); } catch(Exception e){/**/} try { new SVGRectElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_WIDTH, "dsd"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "dsd"); new SVGRectElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_WIDTH, "1"); new SVGRectElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_WIDTH, "-1"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "10"); new SVGRectElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "-1"); new SVGRectElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); new SVGRectElement(node, null); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testEnableRendering() { try { node.setAttribute(SVGAttributes.SVG_WIDTH, "0"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "0"); SVGRectElement e = new SVGRectElement(node, null); assertFalse(e.enableRendering()); node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "0"); e = new SVGRectElement(node, null); assertFalse(e.enableRendering()); node.setAttribute(SVGAttributes.SVG_WIDTH, "0"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "10"); e = new SVGRectElement(node, null); assertFalse(e.enableRendering()); node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "10"); e = new SVGRectElement(node, null); assertTrue(e.enableRendering()); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetHeight() { try { node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); SVGRectElement r = new SVGRectElement(node, null); assertEquals(r.getHeight(), 20.); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetWidth() { try { node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); SVGRectElement r = new SVGRectElement(node, null); assertEquals(r.getWidth(), 10.); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetRy() { try { node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); SVGRectElement r = new SVGRectElement(node, null); assertEquals(r.getRy(), 0.); node.setAttribute(SVGAttributes.SVG_RY, "1"); r = new SVGRectElement(node, null); assertEquals(1., r.getRy()); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetRx() { try { node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); SVGRectElement r = new SVGRectElement(node, null); assertEquals(r.getRx(), 0.); node.setAttribute(SVGAttributes.SVG_RX, "1"); r = new SVGRectElement(node, null); assertEquals(1., r.getRx()); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetY() { try { node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); SVGRectElement r = new SVGRectElement(node, null); assertEquals(r.getY(), 0.); node.setAttribute(SVGAttributes.SVG_Y, "1"); r = new SVGRectElement(node, null); assertEquals(1., r.getY()); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetX() { try { node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); SVGRectElement r = new SVGRectElement(node, null); assertEquals(r.getX(), 0.); node.setAttribute(SVGAttributes.SVG_X, "1"); r = new SVGRectElement(node, null); assertEquals(1., r.getX()); } catch(MalformedSVGDocument e) { fail(); } } @Override public String getNameNode() { return SVGElements.SVG_RECT; } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGAttr.java0000644000000000000000000001403611347255510017410 0ustar package junit.test.svg; import junit.framework.TestCase; import latexDraw.parsers.svg.SVGAttr; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.elements.SVGElement; import org.junit.Before; import org.junit.Test; import org.w3c.dom.DOMException; import org.w3c.dom.Node; /** * This class contains tests for the SVGAttr class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 03/29/08
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestSVGAttr extends TestCase { protected SVGElement node; @Override @Before public void setUp() { SVGDocument doc = new SVGDocument(); node = (SVGElement)doc.createElement("tag1"); } @Test public void testConstructor() { try { new SVGAttr(null, null, null); fail(); } catch(IllegalArgumentException e) { /* ok */ } try { new SVGAttr("", "", null); fail(); } catch(IllegalArgumentException e) { /* ok */ } try { new SVGAttr(null, "", node); fail(); } catch(IllegalArgumentException e) { /* ok */ } try { new SVGAttr("", null, node); fail(); } catch(IllegalArgumentException e) { /* ok */ } new SVGAttr("", "", node); } @Test public void testGetName() { SVGAttr attr = new SVGAttr("attrName", "", node); assertEquals("attrName", attr.getName()); } @Test public void testGetElementOwner() { SVGAttr attr = new SVGAttr("", "", node); assertEquals(node, attr.getOwnerElement()); } @Test public void testGetValue() { SVGAttr attr = new SVGAttr("", "attrValue", node); assertEquals("attrValue", attr.getValue()); } @Test public void testIsId() { SVGAttr attr = new SVGAttr("id", "", node); assertTrue(attr.isId()); attr = new SVGAttr("", "", node); assertFalse(attr.isId()); } @Test public void testSetValue() { SVGAttr attr = new SVGAttr("", "", node); try { attr.setValue(null); fail(); } catch(DOMException e) { /* Ok */ } attr.setValue("val"); assertEquals("val", attr.getValue()); } @Test public void testCloneNode() { SVGAttr attr = new SVGAttr("n", "v", node); SVGAttr attr2 = (SVGAttr)attr.cloneNode(false); assertNotNull(attr2); assertEquals(attr.getName(), attr2.getName()); assertEquals(attr.getValue(), attr2.getValue()); assertEquals(attr.getOwnerElement(), attr2.getOwnerElement()); } @Test public void testGetNodeName() { SVGAttr attr = new SVGAttr("attrNodeName", "", node); assertEquals("attrNodeName", attr.getNodeName()); } @Test public void testGetNodeType() { SVGAttr attr = new SVGAttr("", "", node); assertEquals(Node.ATTRIBUTE_NODE, attr.getNodeType()); } @Test public void testGetNodeValue() { SVGAttr attr = new SVGAttr("", "attrValue", node); assertEquals("attrValue", attr.getNodeValue()); } @Test public void testGetParentNode() { SVGAttr attr = new SVGAttr("", "", node); assertEquals(node, attr.getParentNode()); } @Test public void testHasAttribute() { SVGAttr attr = new SVGAttr("", "", node); assertFalse(attr.hasAttributes()); } @Test public void testChildNodes() { SVGAttr attr = new SVGAttr("", "", node); assertFalse(attr.hasChildNodes()); } @Test public void testIsEqualNode() { SVGAttr attr = new SVGAttr("n", "v", node); SVGAttr attr2 = (SVGAttr)attr.cloneNode(false); assertTrue(attr.isEqualNode(attr2)); attr2 = new SVGAttr("n", "", node); assertFalse(attr.isEqualNode(attr2)); attr2 = new SVGAttr("", "v", node); assertFalse(attr.isEqualNode(attr2)); assertFalse(attr.isEqualNode(null)); } @Test public void testIsSameNode() { SVGAttr attr = new SVGAttr("n", "v", node); SVGAttr attr2 = (SVGAttr)attr.cloneNode(false); assertTrue(attr.isSameNode(attr)); assertFalse(attr.isSameNode(null)); assertFalse(attr.isSameNode(attr2)); } @Test public void testSetNodeValue() { SVGAttr attr = new SVGAttr("", "", node); try { attr.setNodeValue(null); fail(); } catch(DOMException e) { /* Ok */ } attr.setNodeValue("val"); assertEquals("val", attr.getValue()); assertEquals("val", attr.getNodeValue()); } @Test public void testGetPrefix() { SVGAttr attr = new SVGAttr("", "", node); assertNull(attr.getPrefix()); attr = new SVGAttr("pref:", "", node); assertEquals("pref", attr.getPrefix()); attr = new SVGAttr(":", "", node); assertEquals("", attr.getPrefix()); } @Test public void testGetNamespaceURI() { SVGAttr attr = new SVGAttr("pref:n", "", node); SVGElement elt = (SVGElement)node.getOwnerDocument().createElement("tag2"); assertNull(attr.getNamespaceURI()); elt.setAttribute("xmlns:pref", "namespace"); elt.appendChild(node); assertEquals(attr.getNamespaceURI(), "namespace"); } @Test public void testLookupNamespaceURI() { SVGAttr attr = new SVGAttr("pref:n", "", node); SVGElement elt = (SVGElement)node.getOwnerDocument().createElement("tag2"); assertNull(attr.getNamespaceURI()); elt.setAttribute("xmlns:pref", "namespace"); elt.appendChild(node); assertEquals(attr.getNamespaceURI(), "namespace"); } @Test public void testGetLocalName() { SVGAttr attr = new SVGAttr("attrNodeName", "", node); assertEquals("attrNodeName", attr.getLocalName()); } @Test public void testUselessMethods() { SVGAttr attr = new SVGAttr("", "", node); assertNull(attr.removeChild(null)); assertNull(attr.insertBefore(null, null)); assertNull(attr.getAttributes()); assertNull(attr.getFirstChild()); assertNull(attr.getLastChild()); assertNull(attr.appendChild(null)); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGCDATASection.java0000644000000000000000000000235711347255510020642 0ustar package junit.test.svg; import latexDraw.parsers.svg.SVGCDATASection; import latexDraw.parsers.svg.SVGDocument; import org.junit.Test; import org.w3c.dom.Node; /** * This class contains tests for the SVGCDATASection class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 03/30/08
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestSVGCDATASection extends TestSVGText { @Override @Test public void testGetNodeType() { SVGCDATASection cdata = createSVGText("test", doc); assertEquals(Node.CDATA_SECTION_NODE, cdata.getNodeType()); } @Override protected SVGCDATASection createSVGText(String txt, SVGDocument document) throws IllegalArgumentException { return new SVGCDATASection(txt, document); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGTransformList.java0000644000000000000000000001052311347255510021302 0ustar package junit.test.svg; import java.awt.geom.Point2D; import junit.framework.TestCase; import latexDraw.parsers.svg.SVGMatrix; import latexDraw.parsers.svg.SVGTransformList; import org.junit.Test; /** * Tests the class SVGTransformList.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/18/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1
    */ @SuppressWarnings("nls") public class TestSVGTransformList extends TestCase { @Test public void testContructors() { SVGTransformList t = new SVGTransformList(); assertTrue(t.isEmpty()); t = new SVGTransformList(null); assertTrue(t.isEmpty()); t = new SVGTransformList(""); assertTrue(t.isEmpty()); t = new SVGTransformList("translate(2,2)"); assertFalse(t.isEmpty()); } @Test public void testAddTransformations() { SVGTransformList t = new SVGTransformList(); t.addTransformations(null); assertTrue(t.isEmpty()); t.addTransformations(""); assertTrue(t.isEmpty()); t.addTransformations("dsqdsq"); assertTrue(t.isEmpty()); t.addTransformations("translate"); assertTrue(t.isEmpty()); t.addTransformations("translate(,)"); assertTrue(t.isEmpty()); t.addTransformations("translate( )"); assertTrue(t.isEmpty()); t.addTransformations("scale( 3"); assertTrue(t.isEmpty()); t.addTransformations("rotate(a)"); assertTrue(t.isEmpty()); t.addTransformations("rotate(1)"); assertFalse(t.isEmpty()); t.clear(); t.addTransformations("rotate(1 , 2 4)"); assertFalse(t.isEmpty()); t.clear(); t.addTransformations("skewY( 1)"); assertFalse(t.isEmpty()); t.clear(); t.addTransformations("skewX(1)"); assertFalse(t.isEmpty()); t.clear(); t.addTransformations("scale(1 1)"); assertFalse(t.isEmpty()); t.clear(); t.addTransformations("translate(1 ,1)"); assertFalse(t.isEmpty()); t.clear(); t.addTransformations("translate(1 1) ,"); assertFalse(t.isEmpty()); t.clear(); t.addTransformations("matrix(1 2 3)"); assertTrue(t.isEmpty()); t.addTransformations("matrix(1 2 3 ,4 ,5 ,6)"); assertFalse(t.isEmpty()); t.clear(); t.addTransformations("matrix(1 2 3 ,4 ,5 ,6) translate(2 2)"); assertEquals(2, t.size()); t.clear(); t.addTransformations("rotate ( 2, 3 5), \n skewX( 2 \n)"); assertEquals(2, t.size()); t.clear(); t.addTransformations("rotate ( 2, 3 5)scale( 2)"); assertEquals(2, t.size()); t.clear(); t.addTransformations("rotate ( 2, 3 5), \n skewX( 2 \n)"); t.addTransformations("rotate ( 2, 3 5)scale( 2)"); assertEquals(4, t.size()); } @Test public void testTransformPoint() { SVGTransformList t = new SVGTransformList(); Point2D pt1 = new Point2D.Double(1,1); Point2D pt2 = new Point2D.Double(3,4); Point2D pt3; t.addTransformations("translate( 2 3)"); assertEquals(t.transformPoint(pt1), pt2); t.addTransformations("translate( -2 -3)"); t.addTransformations("rotate(90)"); pt2.setLocation(0, 1); pt1.setLocation(1, 0); pt3 = t.transformPoint(pt1); assertEquals(Math.rint(pt3.getX()), pt2.getX()); assertEquals(Math.rint(pt3.getY()), pt2.getY()); } @Test public void testGetGlobalTransformation() { SVGTransformList t = new SVGTransformList(); SVGMatrix m; m = t.getGlobalTransformationMatrix(); assertNull(m); t.addTransformations("scale( 2 3)"); m = t.getGlobalTransformationMatrix(); assertEquals(m.getA(), 2.); assertEquals(m.getB(), 0.); assertEquals(m.getC(), 0.); assertEquals(m.getD(), 3.); assertEquals(m.getE(), 0.); assertEquals(m.getF(), 0.); t.addTransformations("skewX( 0.5 \n)"); m = t.getGlobalTransformationMatrix(); assertEquals(m.getA(), 2.); assertEquals(m.getB(), 0.); assertEquals(m.getC(), 2.*Math.tan(Math.toRadians(0.5))); assertEquals(m.getD(), 3.); assertEquals(m.getE(), 0.); assertEquals(m.getF(), 0.); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGComment.java0000644000000000000000000000231311347255510020073 0ustar package junit.test.svg; import latexDraw.parsers.svg.SVGComment; import latexDraw.parsers.svg.SVGDocument; import org.junit.Test; import org.w3c.dom.Node; /** * This class contains tests for the SVGComment class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 03/31/08
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestSVGComment extends TestSVGText { @Override @Test public void testGetNodeType() { SVGComment cdata = createSVGText("test", doc); assertEquals(Node.COMMENT_NODE, cdata.getNodeType()); } @Override protected SVGComment createSVGText(String txt, SVGDocument document) throws IllegalArgumentException { return new SVGComment(txt, document); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGLength.java0000644000000000000000000000261611347255510017720 0ustar package junit.test.svg; import junit.framework.TestCase; import latexDraw.parsers.svg.SVGLength; import latexDraw.parsers.svg.SVGLength.LengthType; import org.junit.Test; /** * Tests the class SVGLength.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/24/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1
    */ @SuppressWarnings("nls") public class TestSVGLength extends TestCase { @Test public void testConsctrutor() { try { new SVGLength(1, null, "1"); fail(); } catch(IllegalArgumentException e){ /* */ } try { new SVGLength(1, LengthType.CM, null); fail(); } catch(IllegalArgumentException e){ /* */ } } @Test public void testGetters() { SVGLength l = new SVGLength(1, LengthType.MM, "1"); assertEquals(l.getValue(), 1.); assertEquals(l.getLengthType(), LengthType.MM); assertEquals(l.getValueAsString(), "1"); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGDefsElement.java0000644000000000000000000000406011347255510020665 0ustar package junit.test.svg; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGElements; import latexDraw.parsers.svg.elements.SVGDefsElement; import latexDraw.parsers.svg.elements.SVGMarkerElement; import org.junit.Test; /** * This class contains tests for the SVGDefsElement class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 02/02/08
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestSVGDefsElement extends AbstractTestSVGElement { @Test public void testEnableRendering() { try { SVGDefsElement defs = new SVGDefsElement(node, null); assertFalse(defs.enableRendering()); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetDef() { try { SVGDefsElement defs = new SVGDefsElement(node, null); SVGMarkerElement mark = new SVGMarkerElement(node.getOwnerDocument()); mark.setAttribute(SVGAttributes.SVG_ID, SVGAttributes.SVG_ID); defs.appendChild(mark); assertNull(defs.getDef(null)); assertNull(defs.getDef("")); //$NON-NLS-1$ assertNull(defs.getDef("dsqd")); //$NON-NLS-1$ assertEquals(mark, defs.getDef("id")); //$NON-NLS-1$ } catch(MalformedSVGDocument e) { fail(); } } @Test public void testContructor() { try { new SVGDefsElement(null, null); fail(); } catch(Exception e){/**/} try { new SVGDefsElement(node, null); } catch(MalformedSVGDocument e) { fail(); } } @Override public String getNameNode() { return SVGElements.SVG_DEFS; } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGPathSegCurvetoCubic.java0000644000000000000000000000503611347255510022347 0ustar package junit.test.svg; import java.text.ParseException; import junit.framework.TestCase; import latexDraw.parsers.svg.elements.path.SVGPathSeg; import latexDraw.parsers.svg.elements.path.SVGPathSegCurvetoCubic; import latexDraw.parsers.svg.elements.path.SVGPathSegMoveto; import latexDraw.parsers.svg.elements.path.SVGPathSeg.PathSeg; import latexDraw.parsers.svg.parsers.SVGPathHandler; import latexDraw.parsers.svg.parsers.SVGPathParser; import org.junit.Test; /** * This class contains tests for the SVGPathSegCurvetoCubic class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/22/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestSVGPathSegCurvetoCubic extends TestCase implements SVGPathHandler { protected final SVGPathSegCurvetoCubic seg = new SVGPathSegCurvetoCubic(-1, -2, 3e1, 4e-1, -5e1, 6.5, true); protected int cpt = 0; @Test public void testGetters() { assertEquals(seg.getX(), -1.); assertEquals(seg.getX1(), 3e1); assertEquals(seg.getX2(), -5e1); assertEquals(seg.getY(), -2.); assertEquals(seg.getY1(), 4e-1); assertEquals(seg.getY2(), 6.5); assertTrue(seg.isRelative()); assertEquals(seg.getType(), PathSeg.CURVETO_CUBIC_REL); } @Test public void testToString() { SVGPathSegMoveto m = new SVGPathSegMoveto(0, 0, false); SVGPathParser parser = new SVGPathParser(m.toString() + " " + seg.toString(), this); try { parser.parse(); } catch(ParseException e) { fail(); } } public void onPathSeg(SVGPathSeg pathSeg) { if((pathSeg instanceof SVGPathSegMoveto) && cpt==0) { cpt++; return ; } assertTrue(pathSeg instanceof SVGPathSegCurvetoCubic); SVGPathSegCurvetoCubic seg2 = (SVGPathSegCurvetoCubic)pathSeg; assertEquals(seg.getX(), seg2.getX()); assertEquals(seg.getX1(), seg2.getX1()); assertEquals(seg.getX2(), seg2.getX2()); assertEquals(seg.getY(), seg2.getY()); assertEquals(seg.getY1(), seg2.getY1()); assertEquals(seg.getY2(), seg2.getY2()); assertEquals(seg.isRelative(), seg2.isRelative()); } } latexdraw-2.0.8+1.orig/junit/test/svg/test.svg0000644000000000000000000000416411347255510016114 0ustar false true 50 1.0 cm false 20 0 true true true 2.0.0 1008 836 0 24 0.8 false true true 130 latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGPathSegCurvetoQuadraticSmooth.java0000644000000000000000000000447511347255510024437 0ustar package junit.test.svg; import java.text.ParseException; import junit.framework.TestCase; import latexDraw.parsers.svg.elements.path.SVGPathSeg; import latexDraw.parsers.svg.elements.path.SVGPathSegCurvetoQuadraticSmooth; import latexDraw.parsers.svg.elements.path.SVGPathSegMoveto; import latexDraw.parsers.svg.elements.path.SVGPathSeg.PathSeg; import latexDraw.parsers.svg.parsers.SVGPathHandler; import latexDraw.parsers.svg.parsers.SVGPathParser; import org.junit.Test; /** * This class contains tests for the SVGPathSegCurvetoQuadraticSmooth class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/23/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestSVGPathSegCurvetoQuadraticSmooth extends TestCase implements SVGPathHandler { protected final SVGPathSegCurvetoQuadraticSmooth seg = new SVGPathSegCurvetoQuadraticSmooth(-5.23e-10, 6.5, false); protected int cpt = 0; @Test public void testGetters() { assertEquals(seg.getX(), -5.23e-10); assertEquals(seg.getY(), 6.5); assertFalse(seg.isRelative()); assertEquals(seg.getType(), PathSeg.CURVETO_QUADRATIC_SMOOTH_ABS); } @Test public void testToString() { SVGPathSegMoveto m = new SVGPathSegMoveto(0, 0, false); SVGPathParser parser = new SVGPathParser(m.toString() + " " + seg.toString(), this); try { parser.parse(); } catch(ParseException e) { fail(); } } public void onPathSeg(SVGPathSeg pathSeg) { if((pathSeg instanceof SVGPathSegMoveto) && cpt==0) { cpt++; return ; } assertTrue(pathSeg instanceof SVGPathSegCurvetoQuadraticSmooth); SVGPathSegCurvetoQuadraticSmooth seg2 = (SVGPathSegCurvetoQuadraticSmooth)pathSeg; assertEquals(seg.getX(), seg2.getX()); assertEquals(seg.getY(), seg2.getY()); assertEquals(seg.isRelative(), seg2.isRelative()); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGPatternElement.java0000644000000000000000000001145711347255510021431 0ustar package junit.test.svg; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGElements; import latexDraw.parsers.svg.elements.SVGPatternElement; import org.junit.Test; /** * This class contains tests for the SVGPatternElement class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/12/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestSVGPatternElement extends AbstractTestSVGElement { @Test public void testContructor() { try { new SVGPatternElement(null, null); fail(); } catch(Exception e){/**/} try { new SVGPatternElement(node, null); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetHeight() { try { SVGPatternElement e = new SVGPatternElement(node, null); assertEquals(e.getHeight(), 0.); node.setAttribute(SVGAttributes.SVG_HEIGHT, "20"); e = new SVGPatternElement(node, null); assertEquals(e.getHeight(), 20.); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetWidth() { try { SVGPatternElement e = new SVGPatternElement(node, null); assertEquals(e.getWidth(), 0.); node.setAttribute(SVGAttributes.SVG_WIDTH, "30"); e = new SVGPatternElement(node, null); assertEquals(e.getWidth(), 30.); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetPatternUnits() { try { SVGPatternElement e = new SVGPatternElement(node, null); assertEquals(e.getPatternUnits(), SVGAttributes.SVG_UNITS_VALUE_OBJ); node.setAttribute(SVGAttributes.SVG_PATTERN_UNITS, SVGAttributes.SVG_UNITS_VALUE_USR); e = new SVGPatternElement(node, null); assertEquals(e.getPatternUnits(), SVGAttributes.SVG_UNITS_VALUE_USR); node.setAttribute(SVGAttributes.SVG_PATTERN_UNITS, SVGAttributes.SVG_UNITS_VALUE_OBJ); e = new SVGPatternElement(node, null); assertEquals(e.getPatternUnits(), SVGAttributes.SVG_UNITS_VALUE_OBJ); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetPatternContentUnits() { try { SVGPatternElement e = new SVGPatternElement(node, null); assertEquals(e.getPatternContentUnits(), SVGAttributes.SVG_UNITS_VALUE_USR); node.setAttribute(SVGAttributes.SVG_PATTERN_CONTENTS_UNITS, SVGAttributes.SVG_UNITS_VALUE_USR); e = new SVGPatternElement(node, null); assertEquals(e.getPatternContentUnits(), SVGAttributes.SVG_UNITS_VALUE_USR); node.setAttribute(SVGAttributes.SVG_PATTERN_CONTENTS_UNITS, SVGAttributes.SVG_UNITS_VALUE_OBJ); e = new SVGPatternElement(node, null); assertEquals(e.getPatternContentUnits(), SVGAttributes.SVG_UNITS_VALUE_OBJ); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testEnableRendering() { try { node.setAttribute(SVGAttributes.SVG_WIDTH, "0"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "0"); SVGPatternElement e = new SVGPatternElement(node, null); assertFalse(e.enableRendering()); node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "0"); e = new SVGPatternElement(node, null); assertFalse(e.enableRendering()); node.setAttribute(SVGAttributes.SVG_WIDTH, "0"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "10"); e = new SVGPatternElement(node, null); assertFalse(e.enableRendering()); node.setAttribute(SVGAttributes.SVG_WIDTH, "10"); node.setAttribute(SVGAttributes.SVG_HEIGHT, "10"); e = new SVGPatternElement(node, null); assertTrue(e.enableRendering()); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetY() { try { SVGPatternElement e = new SVGPatternElement(node, null); assertEquals(e.getY(), 0.); node.setAttribute(SVGAttributes.SVG_Y, "1"); e = new SVGPatternElement(node, null); assertEquals(1., e.getY()); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetX() { try { SVGPatternElement e = new SVGPatternElement(node, null); assertEquals(e.getX(), 0.); node.setAttribute(SVGAttributes.SVG_X, "2"); e = new SVGPatternElement(node, null); assertEquals(2., e.getX()); } catch(MalformedSVGDocument e) { fail(); } } @Override public String getNameNode() { return SVGElements.SVG_PATTERN; } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGStopElement.java0000644000000000000000000000513611347255510020736 0ustar package junit.test.svg; import java.awt.Color; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGElements; import latexDraw.parsers.svg.elements.SVGStopElement; import org.junit.Test; /** * This class contains tests for the SVGEllipseElement class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/12/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestSVGStopElement extends AbstractTestSVGElement { @Test public void testContructor() { try { new SVGStopElement(null, null); fail(); } catch(Exception e){/**/} try { new SVGStopElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_OFFSET, "dsd"); new SVGStopElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_OFFSET, "0.5"); new SVGStopElement(node, null); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetStopColor() { try { node.setAttribute(SVGAttributes.SVG_OFFSET, "0.5"); SVGStopElement e = new SVGStopElement(node, null); assertEquals(e.getStopColor(), Color.BLACK); node.setAttribute(SVGAttributes.SVG_OFFSET, "0.5"); node.setAttribute(SVGAttributes.SVG_STOP_COLOR, "blue"); e = new SVGStopElement(node, null); assertEquals(e.getStopColor(), Color.BLUE); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetOffset() { try { node.setAttribute(SVGAttributes.SVG_OFFSET, "0.5"); SVGStopElement e = new SVGStopElement(node, null); assertEquals(e.getOffset(), 0.5); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testEnableRendering() { try { node.setAttribute(SVGAttributes.SVG_OFFSET, "0.5"); SVGStopElement s = new SVGStopElement(node, null); assertTrue(s.enableRendering()); } catch(MalformedSVGDocument e) { fail(); } } @Override public String getNameNode() { return SVGElements.SVG_STOP; } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGNodeList.java0000644000000000000000000000353011347255510020214 0ustar package junit.test.svg; import junit.framework.TestCase; import latexDraw.parsers.svg.SVGDocument; import latexDraw.parsers.svg.SVGNodeList; import latexDraw.parsers.svg.elements.SVGElement; import org.junit.Before; import org.junit.Test; /** * This class contains tests for the SVGNodeList class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 03/29/08
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestSVGNodeList extends TestCase { protected SVGNodeList list; protected SVGDocument doc; @Override @Before public void setUp() { doc = new SVGDocument(); list = new SVGNodeList(); } @Test public void testSVGNodeList() { assertNotNull(list.getNodes()); } @Test public void testGetLength() { list.getNodes().clear(); assertEquals(0, list.getLength()); list.getNodes().add((SVGElement)doc.createElement("elt")); assertEquals(1, list.getLength()); list.getNodes().clear(); } @Test public void testItem() { SVGElement elt = (SVGElement)doc.createElement("elt"); list.getNodes().clear(); assertNull(list.item(0)); assertNull(list.item(-1)); assertNull(list.item(1)); list.getNodes().add(elt); assertNull(list.item(-1)); assertNull(list.item(1)); assertEquals(list.item(0), elt); } @Test public void testGetNodes() { assertNotNull(list.getNodes()); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGEllipseElement.java0000644000000000000000000001307311347255510021405 0ustar package junit.test.svg; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGElements; import latexDraw.parsers.svg.SVGLength; import latexDraw.parsers.svg.elements.SVGEllipseElement; import latexDraw.parsers.svg.parsers.UnitProcessor; import org.junit.Test; /** * This class contains tests for the SVGEllipseElement class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/12/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestSVGEllipseElement extends AbstractTestSVGElement { @Test public void testContructor() { try { new SVGEllipseElement(null, null); fail(); } catch(Exception e){/**/} try { new SVGEllipseElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_RX, "dsd"); node.setAttribute(SVGAttributes.SVG_RY, "dsd"); new SVGEllipseElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_RX, "1"); new SVGEllipseElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_RX, "-1"); node.setAttribute(SVGAttributes.SVG_RY, "10"); new SVGEllipseElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_RX, "10"); node.setAttribute(SVGAttributes.SVG_RY, "-1"); new SVGEllipseElement(node, null); fail(); } catch(MalformedSVGDocument e){/**/} try { node.setAttribute(SVGAttributes.SVG_RX, "10"); node.setAttribute(SVGAttributes.SVG_RY, "20"); new SVGEllipseElement(node, null); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetCy() { try { node.setAttribute(SVGAttributes.SVG_RX, "10"); node.setAttribute(SVGAttributes.SVG_RY, "20"); SVGEllipseElement e = new SVGEllipseElement(node, null); assertEquals(e.getCy(), 0.); node.setAttribute(SVGAttributes.SVG_CY, "40"); e = new SVGEllipseElement(node, null); assertEquals(e.getCy(), 40.); node.setAttribute(SVGAttributes.SVG_CY, "40px"); e = new SVGEllipseElement(node, null); assertEquals(e.getCy(), 40.); node.setAttribute(SVGAttributes.SVG_CY, "40 cm"); e = new SVGEllipseElement(node, null); assertEquals(e.getCy(), UnitProcessor.toUserUnit(40, SVGLength.LengthType.CM)); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetCx() { try { node.setAttribute(SVGAttributes.SVG_RX, "10"); node.setAttribute(SVGAttributes.SVG_RY, "20"); SVGEllipseElement e = new SVGEllipseElement(node, null); assertEquals(e.getCx(), 0.); node.setAttribute(SVGAttributes.SVG_CX, "30"); e = new SVGEllipseElement(node, null); assertEquals(e.getCx(), 30.); node.setAttribute(SVGAttributes.SVG_CX, "40px"); e = new SVGEllipseElement(node, null); assertEquals(e.getCx(), 40.); node.setAttribute(SVGAttributes.SVG_CX, "40 cm"); e = new SVGEllipseElement(node, null); assertEquals(e.getCx(), UnitProcessor.toUserUnit(40, SVGLength.LengthType.CM)); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testEnableRendering() { try { node.setAttribute(SVGAttributes.SVG_RX, "0"); node.setAttribute(SVGAttributes.SVG_RY, "0"); SVGEllipseElement e = new SVGEllipseElement(node, null); assertFalse(e.enableRendering()); node.setAttribute(SVGAttributes.SVG_RX, "10"); node.setAttribute(SVGAttributes.SVG_RY, "0"); e = new SVGEllipseElement(node, null); assertFalse(e.enableRendering()); node.setAttribute(SVGAttributes.SVG_RX, "0"); node.setAttribute(SVGAttributes.SVG_RY, "10"); e = new SVGEllipseElement(node, null); assertFalse(e.enableRendering()); node.setAttribute(SVGAttributes.SVG_RX, "10"); node.setAttribute(SVGAttributes.SVG_RY, "10"); e = new SVGEllipseElement(node, null); assertTrue(e.enableRendering()); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetRy() { try { node.setAttribute(SVGAttributes.SVG_RX, "10"); node.setAttribute(SVGAttributes.SVG_RY, "20"); SVGEllipseElement e = new SVGEllipseElement(node, null); assertEquals(e.getRy(), 20.); node.setAttribute(SVGAttributes.SVG_RY, "20 pt"); e = new SVGEllipseElement(node, null); assertEquals(e.getRy(), UnitProcessor.toUserUnit(20, SVGLength.LengthType.PT)); } catch(MalformedSVGDocument e) { fail(); } } @Test public void testGetRx() { try { node.setAttribute(SVGAttributes.SVG_RX, "10"); node.setAttribute(SVGAttributes.SVG_RY, "20"); SVGEllipseElement e = new SVGEllipseElement(node, null); assertEquals(e.getRx(), 10.); node.setAttribute(SVGAttributes.SVG_RX, "10mm"); e = new SVGEllipseElement(node, null); assertEquals(e.getRx(), UnitProcessor.toUserUnit(10, SVGLength.LengthType.MM)); } catch(MalformedSVGDocument e) { fail(); } } @Override public String getNameNode() { return SVGElements.SVG_ELLIPSE; } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGTransform.java0000644000000000000000000003342511347255510020454 0ustar package junit.test.svg; import junit.framework.TestCase; import latexDraw.parsers.svg.SVGMatrix; import latexDraw.parsers.svg.SVGTransform; import org.junit.Test; /** * Tests the class SVGTransform.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/17/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1
    */ @SuppressWarnings("nls") public class TestSVGTransform extends TestCase { @Test public void testConstructors() { SVGTransform t = new SVGTransform(); assertEquals(t.getType(), SVGTransform.SVG_TRANSFORM_UNKNOWN); assertNotNull(t.getMatrix()); try { new SVGTransform(null); fail(); } catch(IllegalArgumentException e){ /* */ } try { new SVGTransform(""); fail(); } catch(IllegalArgumentException e){ /* */ } } @Test public void testSetTransformation() { SVGTransform t = new SVGTransform(); SVGMatrix m; try { t.setTransformation(null); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation(""); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("iueozi"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t translate ( 2\n \n\t 4 ) \n"); assertEquals(t.getType(), SVGTransform.SVG_TRANSFORM_TRANSLATE); assertTrue(t.isTranslation()); assertEquals(t.getTX(), 2.); assertEquals(t.getTY(), 4.); t.setTransformation("\n \t translate ( 2\n \n\t , 4 ) \n"); assertEquals(t.getType(), SVGTransform.SVG_TRANSFORM_TRANSLATE); assertTrue(t.isTranslation()); assertEquals(t.getTX(), 2.); assertEquals(t.getTY(), 4.); t.setTransformation("\n \t translate ( 2\n \n\t ) \n"); assertEquals(t.getType(), SVGTransform.SVG_TRANSFORM_TRANSLATE); assertTrue(t.isTranslation()); assertEquals(t.getTX(), 2.); assertEquals(t.getTY(), 2.); } catch(IllegalArgumentException e){ fail(); } try { t.setTransformation("\n \t translate"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t translate("); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t translate(ds"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t translate(2 "); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t translate(2 ,"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t translate(2 , ds"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t translate(2 , 2"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t scale ( 2\n \n\t 4 ) \n"); assertEquals(t.getType(), SVGTransform.SVG_TRANSFORM_SCALE); assertTrue(t.isScale()); assertEquals(t.getXScaleFactor(), 2.); assertEquals(t.getYScaleFactor(), 4.); t.setTransformation("\n \t scale ( 2\n \n\t , 4 ) \n"); assertEquals(t.getType(), SVGTransform.SVG_TRANSFORM_SCALE); assertTrue(t.isScale()); assertEquals(t.getXScaleFactor(), 2.); assertEquals(t.getYScaleFactor(), 4.); t.setTransformation("\n \t scale ( 2\n \n\t ) \n"); assertEquals(t.getType(), SVGTransform.SVG_TRANSFORM_SCALE); assertTrue(t.isScale()); assertEquals(t.getXScaleFactor(), 2.); assertEquals(t.getYScaleFactor(), 2.); } catch(IllegalArgumentException e){ fail(); } try { t.setTransformation("\n \t scale"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t scale("); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t scale(ds"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t scale(2 "); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t scale(2 ,"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t scale(2 , ds"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t scale(2 , 2"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t matrix ( 2\n \n\t 4 \t 5 \n 6 7 8 ) \n"); assertEquals(t.getType(), SVGTransform.SVG_TRANSFORM_MATRIX); m = t.getMatrix(); assertEquals(m.getA(), 2.); assertEquals(m.getB(), 4.); assertEquals(m.getC(), 5.); assertEquals(m.getD(), 6.); assertEquals(m.getE(), 7.); assertEquals(m.getF(), 8.); t.setTransformation("\n \t matrix ( 2 ,\n \n\t 4 \t 5 ,\n 6 7 , 8 ) \n"); assertEquals(t.getType(), SVGTransform.SVG_TRANSFORM_MATRIX); m = t.getMatrix(); assertEquals(m.getA(), 2.); assertEquals(m.getB(), 4.); assertEquals(m.getC(), 5.); assertEquals(m.getD(), 6.); assertEquals(m.getE(), 7.); assertEquals(m.getF(), 8.); } catch(IllegalArgumentException e){ fail(); } try { t.setTransformation("\n \t matrix"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t matrix("); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t matrix(ds"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t matrix(2 "); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t matrix(2 ,"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t matrix(2 , ds"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t matrix(2 , 2"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t matrix(2 , 2 3"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t matrix(2 , 2 3 5"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t matrix(2 , 2 3 , 5 7"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t matrix(2 , 2 3 5 7 9"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t skewX ( 2\n \n\t ) \n"); assertEquals(t.getType(), SVGTransform.SVG_TRANSFORM_SKEWX); assertTrue(t.isXSkew()); assertEquals(t.getXSkewAngle(), 2.); } catch(IllegalArgumentException e){ fail(); } try { t.setTransformation("\n \t skewX"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t skewX("); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t skewX(ds"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t skewX(2 "); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t skewY ( 3\n \n\t ) \n"); assertEquals(t.getType(), SVGTransform.SVG_TRANSFORM_SKEWY); assertTrue(t.isYSkew()); assertEquals(t.getYSkewAngle(), 3.); } catch(IllegalArgumentException e){ fail(); } try { t.setTransformation("\n \t skewY"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t skewY("); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t skewY(ds"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t skewY(2 "); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t rotate ( 3\n \n\t ) \n"); assertEquals(t.getType(), SVGTransform.SVG_TRANSFORM_ROTATE); assertTrue(t.isRotation()); assertEquals(t.getRotationAngle(), 3.); t.setTransformation("\n \t rotate ( 1\n \n\t , 4 \n 6 \n \t ) \n"); assertEquals(t.getType(), SVGTransform.SVG_TRANSFORM_ROTATE); assertTrue(t.isRotation()); assertEquals(t.getRotationAngle(), 1.); m = t.getMatrix(); } catch(IllegalArgumentException e){ fail(); } try { t.setTransformation("\n \t rotate"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t rotate("); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t rotate(ds"); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t rotate(2 "); fail(); } catch(IllegalArgumentException e){ /**/ } try { t.setTransformation("\n \t rotate(2 4 "); fail(); } catch(IllegalArgumentException e){ /**/ } } @Test public void testSetTranslate() { SVGTransform t = new SVGTransform(); SVGMatrix m = t.getMatrix(); t.setTranslate(1, 2); assertEquals(m.getE(), 1.); assertEquals(m.getF(), 2.); assertTrue(t.isTranslation()); assertFalse(t.isYSkew()); assertFalse(t.isXSkew()); assertFalse(t.isRotation()); assertFalse(t.isScale()); assertEquals(1., t.getTX()); assertEquals(2., t.getTY()); assertEquals(Double.NaN, t.getXScaleFactor()); assertEquals(Double.NaN, t.getYScaleFactor()); assertEquals(Double.NaN, t.getXSkewAngle()); assertEquals(Double.NaN, t.getYSkewAngle()); assertEquals(Double.NaN, t.getRotationAngle()); assertEquals(SVGTransform.SVG_TRANSFORM_TRANSLATE, t.getType()); } @Test public void testSetScale() { SVGTransform t = new SVGTransform(); SVGMatrix m = t.getMatrix(); t.setScale(3, 4); assertEquals(m.getA(), 3.); assertEquals(m.getD(), 4.); assertTrue(t.isScale()); assertFalse(t.isYSkew()); assertFalse(t.isXSkew()); assertFalse(t.isRotation()); assertFalse(t.isTranslation()); assertEquals(Double.NaN, t.getTX()); assertEquals(Double.NaN, t.getTY()); assertEquals(3., t.getXScaleFactor()); assertEquals(4., t.getYScaleFactor()); assertEquals(Double.NaN, t.getXSkewAngle()); assertEquals(Double.NaN, t.getYSkewAngle()); assertEquals(Double.NaN, t.getRotationAngle()); assertEquals(SVGTransform.SVG_TRANSFORM_SCALE, t.getType()); } @Test public void testSetXSkew() { SVGTransform t = new SVGTransform(); SVGMatrix m = t.getMatrix(); t.setSkewX(30); assertEquals(m.getC(), Math.tan(Math.toRadians(30))); assertEquals(t.getXSkewAngle(), 30.); assertTrue(t.isXSkew()); assertFalse(t.isScale()); assertFalse(t.isYSkew()); assertFalse(t.isRotation()); assertFalse(t.isTranslation()); assertEquals(Double.NaN, t.getTX()); assertEquals(Double.NaN, t.getTY()); assertEquals(Double.NaN, t.getXScaleFactor()); assertEquals(Double.NaN, t.getYScaleFactor()); assertEquals(Double.NaN, t.getYSkewAngle()); assertEquals(Double.NaN, t.getRotationAngle()); assertEquals(SVGTransform.SVG_TRANSFORM_SKEWX, t.getType()); } @Test public void testSetYSkew() { SVGTransform t = new SVGTransform(); SVGMatrix m = t.getMatrix(); t.setSkewY(30); assertEquals(m.getB(), Math.tan(Math.toRadians(30))); assertEquals(t.getYSkewAngle(), 30.); assertTrue(t.isYSkew()); assertFalse(t.isScale()); assertFalse(t.isXSkew()); assertFalse(t.isRotation()); assertFalse(t.isTranslation()); assertEquals(Double.NaN, t.getTX()); assertEquals(Double.NaN, t.getTY()); assertEquals(Double.NaN, t.getXScaleFactor()); assertEquals(Double.NaN, t.getYScaleFactor()); assertEquals(Double.NaN, t.getXSkewAngle()); assertEquals(Double.NaN, t.getRotationAngle()); assertEquals(SVGTransform.SVG_TRANSFORM_SKEWY, t.getType()); } @Test public void testSetRotate() { SVGTransform t = new SVGTransform(); SVGMatrix m; t.setRotate(2, 0, 0); assertTrue(t.isRotation()); assertFalse(t.isScale()); assertFalse(t.isXSkew()); assertFalse(t.isYSkew()); assertFalse(t.isTranslation()); assertEquals(Double.NaN, t.getTX()); assertEquals(Double.NaN, t.getTY()); assertEquals(Double.NaN, t.getXScaleFactor()); assertEquals(Double.NaN, t.getYScaleFactor()); assertEquals(Double.NaN, t.getXSkewAngle()); assertEquals(Double.NaN, t.getYSkewAngle()); assertEquals(SVGTransform.SVG_TRANSFORM_ROTATE, t.getType()); m = t.getMatrix(); assertEquals(t.getRotationAngle(), 2.); assertEquals(m.getE(), 0.); assertEquals(m.getF(), 0.); t.setRotate(2, 3, 4); assertEquals(t.getRotationAngle(), 2.); m = t.getMatrix(); assertEquals(m.getE(), 3.); assertEquals(m.getF(), 4.); } public void testSetMatrix() { SVGTransform t = new SVGTransform(); SVGMatrix m = t.getMatrix(); t.setMatrix(2, 3, 4, 5, 6, 7); assertEquals(m.getA(), 2.); assertEquals(m.getB(), 3.); assertEquals(m.getC(), 4.); assertEquals(m.getD(), 5.); assertEquals(m.getE(), 6.); assertEquals(m.getF(), 7.); assertEquals(SVGTransform.SVG_TRANSFORM_MATRIX, t.getType()); assertEquals(Double.NaN, t.getTX()); assertEquals(Double.NaN, t.getTY()); assertEquals(Double.NaN, t.getXScaleFactor()); assertEquals(Double.NaN, t.getYScaleFactor()); assertEquals(Double.NaN, t.getXSkewAngle()); assertEquals(Double.NaN, t.getYSkewAngle()); assertEquals(Double.NaN, t.getRotationAngle()); assertFalse(t.isRotation()); assertFalse(t.isScale()); assertFalse(t.isXSkew()); assertFalse(t.isYSkew()); assertFalse(t.isTranslation()); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestCSSStyleList.java0000644000000000000000000000411011347255510020413 0ustar package junit.test.svg; import junit.framework.TestCase; import latexDraw.parsers.svg.CSSStyleList; import org.junit.Test; /** * This class contains tests on CSSStyleList class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 03/29/08
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestCSSStyleList extends TestCase { protected CSSStyleList list = new CSSStyleList(); @Test public void testAddCSSStyle() { list.clear(); list.addCSSStyle(null, null); assertEquals(0, list.size()); list.addCSSStyle("", null); assertEquals(0, list.size()); list.addCSSStyle(null, ""); assertEquals(0, list.size()); list.addCSSStyle("name", "value"); assertEquals(1, list.size()); assertEquals("value", list.getCSSValue("name")); list.clear(); } @Test public void testGetCSSValue() { list.clear(); assertNull(list.getCSSValue(null)); assertNull(list.getCSSValue("")); assertNull(list.getCSSValue("test")); list.addCSSStyle("name", "value"); assertEquals(1, list.size()); assertEquals("value", list.getCSSValue("name")); assertNull(list.getCSSValue(null)); assertNull(list.getCSSValue("")); assertNull(list.getCSSValue("test")); list.clear(); } @Test public void testOnCSSStyle() { list.clear(); list.addCSSStyle(null, null); assertEquals(0, list.size()); list.addCSSStyle("", null); assertEquals(0, list.size()); list.addCSSStyle(null, ""); assertEquals(0, list.size()); list.addCSSStyle("name", "value"); assertEquals(1, list.size()); assertEquals("value", list.getCSSValue("name")); list.clear(); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGDocument.java0000644000000000000000000001530711347255510020256 0ustar package junit.test.svg; import java.net.URI; import java.net.URISyntaxException; import junit.framework.TestCase; import latexDraw.parsers.svg.*; import latexDraw.parsers.svg.elements.SVGElement; import latexDraw.parsers.svg.elements.SVGSVGElement; import org.junit.Before; import org.junit.Test; import org.w3c.dom.DOMException; import org.w3c.dom.Node; /** * This class contains tests for the SVGDocument class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 03/31/08
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestSVGDocument extends TestCase { protected SVGDocument doc1; protected SVGDocument doc2; @Override @Before public void setUp() { doc1 = new SVGDocument(); try { doc2 = new SVGDocument(new URI("junit/test/svg/test.svg")); } catch(MalformedSVGDocument e){ fail(); } catch(URISyntaxException e){ fail(); } } @Test public void testSVGDocument() { try { new SVGDocument(null); fail(); } catch(IllegalArgumentException e){ /* ok */ } catch(MalformedSVGDocument e){ fail(); } try { new SVGDocument(new URI("dfqsfg")); fail(); } catch(MalformedSVGDocument e){ /* ok */ } catch(URISyntaxException e){ fail(); } try { SVGDocument doc = new SVGDocument(new URI("junit/test/svg/test.svg")); assertNotNull(doc.getFirstChild()); assertNotNull(doc.getLastChild()); } catch(MalformedSVGDocument e){ fail(); } catch(URISyntaxException e){ fail(); } } @Test public void testSVGDocument2() { SVGDocument doc = new SVGDocument(); assertNotNull(doc.getFirstChild()); assertNotNull(doc.getLastChild()); assertNull(doc.getDocumentURI()); } @Test public void testToLaTeXDraw() { // LShape shape; // // shape = doc1.toLaTeXDraw(null); // shape = doc2.toLaTeXDraw(null);//TODO } @Test public void testAdoptNode() { SVGSVGElement elt = new SVGSVGElement(doc2); try { doc1.adoptNode(null); fail(); } catch(DOMException e){ /* ok */ } try { doc1.adoptNode(new SVGComment("", doc2)); fail(); } catch(DOMException e){ /* ok */ } doc1.adoptNode(elt); assertEquals(doc1, elt.getOwnerDocument()); assertEquals(doc1.getFirstChild(), elt); } @Test public void testGetDocumentElement() { assertNotNull(doc1.getDocumentElement()); } @Test public void testSetDocumentURI() { doc1.setDocumentURI(null); assertNull(doc1.getDocumentURI()); doc1.setDocumentURI("coucou"); assertEquals("coucou", doc1.getDocumentURI()); } @Test public void testSetXmlStandalone() { doc1.setXmlStandalone(false); assertFalse(doc1.getXmlStandalone()); doc1.setXmlStandalone(true); assertTrue(doc1.getXmlStandalone()); } @Test public void testSetXmlVersion() { doc1.setXmlVersion(null); assertNull(doc1.getXmlVersion()); doc1.setXmlVersion("coucou"); assertEquals("coucou", doc1.getXmlVersion()); } @Test public void testUselessMethods() { assertNull(doc1.getAttributes()); assertNull(doc1.getChildNodes()); assertNull(doc1.getNextSibling()); assertNull(doc1.getPreviousSibling()); assertNull(doc2.getAttributes()); assertNull(doc2.getChildNodes()); assertNull(doc2.getNextSibling()); assertNull(doc2.getPreviousSibling()); assertNull(doc2.getNodeValue()); assertNull(doc2.getOwnerDocument()); assertNull(doc2.getParentNode()); assertNull(doc1.getNodeValue()); assertNull(doc1.getOwnerDocument()); assertNull(doc1.getParentNode()); assertFalse(doc2.hasAttributes()); assertFalse(doc1.hasAttributes()); assertNull(doc1.getDoctype()); } @Test public void testGetFirstChild() { assertNotNull(doc1.getFirstChild()); assertNotNull(doc2.getFirstChild()); } @Test public void testGetLastChild() { assertNotNull(doc1.getLastChild()); assertNotNull(doc2.getLastChild()); assertEquals(doc1.getLastChild(), doc1.getFirstChild()); assertEquals(doc2.getLastChild(), doc2.getFirstChild()); } @Test public void testGetNodeName() { assertEquals("#document", doc1.getNodeName()); assertEquals("#document", doc2.getNodeName()); } @Test public void testGetNodeType() { assertEquals(Node.DOCUMENT_NODE, doc1.getNodeType()); assertEquals(Node.DOCUMENT_NODE, doc2.getNodeType()); } @Test public void testHasChildNode() { assertTrue(doc1.hasChildNodes()); assertTrue(doc2.hasChildNodes()); } @Test public void testIsEqualNode() { SVGDocument doc = new SVGDocument(); assertTrue(doc1.isEqualNode(doc)); assertFalse(doc1.isEqualNode(null)); assertFalse(doc1.isEqualNode(doc2)); try { doc = new SVGDocument(new URI("junit/test/svg/test.svg")); assertTrue(doc2.isEqualNode(doc)); assertFalse(doc2.isEqualNode(null)); assertFalse(doc2.isEqualNode(doc1)); } catch(MalformedSVGDocument e){ fail(); } catch(URISyntaxException e){ fail(); } } @Test public void testIsSameNode() { assertTrue(doc1.isEqualNode(doc1)); assertTrue(doc2.isEqualNode(doc2)); assertFalse(doc1.isEqualNode(null)); assertFalse(doc2.isEqualNode(null)); assertFalse(doc1.isEqualNode(doc2)); assertFalse(doc2.isEqualNode(doc1)); } @Test public void testCreateElement() { try { doc1.createElement(null); fail(); } catch(DOMException e) { /* ok */ } SVGElement elt = (SVGElement)doc1.createElement("test"); assertEquals(elt.getNodeName(), "test"); assertEquals(doc1, elt.getOwnerDocument()); } @Test public void testCreateTextNode() { try { doc1.createTextNode(null); fail(); } catch(DOMException e) { /* ok */ } SVGText elt = (SVGText)doc1.createTextNode("test"); assertEquals(elt.getData(), "test"); assertEquals(doc1, elt.getOwnerDocument()); } @Test public void testCreateComment() { try { doc1.createComment(null); fail(); } catch(DOMException e) { /* ok */ } SVGComment elt = (SVGComment)doc1.createComment("test"); assertEquals(elt.getData(), "test"); assertEquals(doc1, elt.getOwnerDocument()); } @Test public void testCreateCDATASection() { try { doc1.createCDATASection(null); fail(); } catch(DOMException e) { /* ok */ } SVGCDATASection elt = (SVGCDATASection)doc1.createCDATASection("test"); assertEquals(elt.getData(), "test"); assertEquals(doc1, elt.getOwnerDocument()); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGPathSegMoveto.java0000644000000000000000000000361111347255510021220 0ustar package junit.test.svg; import java.text.ParseException; import junit.framework.TestCase; import latexDraw.parsers.svg.elements.path.SVGPathSeg; import latexDraw.parsers.svg.elements.path.SVGPathSegMoveto; import latexDraw.parsers.svg.elements.path.SVGPathSeg.PathSeg; import latexDraw.parsers.svg.parsers.SVGPathHandler; import latexDraw.parsers.svg.parsers.SVGPathParser; import org.junit.Test; /** * This class contains tests for the SVGPathSegMoveto class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/23/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestSVGPathSegMoveto extends TestCase implements SVGPathHandler { protected final SVGPathSegMoveto seg = new SVGPathSegMoveto(-1, -2, false); @Test public void testGetters() { assertEquals(seg.getX(), -1.); assertEquals(seg.getY(), -2.); assertFalse(seg.isRelative()); assertEquals(seg.getType(), PathSeg.MOVETO_ABS); } @Test public void testToString() { SVGPathParser parser = new SVGPathParser(seg.toString(), this); try { parser.parse(); } catch(ParseException e) { fail(); } } public void onPathSeg(SVGPathSeg pathSeg) { assertTrue(pathSeg instanceof SVGPathSegMoveto); SVGPathSegMoveto seg2 = (SVGPathSegMoveto)pathSeg; assertEquals(seg.getX(), seg2.getX()); assertEquals(seg.getY(), seg2.getY()); assertEquals(seg.isRelative(), seg2.isRelative()); } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGPathElement.java0000644000000000000000000000335011347255510020701 0ustar package junit.test.svg; import latexDraw.parsers.svg.MalformedSVGDocument; import latexDraw.parsers.svg.SVGAttributes; import latexDraw.parsers.svg.SVGElements; import latexDraw.parsers.svg.elements.SVGPathElement; import org.junit.Test; /** * This class contains tests for the SVGPathElement class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/14/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestSVGPathElement extends AbstractTestSVGElement { @Test public void testContructor() { try { new SVGPathElement(null, null); fail(); } catch(Exception e){/**/} try { new SVGPathElement(node, null); fail(); } catch(MalformedSVGDocument e){ /**/ } try { node.setAttribute(SVGAttributes.SVG_D, "test"); new SVGPathElement(node, null); } catch(MalformedSVGDocument e){ fail(); } } @Test public void testGetPathData() { try { node.setAttribute(SVGAttributes.SVG_D, "M 0 0 L 10 10"); SVGPathElement e = new SVGPathElement(node, null); assertEquals(e.getPathData(), "M 0 0 L 10 10"); } catch(MalformedSVGDocument e) { fail(); } } @Override public String getNameNode() { return SVGElements.SVG_PATH; } } latexdraw-2.0.8+1.orig/junit/test/svg/TestSVGPathSegLineto.java0000644000000000000000000000423311347255510021202 0ustar package junit.test.svg; import java.text.ParseException; import junit.framework.TestCase; import latexDraw.parsers.svg.elements.path.SVGPathSeg; import latexDraw.parsers.svg.elements.path.SVGPathSegLineto; import latexDraw.parsers.svg.elements.path.SVGPathSegMoveto; import latexDraw.parsers.svg.elements.path.SVGPathSeg.PathSeg; import latexDraw.parsers.svg.parsers.SVGPathHandler; import latexDraw.parsers.svg.parsers.SVGPathParser; import org.junit.Test; /** * This class contains tests for the SVGPathSegLineto class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/23/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestSVGPathSegLineto extends TestCase implements SVGPathHandler { protected final SVGPathSegLineto seg = new SVGPathSegLineto(-1, -2, true); protected int cpt = 0; @Test public void testGetters() { assertEquals(seg.getX(), -1.); assertEquals(seg.getY(), -2.); assertTrue(seg.isRelative()); assertEquals(seg.getType(), PathSeg.LINETO_REL); } @Test public void testToString() { SVGPathSegMoveto m = new SVGPathSegMoveto(0, 0, false); SVGPathParser parser = new SVGPathParser(m.toString() + " " + seg.toString(), this); try { parser.parse(); } catch(ParseException e) { fail(); } } public void onPathSeg(SVGPathSeg pathSeg) { if((pathSeg instanceof SVGPathSegMoveto) && cpt==0) { cpt++; return ; } assertTrue(pathSeg instanceof SVGPathSegLineto); SVGPathSegLineto seg2 = (SVGPathSegLineto)pathSeg; assertEquals(seg.getX(), seg2.getX()); assertEquals(seg.getY(), seg2.getY()); assertEquals(seg.isRelative(), seg2.isRelative()); } } latexdraw-2.0.8+1.orig/junit/test/TestCopyPasteMenu.java0000644000000000000000000000226211347255510020051 0ustar /* * TestCopyPasteMenu.java */ package junit.test; import javax.swing.JEditorPane; import junit.framework.TestCase; import latexDraw.ui.components.CopyPasteMenu; import org.junit.Before; import org.junit.Test; /** * This class contains tests on the class CopyPasteMenu.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 06/26/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestCopyPasteMenu extends TestCase { @Before @Test public void testConstructors() { JEditorPane ep = new JEditorPane(); try { new CopyPasteMenu(null); fail(); }catch(IllegalArgumentException e) { /* Good */ } new CopyPasteMenu(ep); } } latexdraw-2.0.8+1.orig/junit/test/TestCloseButton.java0000644000000000000000000000265011347255510017557 0ustar /* * TestCloseButton.java */ package junit.test; import java.awt.event.ActionEvent; import javax.swing.JPanel; import junit.framework.TestCase; import latexDraw.ui.components.CloseButton; import org.junit.Before; import org.junit.Test; /** * This class contains tests on the class CloseButton.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 06/26/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestCloseButton extends TestCase { private CloseButton cb; private final JPanel panel = new JPanel(); @Override @Before public void setUp() { cb = new CloseButton(panel); } @Test public void testConstructor() { new CloseButton(null); } @Test public void testActionPerformed() { ActionEvent e = new ActionEvent(cb, 0, ""); cb.actionPerformed(e); System.out.println(panel.isVisible()); assertFalse(panel.isVisible()); } } latexdraw-2.0.8+1.orig/junit/test/TestDviPsColors.java0000644000000000000000000003321211347255510017523 0ustar /* * DviPsColorsTest.java */ package junit.test; import java.awt.Color; import junit.framework.TestCase; import latexDraw.psTricks.DviPsColors; import org.junit.Test; /** * This class contains tests for the {@link DviPsColors} class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 06/20/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestDviPsColors extends TestCase { @Test public void testGetColorName() { Color c2 = new Color(218, 29, 78); String nameColour = "testColour"; assertNull(DviPsColors.getColourName(null)); DviPsColors.addUserColour(c2, nameColour); assertEquals(nameColour, DviPsColors.getColourName(c2)); assertEquals(DviPsColors.N_APRICOT, DviPsColors.getColourName(DviPsColors.APRICOT)); assertEquals(DviPsColors.N_AQUAMARINE, DviPsColors.getColourName(DviPsColors.AQUAMARINE)); assertEquals(DviPsColors.N_BITTERSWEET, DviPsColors.getColourName(DviPsColors.BITTERSWEET)); assertEquals(DviPsColors.N_BLUEGREEN, DviPsColors.getColourName(DviPsColors.BLUEGREEN)); assertEquals(DviPsColors.N_BLUEVIOLET, DviPsColors.getColourName(DviPsColors.BLUEVIOLET)); assertEquals(DviPsColors.N_BRICKRED, DviPsColors.getColourName(DviPsColors.BRICKRED)); assertEquals(DviPsColors.N_BURNT_ORANGE, DviPsColors.getColourName(DviPsColors.BURNT_ORANGE)); assertEquals(DviPsColors.N_CADETBLUE, DviPsColors.getColourName(DviPsColors.CADETBLUE)); assertEquals(DviPsColors.N_CARNATIONPINK, DviPsColors.getColourName(DviPsColors.CARNATIONPINK)); assertEquals(DviPsColors.N_CERULEAN, DviPsColors.getColourName(DviPsColors.CERULEAN)); assertEquals(DviPsColors.N_CORNFLOWERBLUE, DviPsColors.getColourName(DviPsColors.CORNFLOWERBLUE)); assertEquals(DviPsColors.N_DANDELION, DviPsColors.getColourName(DviPsColors.DANDELION)); assertEquals(DviPsColors.N_DARK_GRAY, DviPsColors.getColourName(Color.DARK_GRAY)); assertEquals(DviPsColors.N_DARKORCHID, DviPsColors.getColourName(DviPsColors.DARKORCHID)); assertEquals(DviPsColors.N_EMERALD, DviPsColors.getColourName(DviPsColors.EMERALD)); assertEquals(DviPsColors.N_FORESTGREEN, DviPsColors.getColourName(DviPsColors.FORESTGREEN)); assertEquals(DviPsColors.N_FUSHIA, DviPsColors.getColourName(DviPsColors.FUSHIA)); assertEquals(DviPsColors.N_GOLDEN_ROD, DviPsColors.getColourName(DviPsColors.GOLDEN_ROD)); assertEquals(DviPsColors.N_GREEN_YELLOW, DviPsColors.getColourName(DviPsColors.GREEN_YELLOW)); assertEquals(DviPsColors.N_JUNGLEGREEN, DviPsColors.getColourName(DviPsColors.JUNGLEGREEN)); assertEquals(DviPsColors.N_LAVENDER, DviPsColors.getColourName(DviPsColors.LAVENDER)); assertEquals(DviPsColors.N_LIGHT_GRAY, DviPsColors.getColourName(Color.LIGHT_GRAY)); assertEquals(DviPsColors.N_LIMEGREEN, DviPsColors.getColourName(DviPsColors.LIMEGREEN)); assertEquals(DviPsColors.N_MAHOGANY, DviPsColors.getColourName(DviPsColors.MAHOGANY)); assertEquals(DviPsColors.N_MAROON, DviPsColors.getColourName(DviPsColors.MAROON)); assertEquals(DviPsColors.N_MELON, DviPsColors.getColourName(DviPsColors.MELON)); assertEquals(DviPsColors.N_MIDNIGHTBLUE, DviPsColors.getColourName(DviPsColors.MIDNIGHTBLUE)); assertEquals(DviPsColors.N_MULBERRY, DviPsColors.getColourName(DviPsColors.MULBERRY)); assertEquals(DviPsColors.N_NAVYBLUE, DviPsColors.getColourName(DviPsColors.NAVYBLUE)); assertEquals(DviPsColors.N_OLIVEGREEN, DviPsColors.getColourName(DviPsColors.OLIVEGREEN)); assertEquals(DviPsColors.N_ORANGERED, DviPsColors.getColourName(DviPsColors.ORANGERED)); assertEquals(DviPsColors.N_ORCHID, DviPsColors.getColourName(DviPsColors.ORCHID)); assertEquals(DviPsColors.N_PEACH, DviPsColors.getColourName(DviPsColors.PEACH)); assertEquals(DviPsColors.N_PERIWINKLE, DviPsColors.getColourName(DviPsColors.PERIWINKLE)); assertEquals(DviPsColors.N_PINEGREEN, DviPsColors.getColourName(DviPsColors.PINEGREEN)); assertEquals(DviPsColors.N_PINK, DviPsColors.getColourName(DviPsColors.PINK)); assertEquals(DviPsColors.N_PLUM, DviPsColors.getColourName(DviPsColors.PLUM)); assertEquals(DviPsColors.N_PROCESSBLUE, DviPsColors.getColourName(DviPsColors.PROCESSBLUE)); assertEquals(DviPsColors.N_RAWSIENNA, DviPsColors.getColourName(DviPsColors.RAWSIENNA)); assertEquals(DviPsColors.N_RED_ORANGE, DviPsColors.getColourName(DviPsColors.RED_ORANGE)); assertEquals(DviPsColors.N_REDVIOLET, DviPsColors.getColourName(DviPsColors.REDVIOLET)); assertEquals(DviPsColors.N_RHODAMINE, DviPsColors.getColourName(DviPsColors.RHODAMINE)); assertEquals(DviPsColors.N_ROYALBLUE, DviPsColors.getColourName(DviPsColors.ROYALBLUE)); assertEquals(DviPsColors.N_ROYALPURPLE, DviPsColors.getColourName(DviPsColors.ROYALPURPLE)); assertEquals(DviPsColors.N_RUBINERED, DviPsColors.getColourName(DviPsColors.RUBINERED)); assertEquals(DviPsColors.N_SALMON, DviPsColors.getColourName(DviPsColors.SALMON)); assertEquals(DviPsColors.N_SEAGREEN, DviPsColors.getColourName(DviPsColors.SEAGREEN)); assertEquals(DviPsColors.N_SEPIA, DviPsColors.getColourName(DviPsColors.SEPIA)); assertEquals(DviPsColors.N_SKYBLUE, DviPsColors.getColourName(DviPsColors.SKYBLUE)); assertEquals(DviPsColors.N_SPRINGGREEN, DviPsColors.getColourName(DviPsColors.SPRINGGREEN)); assertEquals(DviPsColors.N_TAN, DviPsColors.getColourName(DviPsColors.TAN)); assertEquals(DviPsColors.N_TEALBLUE, DviPsColors.getColourName(DviPsColors.TEALBLUE)); assertEquals(DviPsColors.N_THISTLE, DviPsColors.getColourName(DviPsColors.THISTLE)); assertEquals(DviPsColors.N_TURQUOISE, DviPsColors.getColourName(DviPsColors.TURQUOISE)); assertEquals(DviPsColors.N_VIOLETRED, DviPsColors.getColourName(DviPsColors.VIOLETRED)); assertEquals(DviPsColors.N_WILDSTRAWBERRY, DviPsColors.getColourName(DviPsColors.WILDSTRAWBERRY)); assertEquals(DviPsColors.N_YELLOW_ORANGE, DviPsColors.getColourName(DviPsColors.YELLOW_ORANGE)); assertEquals(DviPsColors.N_YELLOWGREEN, DviPsColors.getColourName(DviPsColors.YELLOWGREEN)); } @Test public void testGetColor() { Color c2 = new Color(218, 29, 78); String nameColour = "testColour"; assertEquals(c2, DviPsColors.getColour(nameColour)); assertEquals(DviPsColors.APRICOT, DviPsColors.getColour(DviPsColors.N_APRICOT)); assertEquals(DviPsColors.AQUAMARINE, DviPsColors.getColour(DviPsColors.N_AQUAMARINE)); assertEquals(DviPsColors.BITTERSWEET, DviPsColors.getColour(DviPsColors.N_BITTERSWEET)); assertEquals(DviPsColors.BLUEGREEN, DviPsColors.getColour(DviPsColors.N_BLUEGREEN)); assertEquals(DviPsColors.BLUEVIOLET, DviPsColors.getColour(DviPsColors.N_BLUEVIOLET)); assertEquals(DviPsColors.BRICKRED, DviPsColors.getColour(DviPsColors.N_BRICKRED)); assertEquals(DviPsColors.BURNT_ORANGE, DviPsColors.getColour(DviPsColors.N_BURNT_ORANGE)); assertEquals(DviPsColors.CADETBLUE, DviPsColors.getColour(DviPsColors.N_CADETBLUE)); assertEquals(DviPsColors.CARNATIONPINK, DviPsColors.getColour(DviPsColors.N_CARNATIONPINK)); assertEquals(DviPsColors.CERULEAN, DviPsColors.getColour(DviPsColors.N_CERULEAN)); assertEquals(DviPsColors.CORNFLOWERBLUE, DviPsColors.getColour(DviPsColors.N_CORNFLOWERBLUE)); assertEquals(DviPsColors.DANDELION, DviPsColors.getColour(DviPsColors.N_DANDELION)); assertEquals(Color.DARK_GRAY, DviPsColors.getColour(DviPsColors.N_DARK_GRAY)); assertEquals(DviPsColors.DARKORCHID, DviPsColors.getColour(DviPsColors.N_DARKORCHID)); assertEquals(DviPsColors.EMERALD, DviPsColors.getColour(DviPsColors.N_EMERALD)); assertEquals(DviPsColors.FORESTGREEN, DviPsColors.getColour(DviPsColors.N_FORESTGREEN)); assertEquals(DviPsColors.FUSHIA, DviPsColors.getColour(DviPsColors.N_FUSHIA)); assertEquals(DviPsColors.GOLDEN_ROD, DviPsColors.getColour(DviPsColors.N_GOLDEN_ROD)); assertEquals(DviPsColors.GREEN_YELLOW, DviPsColors.getColour(DviPsColors.N_GREEN_YELLOW)); assertEquals(DviPsColors.JUNGLEGREEN, DviPsColors.getColour(DviPsColors.N_JUNGLEGREEN)); assertEquals(DviPsColors.LAVENDER, DviPsColors.getColour(DviPsColors.N_LAVENDER)); assertEquals(Color.LIGHT_GRAY, DviPsColors.getColour(DviPsColors.N_LIGHT_GRAY)); assertEquals(DviPsColors.LIMEGREEN, DviPsColors.getColour(DviPsColors.N_LIMEGREEN)); assertEquals(DviPsColors.MAHOGANY, DviPsColors.getColour(DviPsColors.N_MAHOGANY)); assertEquals(DviPsColors.MAROON, DviPsColors.getColour(DviPsColors.N_MAROON)); assertEquals(DviPsColors.MELON, DviPsColors.getColour(DviPsColors.N_MELON)); assertEquals(DviPsColors.MIDNIGHTBLUE, DviPsColors.getColour(DviPsColors.N_MIDNIGHTBLUE)); assertEquals(DviPsColors.MULBERRY, DviPsColors.getColour(DviPsColors.N_MULBERRY)); assertEquals(DviPsColors.NAVYBLUE, DviPsColors.getColour(DviPsColors.N_NAVYBLUE)); assertEquals(DviPsColors.OLIVEGREEN, DviPsColors.getColour(DviPsColors.N_OLIVEGREEN)); assertEquals(DviPsColors.ORANGERED, DviPsColors.getColour(DviPsColors.N_ORANGERED)); assertEquals(DviPsColors.ORCHID, DviPsColors.getColour(DviPsColors.N_ORCHID)); assertEquals(DviPsColors.PEACH, DviPsColors.getColour(DviPsColors.N_PEACH)); assertEquals(DviPsColors.PERIWINKLE, DviPsColors.getColour(DviPsColors.N_PERIWINKLE)); assertEquals(DviPsColors.PINEGREEN, DviPsColors.getColour(DviPsColors.N_PINEGREEN)); assertEquals(DviPsColors.PINK, DviPsColors.getColour(DviPsColors.N_PINK)); assertEquals(DviPsColors.PLUM, DviPsColors.getColour(DviPsColors.N_PLUM)); assertEquals(DviPsColors.PROCESSBLUE, DviPsColors.getColour(DviPsColors.N_PROCESSBLUE)); assertEquals(DviPsColors.RAWSIENNA, DviPsColors.getColour(DviPsColors.N_RAWSIENNA)); assertEquals(DviPsColors.RED_ORANGE, DviPsColors.getColour(DviPsColors.N_RED_ORANGE)); assertEquals(DviPsColors.REDVIOLET, DviPsColors.getColour(DviPsColors.N_REDVIOLET)); assertEquals(DviPsColors.RHODAMINE, DviPsColors.getColour(DviPsColors.N_RHODAMINE)); assertEquals(DviPsColors.ROYALBLUE, DviPsColors.getColour(DviPsColors.N_ROYALBLUE)); assertEquals(DviPsColors.ROYALPURPLE, DviPsColors.getColour(DviPsColors.N_ROYALPURPLE)); assertEquals(DviPsColors.RUBINERED, DviPsColors.getColour(DviPsColors.N_RUBINERED)); assertEquals(DviPsColors.SALMON, DviPsColors.getColour(DviPsColors.N_SALMON)); assertEquals(DviPsColors.SEAGREEN, DviPsColors.getColour(DviPsColors.N_SEAGREEN)); assertEquals(DviPsColors.SEPIA, DviPsColors.getColour(DviPsColors.N_SEPIA)); assertEquals(DviPsColors.SKYBLUE, DviPsColors.getColour(DviPsColors.N_SKYBLUE)); assertEquals(DviPsColors.SPRINGGREEN, DviPsColors.getColour(DviPsColors.N_SPRINGGREEN)); assertEquals(DviPsColors.TAN, DviPsColors.getColour(DviPsColors.N_TAN)); assertEquals(DviPsColors.TEALBLUE, DviPsColors.getColour(DviPsColors.N_TEALBLUE)); assertEquals(DviPsColors.THISTLE, DviPsColors.getColour(DviPsColors.N_THISTLE)); assertEquals(DviPsColors.TURQUOISE, DviPsColors.getColour(DviPsColors.N_TURQUOISE)); assertEquals(DviPsColors.VIOLETRED, DviPsColors.getColour(DviPsColors.N_VIOLETRED)); assertEquals(DviPsColors.WILDSTRAWBERRY, DviPsColors.getColour(DviPsColors.N_WILDSTRAWBERRY)); assertEquals(DviPsColors.YELLOW_ORANGE, DviPsColors.getColour(DviPsColors.N_YELLOW_ORANGE)); assertEquals(DviPsColors.YELLOWGREEN, DviPsColors.getColour(DviPsColors.N_YELLOWGREEN)); } @Test public void testAddUserColor() { Color c2 = new Color(218, 29, 78); String nameColour = "testColour"; DviPsColors.addUserColour(c2, nameColour); assertEquals(nameColour, DviPsColors.getColourName(c2)); } @Test public void testGetUserColorsCode() { Color c = new Color(230, 65, 78); String nameColour = "testColour2"; DviPsColors.addUserColour(c, nameColour); assertNotNull(DviPsColors.getUserColoursCode(null)); assertNotNull(DviPsColors.getUserColoursCode("coucou")); } @Test public void testGetUserColorCode() { Color c = new Color(30, 65, 78); String nameColour = "testColour3"; assertNull(DviPsColors.getUsercolourCode(-1)); assertNull(DviPsColors.getUsercolourCode(10000000)); DviPsColors.addUserColour(c, nameColour); assertNotNull(DviPsColors.getUsercolourCode(0)); } @Test public void testCMYK2RGB() { try { DviPsColors.CMYK2RGB(-1, 0.5, 0.5, 0.5); fail(); }catch(IllegalArgumentException e) { /* Good. */ } try { DviPsColors.CMYK2RGB(2, 0.5, 0.5, 0.5); fail(); }catch(IllegalArgumentException e) { /* Good. */ } try { DviPsColors.CMYK2RGB(0.5, -1, 0.5, 0.5); fail(); }catch(IllegalArgumentException e) { /* Good. */ } try { DviPsColors.CMYK2RGB(0.5, 2, 0.5, 0.5); fail(); }catch(IllegalArgumentException e) { /* Good. */ } try { DviPsColors.CMYK2RGB(0.5, 0.5, -1, 0.5); fail(); }catch(IllegalArgumentException e) { /* Good. */ } try { DviPsColors.CMYK2RGB(0.5, 0.5, 2, 0.5); fail(); }catch(IllegalArgumentException e) { /* Good. */ } try { DviPsColors.CMYK2RGB(0.5, 0.5, 0.5, -1); fail(); }catch(IllegalArgumentException e) { /* Good. */ } try { DviPsColors.CMYK2RGB(0.5, 0.5, 0.5, 2); fail(); }catch(IllegalArgumentException e) { /* Good. */ } assertEquals(new Color(51, 92, 71), DviPsColors.CMYK2RGB(0.5, 0.1, 0.3, 0.6)); } @Test public void testGray2RBG() { try { DviPsColors.gray2RBG(-10); fail(); }catch(IllegalArgumentException e) { /* Good. */ } try { DviPsColors.gray2RBG(300); fail(); }catch(IllegalArgumentException e) { /* Good. */ } assertEquals(new Color(255, 255, 255), DviPsColors.gray2RBG(1)); } } latexdraw-2.0.8+1.orig/junit/test/TestLLang.java0000644000000000000000000000740011347255510016311 0ustar package junit.test; import junit.framework.TestCase; import latexDraw.lang.LaTeXDrawLang; import static latexDraw.lang.LaTeXDrawLang.*; import org.junit.Test; /** * This class contains tests for the LLang class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 12/18/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestLLang extends TestCase { @Test public void testGetOthersString() { assertEquals(getOthersString(null), '!' + LaTeXDrawLang.MISSING_KEY + '!'); assertEquals(getOthersString("thisisnotavalidkey;)"), "!thisisnotavalidkey;)!"); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals(getOthersString(""), "!!"); //$NON-NLS-1$ //$NON-NLS-2$ } @Test public void testGetStringLaTeXDrawFrame() { assertEquals(getStringLaTeXDrawFrame(null), '!' + LaTeXDrawLang.MISSING_KEY + '!'); assertEquals(getStringLaTeXDrawFrame("thisisnotavalidkey;)"), "!thisisnotavalidkey;)!"); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals(getStringLaTeXDrawFrame(""), "!!"); //$NON-NLS-1$ //$NON-NLS-2$ } @Test public void testGetString1_6() { assertEquals(getString1_6(null), '!' + LaTeXDrawLang.MISSING_KEY + '!'); assertEquals(getString1_6("thisisnotavalidkey;)"), "!thisisnotavalidkey;)!"); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals(getString1_6(""), "!!"); //$NON-NLS-1$ //$NON-NLS-2$ } @Test public void testGetString1_7() { assertEquals(getString1_7(null), '!' + LaTeXDrawLang.MISSING_KEY + '!'); assertEquals(getString1_7("thisisnotavalidkey;)"), "!thisisnotavalidkey;)!"); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals(getString1_7(""), "!!"); //$NON-NLS-1$ //$NON-NLS-2$ } @Test public void testGetString1_8() { assertEquals(getString1_8(null), '!' + LaTeXDrawLang.MISSING_KEY + '!'); assertEquals(getString1_8("thisisnotavalidkey;)"), "!thisisnotavalidkey;)!"); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals(getString1_8(""), "!!"); //$NON-NLS-1$ //$NON-NLS-2$ } @Test public void testGetString1_9() { assertEquals(getString1_9(null), '!' + LaTeXDrawLang.MISSING_KEY + '!'); assertEquals(getString1_9("thisisnotavalidkey;)"), "!thisisnotavalidkey;)!"); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals(getString1_9(""), "!!"); //$NON-NLS-1$ //$NON-NLS-2$ } @Test public void testGetDialogFrameString() { assertEquals(getDialogFrameString(null), '!' + LaTeXDrawLang.MISSING_KEY + '!'); assertEquals(getDialogFrameString("thisisnotavalidkey;)"), "!thisisnotavalidkey;)!"); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals(getDialogFrameString(""), "!!"); //$NON-NLS-1$ //$NON-NLS-2$ } @Test public void testLang() { readLang(); getlangCurrent(); getTokenLang(); } @Test public void testSetLangCurrent() { String former = getlangCurrent(); setlangCurrent(null); assertEquals(former, getlangCurrent()); setlangCurrent(""); //$NON-NLS-1$ assertEquals(former, getlangCurrent()); setlangCurrent("dsqdsq"); //$NON-NLS-1$ assertEquals(former, getlangCurrent()); setlangCurrent(LANG_DE); assertEquals(getlangCurrent(), LANG_DE); setlangCurrent(LANG_ES); assertEquals(getlangCurrent(), LANG_ES); setlangCurrent(LANG_FR); assertEquals(getlangCurrent(), LANG_FR); setlangCurrent(LANG_EN); assertEquals(getlangCurrent(), LANG_EN); setlangCurrent(LANG_EN_US); assertEquals(getlangCurrent(), LANG_EN_US); } } latexdraw-2.0.8+1.orig/junit/test/TestParserCmdMessage.java0000644000000000000000000000304211347255510020477 0ustar package junit.test; import junit.framework.TestCase; import latexDraw.parsers.ParserCmdMessage; import org.junit.Test; /** * This class contains tests for the ParserCmdMessage class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/10/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestParserCmdMessage extends TestCase { public static final String COMMAND = "command"; public static final Exception EX = new IllegalArgumentException("Test exception"); public static final int LINE = 10; public static final ParserCmdMessage MSG = new ParserCmdMessage(LINE, EX, COMMAND); @Test public void testToString() { ParserCmdMessage m = new ParserCmdMessage(-1, null, null); m.toString(); MSG.toString(); } @Test public void testGetLine() { assertEquals(LINE, MSG.getNLine()); } @Test public void testGetException() { assertEquals(EX, MSG.getException()); } @Test public void testGetCommand() { assertEquals(COMMAND, MSG.getCommand()); } } latexdraw-2.0.8+1.orig/junit/test/TestLaTeXDrawCursor.java0000644000000000000000000000351211347255510020305 0ustar /* * TestLaTeXDrawCursor.java */ package junit.test; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Toolkit; import java.awt.image.BufferedImage; import java.net.URL; import javax.swing.ImageIcon; import junit.framework.TestCase; import org.junit.Test; /** * This class contains tests the methods of the class TestLaTeXDrawCursor.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 02/14/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestLaTeXDrawCursor extends TestCase { @Test public void testGetCursor() { try {//TODO voir pourquoi ca marche pas. // Cursor cursor = LaTeXDrawCursor.getCursor("/res/cursors/RotCWDown.gif", "rotate");//$NON-NLS-1$//$NON-NLS-2$ BufferedImage bi = new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB); Graphics2D graphic = (Graphics2D)bi.getGraphics(); ImageIcon img; URL url = getClass().getResource("/res/cursors/RotCWDown.gif"); img = new ImageIcon(url); graphic.drawImage(img.getImage(), null, null); assertNotNull(Toolkit.getDefaultToolkit().createCustomCursor(bi,new Point(0,0), "aa")); graphic.dispose(); bi.flush(); } catch(Exception e) { fail(); } } } latexdraw-2.0.8+1.orig/junit/test/TestShape.java0000644000000000000000000004237611347255510016367 0ustar /* * TestShape.java */ package junit.test; import java.awt.Color; import java.awt.Point; import junit.framework.TestCase; import latexDraw.figures.*; import latexDraw.psTricks.PSTricksConstants; import latexDraw.util.LaTeXDrawPoint2D; import org.junit.Test; /** * This class contains tests to check the graphical library.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 12/18/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestShape extends TestCase { protected static final DrawBorders drawBorders = new DrawBorders(false); @Test public void testFigure() { assertNotNull(Figure.createBordersPositionChoice()); assertNotNull(Figure.createBordersPositionChoice()); } @Test public void testRectangle() throws Exception { LaTeXDrawRectangle rec = new LaTeXDrawRectangle(false); Figure f; assertTrue(rec.canBeFilled()); assertTrue(rec.canBeHatched()); assertFalse(rec.canHaveArrow()); assertTrue(rec.canHaveShadow()); assertTrue(rec.isBordersMovable()); assertTrue(rec.isCustomizable()); assertTrue(rec.isDashableOrDotable()); assertTrue(rec.isDoubleBoundaryable()); assertTrue(rec.isThicknessable()); assertTrue(rec.isResizable()); f = (Figure)rec.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(rec, true, true)); rec.updateNSEWDelimitors(); rec.updateStyleOfDelimitors(); rec.updateGravityCenter(); rec.updateBorders(); rec.updateShape(); rec.updateBorders(new LaTeXDrawPoint2D()); rec.shift(10, 10); try { rec.shift(new LaTeXDrawPoint2D(), null); fail(); }catch(IllegalArgumentException e) { /* */} rec.addRotationAngle(10); rec.updateGravityCenter(); rec.addRotationAngle(0.3); rec.updateShape(); rec.updateStyleOfDelimitors(); rec.updateNSEWDelimitors(); rec.onClick(new Point(10,10)); rec.isIn(new LaTeXDrawPoint2D()); rec.isIn(rec.getGravityCenter()); rec.isIn(new Point()); f = (Figure)rec.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(rec, true, true)); rec.setDotSep(2); rec.setCustomizable(false); rec.setDoubleSep(2); rec.setFirstPoint(3, 3); rec.updateShape(); rec.setGradientMidPoint(0.3); rec.setFrameArc(0.2); rec.setGradientAngle(0.5); rec.setDoubleColor(Color.red); rec.setGradientStartColor(Color.yellow); rec.setGradientEndColor(Color.blue); rec.setHasDoubleBoundary(true); f = (Figure)rec.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(rec, true, true)); rec.setHasShadow(true); f = (Figure)rec.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(rec, true, true)); rec.setHatchingAngle(3); rec.setHatchingColor(Color.gray); rec.setHatchingSep(4); rec.setHatchingStyle(PSTricksConstants.TOKEN_FILL_HLINES); f = (Figure)rec.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(rec, true, true)); rec.setHatchingStyle(PSTricksConstants.TOKEN_FILL_GRADIENT); f = (Figure)rec.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(rec, true, true)); assertEquals(rec.getWidth(), rec.getTheSEPoint().x-rec.getTheNWPoint().x, 0.005); assertEquals(rec.getHeight(), rec.getTheSEPoint().y-rec.getTheNWPoint().y, 0.005); rec.updateShape(); rec.onRelease(); rec.onDelimitorRelease(); rec.onDragged(new Point(), new Point()); rec.createNonRotatedShape2D(); rec.createShadowShape(); rec.createShape2D(); rec.updateShape(); assertNotNull(rec.getCodePSTricks(drawBorders, Figure.PPC)); } @Test public void testJoinedLines() throws Exception { JoinedLines jl = new JoinedLines(new LaTeXDrawPoint2D(), new LaTeXDrawPoint2D(3,3), false); Figure f; assertTrue(jl.canBeFilled()); assertTrue(jl.canBeHatched()); assertTrue(jl.canHaveArrow()); assertTrue(jl.canHaveShadow()); assertFalse(jl.isBordersMovable()); assertTrue(jl.isCustomizable()); assertTrue(jl.isDashableOrDotable()); assertTrue(jl.isDoubleBoundaryable()); assertTrue(jl.isThicknessable()); assertTrue(jl.isResizable()); f = (Figure)jl.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(jl, true, true)); jl.updateBorders(); jl.updateShape(); jl.updateGravityCenter(); jl.addPoint(new LaTeXDrawPoint2D()); jl.addPoint(new LaTeXDrawPoint2D(3,3)); jl.addPoint(new LaTeXDrawPoint2D(1,3)); jl.updateBorders(); jl.updateShape(); jl.updateGravityCenter(); f = (Figure)jl.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(jl, true, true)); jl.updateStyleOfDelimitors(); jl.updateGravityCenter(); jl.updateBorders(); jl.updateShape(); jl.updateBorders(new LaTeXDrawPoint2D()); jl.shift(10, 10); try { jl.shift(new LaTeXDrawPoint2D(), null); fail(); }catch(IllegalArgumentException e) { /* */} jl.addRotationAngle(10); jl.updateGravityCenter(); jl.addRotationAngle(0.3); jl.updateShape(); jl.updateStyleOfDelimitors(); jl.onClick(new Point(10,10)); jl.isIn(new LaTeXDrawPoint2D()); jl.isIn(jl.getGravityCenter()); jl.isIn(new Point()); f = (Figure)jl.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(jl, true, true)); jl.setDotSep(2); jl.setCustomizable(false); jl.setDoubleSep(2); jl.setFirstPoint(3, 3); jl.updateShape(); jl.setGradientMidPoint(0.3); jl.setGradientAngle(0.5); jl.setDoubleColor(Color.red); jl.setGradientStartColor(Color.yellow); jl.setGradientEndColor(Color.blue); jl.setHasDoubleBoundary(true); f = (Figure)jl.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(jl, true, true)); jl.setHasShadow(true); f = (Figure)jl.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(jl, true, true)); jl.setHatchingAngle(3); jl.setHatchingColor(Color.gray); jl.setHatchingSep(4); jl.setHatchingStyle(PSTricksConstants.TOKEN_FILL_HLINES); f = (Figure)jl.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(jl, true, true)); jl.setHatchingStyle(PSTricksConstants.TOKEN_FILL_GRADIENT); f = (Figure)jl.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(jl, true, true)); jl.updateShape(); jl.onRelease(); jl.onDelimitorRelease(); jl.onDragged(new Point(), new Point()); jl.createNonRotatedShape2D(); jl.createShadowShape(); jl.createShape2D(); jl.removePointAt(-1); jl.updateBorders(); jl.updateShape(); jl.removePointAt(0); jl.updateBorders(); jl.updateShape(); jl.removePointAt(0); jl.updateBorders(); jl.updateShape(); jl.setArrow1Style(PSTricksConstants.LRBRACKET_STYLE); jl.setArrow2Style(PSTricksConstants.LARROW_STYLE); jl.shift(20, 10); jl.updateShape(); jl.updateBorders(); assertNotNull(jl.getCodePSTricks(drawBorders, Figure.PPC)); } @Test public void testLine() throws Exception { Line line = new Line(false); Figure f; assertFalse(line.canBeFilled()); assertFalse(line.canBeHatched()); assertTrue(line.canHaveArrow()); assertTrue(line.canHaveShadow()); assertFalse(line.isBordersMovable()); assertTrue(line.isCustomizable()); assertTrue(line.isDashableOrDotable()); assertTrue(line.isDoubleBoundaryable()); assertTrue(line.isThicknessable()); assertTrue(line.isResizable()); f = (Figure)line.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(line, true, true)); line.updateStyleOfDelimitors(); line.updateGravityCenter(); line.updateShape(); line.shift(10, 10); try { line.shift(new LaTeXDrawPoint2D(), null); fail(); }catch(IllegalArgumentException e) { /* */} line.addRotationAngle(10); line.updateGravityCenter(); line.addRotationAngle(0.3); line.updateShape(); line.updateStyleOfDelimitors(); line.onClick(new Point(10,10)); line.isIn(new LaTeXDrawPoint2D()); line.isIn(line.getGravityCenter()); line.isIn(new Point()); f = (Figure)line.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(line, true, true)); line.setDotSep(2); line.setCustomizable(false); line.setFirstPoint(3, 3); line.updateShape(); line.setHasDoubleBoundary(true); f = (Figure)line.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(line, true, true)); line.setHasShadow(true); f = (Figure)line.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(line, true, true)); line.updateShape(); line.onRelease(); line.onDelimitorRelease(); line.onDragged(new Point(), new Point()); line.createNonRotatedShape2D(); line.createShadowShape(); line.createShape2D(); line.updateShape(); line.setArrow1Style(PSTricksConstants.LRBRACKET_STYLE); line.setArrow2Style(PSTricksConstants.LARROW_STYLE); line.shift(20, 10); line.updateAandB(); line.updateShape(); assertNotNull(line.getCodePSTricks(drawBorders, Figure.PPC)); } @Test public void testPolygon() throws Exception { LaTeXDrawPolygon pol = new LaTeXDrawPolygon(false); Figure f; assertTrue(pol.canBeFilled()); assertTrue(pol.canBeHatched()); assertFalse(pol.canHaveArrow()); assertTrue(pol.canHaveShadow()); assertFalse(pol.isBordersMovable()); assertTrue(pol.isCustomizable()); assertTrue(pol.isDashableOrDotable()); assertTrue(pol.isDoubleBoundaryable()); assertTrue(pol.isThicknessable()); assertTrue(pol.isResizable()); f = (Figure)pol.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(pol, true, true)); pol.updateBorders(); pol.updateShape(); pol.updateGravityCenter(); pol.addPoint(new LaTeXDrawPoint2D()); pol.addPoint(new LaTeXDrawPoint2D(3,3)); pol.addPoint(new LaTeXDrawPoint2D(1,3)); pol.updateBorders(); pol.updateShape(); pol.updateGravityCenter(); f = (Figure)pol.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(pol, true, true)); pol.updateStyleOfDelimitors(); pol.updateGravityCenter(); pol.updateBorders(); pol.updateShape(); pol.updateBorders(new LaTeXDrawPoint2D()); pol.shift(10, 10); try { pol.shift(new LaTeXDrawPoint2D(), null); fail(); }catch(IllegalArgumentException e) { /* */} pol.addRotationAngle(10); pol.updateGravityCenter(); pol.addRotationAngle(0.3); pol.updateShape(); pol.updateStyleOfDelimitors(); pol.onClick(new Point(10,10)); pol.isIn(new LaTeXDrawPoint2D()); pol.isIn(pol.getGravityCenter()); pol.isIn(new Point()); f = (Figure)pol.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(pol, true, true)); pol.setDotSep(2); pol.setCustomizable(false); pol.setDoubleSep(2); pol.setFirstPoint(3, 3); pol.updateShape(); pol.setGradientMidPoint(0.3); pol.setGradientAngle(0.5); pol.setDoubleColor(Color.red); pol.setGradientStartColor(Color.yellow); pol.setGradientEndColor(Color.blue); pol.setHasDoubleBoundary(true); f = (Figure)pol.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(pol, true, true)); pol.setHasShadow(true); f = (Figure)pol.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(pol, true, true)); pol.setHatchingAngle(3); pol.setHatchingColor(Color.gray); pol.setHatchingSep(4); pol.setHatchingStyle(PSTricksConstants.TOKEN_FILL_HLINES); f = (Figure)pol.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(pol, true, true)); pol.setHatchingStyle(PSTricksConstants.TOKEN_FILL_GRADIENT); f = (Figure)pol.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(pol, true, true)); pol.updateShape(); pol.onRelease(); pol.onDelimitorRelease(); pol.onDragged(new Point(), new Point()); pol.createNonRotatedShape2D(); pol.createShadowShape(); pol.createShape2D(); pol.removePointAt(-1); pol.updateBorders(); pol.updateShape(); assertNotNull(pol.getCodePSTricks(drawBorders, Figure.PPC)); pol.removePointAt(0); pol.updateBorders(); pol.updateShape(); pol.removePointAt(0); pol.updateBorders(); pol.updateShape(); assertNull(pol.getCodePSTricks(drawBorders, Figure.PPC)); } @Test public void testDot() throws Exception { Dot d = new Dot(new LaTeXDrawPoint2D(68,-876), true); Figure f; assertFalse(d.canBeFilled()); assertFalse(d.canBeHatched()); assertFalse(d.canHaveArrow()); assertFalse(d.canHaveShadow()); assertFalse(d.isBordersMovable()); assertTrue(d.isCustomizable()); assertFalse(d.isDashableOrDotable()); assertFalse(d.isDoubleBoundaryable()); assertFalse(d.isThicknessable()); assertFalse(d.isResizable()); f = (Figure)d.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(d, true, true)); d.updateStyleOfDelimitors(); d.shift(10, 10); d.updateShape(); try { d.shift(new LaTeXDrawPoint2D(), null); fail(); }catch(IllegalArgumentException e) { /* */} d.setRotationAngle(0.4); d.updateShape(); d.onClick(new Point(10,10)); d.isIn(new LaTeXDrawPoint2D()); d.isIn(d.getGravityCenter()); d.isIn(new Point()); f = (Figure)d.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(d, true, true)); d.onRelease(); d.onDelimitorRelease(); d.onDragged(new Point(), new Point()); d.createNonRotatedShape2D(); d.createShadowShape(); d.createShape2D(); d.updateShape(); assertNotNull(d.getCodePSTricks(drawBorders, Figure.PPC)); } @Test public void testAkinPoints() throws Exception { AkinPoints ak = new AkinPoints(new LaTeXDrawPoint2D(12,76), true); Figure f; assertTrue(ak.canBeFilled()); assertTrue(ak.canBeHatched()); assertFalse(ak.canHaveArrow()); assertTrue(ak.canHaveShadow()); assertFalse(ak.isBordersMovable()); assertTrue(ak.isCustomizable()); assertTrue(ak.isDashableOrDotable()); assertFalse(ak.isDoubleBoundaryable()); assertTrue(ak.isThicknessable()); assertTrue(ak.isResizable()); f = (Figure)ak.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(ak, true, true)); ak.updateBorders(); ak.updateShape(); ak.updateGravityCenter(); ak.addPoint(new LaTeXDrawPoint2D()); ak.addPoint(new LaTeXDrawPoint2D(3,3)); ak.addPoint(new LaTeXDrawPoint2D(1,3)); ak.updateBorders(); ak.updateShape(); ak.updateGravityCenter(); f = (Figure)ak.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(ak, true, true)); ak.updateStyleOfDelimitors(); ak.updateGravityCenter(); ak.updateBorders(); ak.updateShape(); ak.updateBorders(new LaTeXDrawPoint2D()); ak.shift(10, 10); try { ak.shift(new LaTeXDrawPoint2D(), null); fail(); }catch(IllegalArgumentException e) { /* */} ak.addRotationAngle(10); ak.updateGravityCenter(); ak.addRotationAngle(0.3); ak.updateShape(); ak.updateStyleOfDelimitors(); ak.onClick(new Point(10,10)); ak.isIn(new LaTeXDrawPoint2D()); ak.isIn(ak.getGravityCenter()); ak.isIn(new Point()); f = (Figure)ak.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(ak, true, true)); ak.setDotSep(2); ak.setCustomizable(false); ak.setDoubleSep(2); ak.setFirstPoint(3, 3); ak.updateShape(); ak.setGradientMidPoint(0.3); ak.setGradientAngle(0.5); ak.setDoubleColor(Color.red); ak.setGradientStartColor(Color.yellow); ak.setGradientEndColor(Color.blue); ak.setHasDoubleBoundary(true); f = (Figure)ak.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(ak, true, true)); ak.setHasShadow(true); ak.setType(AkinPoints.TYPE_LINES); ak.setInterval(30); f = (Figure)ak.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(ak, true, true)); ak.setHatchingAngle(3); ak.setHatchingColor(Color.gray); ak.setHatchingSep(4); ak.setHatchingStyle(PSTricksConstants.TOKEN_FILL_HLINES); f = (Figure)ak.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(ak, true, true)); ak.setHatchingStyle(PSTricksConstants.TOKEN_FILL_GRADIENT); f = (Figure)ak.clone(); assertNotNull(f); assertTrue(f.isParametersEquals(ak, true, true)); ak.updateShape(); ak.onRelease(); ak.onDelimitorRelease(); ak.onDragged(new Point(), new Point()); ak.createNonRotatedShape2D(); ak.createShadowShape(); ak.createShape2D(); ak.removePointAt(-1); ak.updateBorders(); ak.updateShape(); assertNotNull(ak.getCodePSTricks(drawBorders, Figure.PPC)); ak.removePointAt(0); ak.updateBorders(); ak.updateShape(); ak.removePointAt(0); ak.updateBorders(); ak.updateShape(); assertNull(ak.getCodePSTricks(drawBorders, Figure.PPC)); } } latexdraw-2.0.8+1.orig/junit/test/TestLaTeXDrawNumber.java0000644000000000000000000000425111347255510020261 0ustar /* * TestLaTeXDrawNumber.java */ package junit.test; import junit.framework.TestCase; import latexDraw.util.LaTeXDrawNumber; import org.junit.Test; /** * This class contains tests the methods of the class LaTeXDrawNumber.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 12/18/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestLaTeXDrawNumber extends TestCase { @Test public void testGetCutNumberFloat() { float value = 0.0001f; assertEquals(value, LaTeXDrawNumber.getCutNumber(value, 0.000001)); assertEquals(0f, LaTeXDrawNumber.getCutNumber(value, 0.1)); assert(LaTeXDrawNumber.getCutNumber(value, 0.00001)==0f); assert(LaTeXDrawNumber.getCutNumber(value, 0.1)==value); value = -0.001f; assertEquals(value, LaTeXDrawNumber.getCutNumber(value, 0.000001)); assertEquals(0f, LaTeXDrawNumber.getCutNumber(value, 1)); assert(LaTeXDrawNumber.getCutNumber(value, 0.00001)==0f); assert(LaTeXDrawNumber.getCutNumber(value, 0.1)==value); } @Test public void testGetCutNumberDouble() { double value = 0.0001; assertEquals(value, LaTeXDrawNumber.getCutNumber(value, 0.000001)); assertEquals(0., LaTeXDrawNumber.getCutNumber(value, 0.1)); assert(LaTeXDrawNumber.getCutNumber(value, 0.00001)==0.); assert(LaTeXDrawNumber.getCutNumber(value, 0.1)==value); value = -0.001; assertEquals(value, LaTeXDrawNumber.getCutNumber(value, 0.000001)); assertEquals(0., LaTeXDrawNumber.getCutNumber(value, 1)); assert(LaTeXDrawNumber.getCutNumber(value, 0.00001)==0.); assert(LaTeXDrawNumber.getCutNumber(value, 0.1)==value); } } latexdraw-2.0.8+1.orig/junit/test/TestCssColor.java0000644000000000000000000010054711347255510017051 0ustar /* * TestCaseColor.java */ package junit.test; import java.awt.Color; import junit.framework.TestCase; import latexDraw.parsers.svg.CSSColors; import org.junit.Test; /** * This class contains tests on CSS colours class.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 06/25/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestCssColor extends TestCase { @Test public void testGetColour() { assertEquals(CSSColors.getColor(CSSColors.CSS_ALICEBLUE_NAME), CSSColors.CSS_ALICEBLUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_ANTIQUEWHITE_NAME), CSSColors.CSS_ANTIQUEWHITE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_AQUA_NAME), CSSColors.CSS_AQUA_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_AQUAMARINE_NAME), CSSColors.CSS_AQUAMARINE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_AZURE_NAME), CSSColors.CSS_AZURE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_BEIGE_NAME), CSSColors.CSS_BEIGE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_BISQUE_NAME), CSSColors.CSS_BISQUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_BLACK_NAME), CSSColors.CSS_BLACK_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_BLANCHEDALMOND_NAME), CSSColors.CSS_BLANCHEDALMOND_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_BLUE_NAME), CSSColors.CSS_BLUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_BLUEVIOLET_NAME), CSSColors.CSS_BLUEVIOLET_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_BROWN_NAME), CSSColors.CSS_BROWN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_BURLYWOOD_NAME), CSSColors.CSS_BURLYWOOD_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_CADETBLUE_NAME), CSSColors.CSS_CADETBLUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_CHARTREUSE_NAME), CSSColors.CSS_CHARTREUSE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_CHOCOLATE_NAME), CSSColors.CSS_CHOCOLATE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_CORAL_NAME), CSSColors.CSS_CORAL_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_CORNFLOWERBLUE_NAME), CSSColors.CSS_CORNFLOWERBLUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_CORNSILK_NAME), CSSColors.CSS_CORNSILK_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_CRIMSON_NAME), CSSColors.CSS_CRIMSON_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_CYAN_NAME), CSSColors.CSS_CYAN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DARKBLUE_NAME), CSSColors.CSS_DARKBLUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DARKCYAN_NAME), CSSColors.CSS_DARKCYAN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DARKGOLDENROD_NAME), CSSColors.CSS_DARKGOLDENROD_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DARKGRAY_NAME), CSSColors.CSS_DARKGRAY_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DARKGREEN_NAME), CSSColors.CSS_DARKGREEN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DARKGREY_NAME), CSSColors.CSS_DARKGREY_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DARKKHAKI_NAME), CSSColors.CSS_DARKKHAKI_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DARKMAGENTA_NAME), CSSColors.CSS_DARKMAGENTA_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DARKOLIVEGREEN_NAME), CSSColors.CSS_DARKOLIVEGREEN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DARKORANGE_NAME), CSSColors.CSS_DARKORANGE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DARKORCHID_NAME), CSSColors.CSS_DARKORCHID_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DARKRED_NAME), CSSColors.CSS_DARKRED_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DARKSALMON_NAME), CSSColors.CSS_DARKSALMON_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DARKSEAGREEN_NAME), CSSColors.CSS_DARKSEAGREEN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DARKSLATEBLUE_NAME), CSSColors.CSS_DARKSLATEBLUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DARKSLATEGRAY_NAME), CSSColors.CSS_DARKSLATEGRAY_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DARKSLATEGREY_NAME), CSSColors.CSS_DARKSLATEGREY_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DARKTURQUOISE_NAME), CSSColors.CSS_DARKTURQUOISE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DARKVIOLET_NAME), CSSColors.CSS_DARKVIOLET_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DEEPPINK_NAME), CSSColors.CSS_DEEPPINK_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DEEPSKYBLUE_NAME), CSSColors.CSS_DEEPSKYBLUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DIMGRAY_NAME), CSSColors.CSS_DIMGRAY_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DIMGREY_NAME), CSSColors.CSS_DIMGREY_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_DODGERBLUE_NAME), CSSColors.CSS_DODGERBLUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_FIREBRICK_NAME), CSSColors.CSS_FIREBRICK_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_FLORALWHITE_NAME), CSSColors.CSS_FLORALWHITE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_FORESTGREEN_NAME), CSSColors.CSS_FORESTGREEN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_FUCHSIA_NAME), CSSColors.CSS_FUCHSIA_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_GAINSBORO_NAME), CSSColors.CSS_GAINSBORO_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_GHOSTWHITE_NAME), CSSColors.CSS_GHOSTWHITE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_GOLD_NAME), CSSColors.CSS_GOLD_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_GOLDENROD_NAME), CSSColors.CSS_GOLDENROD_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_GRAY_NAME), CSSColors.CSS_GRAY_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_GREEN_NAME), CSSColors.CSS_GREEN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_GREENYELLOW_NAME), CSSColors.CSS_GREENYELLOW_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_GREY_NAME), CSSColors.CSS_GREY_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_HONEYDEW_NAME), CSSColors.CSS_HONEYDEW_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_HOTPINK_NAME), CSSColors.CSS_HOTPINK_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_INDIGO_NAME), CSSColors.CSS_INDIGO_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_IVORY_NAME), CSSColors.CSS_IVORY_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_INDIANRED_NAME), CSSColors.CSS_INDIANRED_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_KHAKI_NAME), CSSColors.CSS_KHAKI_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LAVENDER_NAME), CSSColors.CSS_LAVENDER_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LAVENDERBLUSH_NAME), CSSColors.CSS_LAVENDERBLUSH_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LAWNGREEN_NAME), CSSColors.CSS_LAWNGREEN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LEMONCHIFFON_NAME), CSSColors.CSS_LEMONCHIFFON_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LIGHTBLUE_NAME), CSSColors.CSS_LIGHTBLUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LIGHTCORAL_NAME), CSSColors.CSS_LIGHTCORAL_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LIGHTCYAN_NAME), CSSColors.CSS_LIGHTCYAN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LIGHTGOLDENRODYELLOW_NAME), CSSColors.CSS_LIGHTGOLDENRODYELLOW_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LIGHTGRAY_NAME), CSSColors.CSS_LIGHTGRAY_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LIGHTGREEN_NAME), CSSColors.CSS_LIGHTGREEN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LIGHTGREY_NAME), CSSColors.CSS_LIGHTGREY_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LIGHTPINK_NAME), CSSColors.CSS_LIGHTPINK_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LIGHTSALMON_NAME), CSSColors.CSS_LIGHTSALMON_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LIGHTSEAGREEN_NAME), CSSColors.CSS_LIGHTSEAGREEN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LIGHTSKYBLUE_NAME), CSSColors.CSS_LIGHTSKYBLUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LIGHTSLATEGRAY_NAME), CSSColors.CSS_LIGHTSLATEGRAY_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LIGHTSLATEGREY_NAME), CSSColors.CSS_LIGHTSLATEGREY_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LIGHTSTEELBLUE_NAME), CSSColors.CSS_LIGHTSTEELBLUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LIGHTYELLOW_NAME), CSSColors.CSS_LIGHTYELLOW_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LIME_NAME), CSSColors.CSS_LIME_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_LIMEGREEN_NAME), CSSColors.CSS_LIMEGREEN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_MAGENTA_NAME), CSSColors.CSS_MAGENTA_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_MAROON_NAME), CSSColors.CSS_MAROON_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_MEDIUMAQUAMARINE_NAME), CSSColors.CSS_MEDIUMAQUAMARINE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_MEDIUMBLUE_NAME), CSSColors.CSS_MEDIUMBLUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_MEDIUMORCHID_NAME), CSSColors.CSS_MEDIUMORCHID_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_MEDIUMPURPLE_NAME), CSSColors.CSS_MEDIUMPURPLE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_MEDIUMSEAGREEN_NAME), CSSColors.CSS_MEDIUMSEAGREEN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_MEDIUMSLATEBLUE_NAME), CSSColors.CSS_MEDIUMSLATEBLUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_MEDIUMSPRINGGREEN_NAME), CSSColors.CSS_MEDIUMSPRINGGREEN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_MEDIUMTURQUOISE_NAME), CSSColors.CSS_MEDIUMTURQUOISE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_MEDIUMVIOLETRED_NAME), CSSColors.CSS_MEDIUMVIOLETRED_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_MIDNIGHTBLUE_NAME), CSSColors.CSS_MIDNIGHTBLUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_MINTCREAM_NAME), CSSColors.CSS_MINTCREAM_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_MISTYROSE_NAME), CSSColors.CSS_MISTYROSE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_MOCCASIN_NAME), CSSColors.CSS_MOCCASIN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_NAVAJOWHITE_NAME), CSSColors.CSS_NAVAJOWHITE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_NAVY_NAME), CSSColors.CSS_NAVY_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_OLDLACE_NAME), CSSColors.CSS_OLDLACE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_OLIVEDRAB_NAME), CSSColors.CSS_OLIVEDRAB_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_OLIVE_NAME), CSSColors.CSS_OLIVE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_ORANGERED_NAME), CSSColors.CSS_ORANGERED_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_ORANGE_NAME), CSSColors.CSS_ORANGE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_ORCHID_NAME), CSSColors.CSS_ORCHID_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_PALEGOLDENROD_NAME), CSSColors.CSS_PALEGOLDENROD_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_PALEGREEN_NAME), CSSColors.CSS_PALEGREEN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_PALETURQUOISE_NAME), CSSColors.CSS_PALETURQUOISE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_PALEVIOLETRED_NAME), CSSColors.CSS_PALEVIOLETRED_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_PAPAYAWHIP_NAME), CSSColors.CSS_PAPAYAWHIP_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_PEACHPUFF_NAME), CSSColors.CSS_PEACHPUFF_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_PERU_NAME), CSSColors.CSS_PERU_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_PINK_NAME), CSSColors.CSS_PINK_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_PLUM_NAME), CSSColors.CSS_PLUM_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_POWDERBLUE_NAME), CSSColors.CSS_POWDERBLUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_PURPLE_NAME), CSSColors.CSS_PURPLE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_RED_NAME), CSSColors.CSS_RED_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_ROSYBROWN_NAME), CSSColors.CSS_ROSYBROWN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_ROYALBLUE_NAME), CSSColors.CSS_ROYALBLUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_SADDLEBROWN_NAME), CSSColors.CSS_SADDLEBROWN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_SALMON_NAME), CSSColors.CSS_SALMON_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_SANDYBROWN_NAME), CSSColors.CSS_SANDYBROWN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_SEAGREEN_NAME), CSSColors.CSS_SEAGREEN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_SEASHELL_NAME), CSSColors.CSS_SEASHELL_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_SIENNA_NAME), CSSColors.CSS_SIENNA_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_SILVER_NAME), CSSColors.CSS_SILVER_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_SKYBLUE_NAME), CSSColors.CSS_SKYBLUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_SLATEBLUE_NAME), CSSColors.CSS_SLATEBLUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_SLATEGRAY_NAME), CSSColors.CSS_SLATEGRAY_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_SLATEGREY_NAME), CSSColors.CSS_SLATEGREY_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_SNOW_NAME), CSSColors.CSS_SNOW_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_SPRINGGREEN_NAME), CSSColors.CSS_SPRINGGREEN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_STEELBLUE_NAME), CSSColors.CSS_STEELBLUE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_TAN_NAME), CSSColors.CSS_TAN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_TEAL_NAME), CSSColors.CSS_TEAL_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_THISTLE_NAME), CSSColors.CSS_THISTLE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_TOMATO_NAME), CSSColors.CSS_TOMATO_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_TURQUOISE_NAME), CSSColors.CSS_TURQUOISE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_VIOLET_NAME), CSSColors.CSS_VIOLET_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_WHEAT_NAME), CSSColors.CSS_WHEAT_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_WHITESMOKE_NAME), CSSColors.CSS_WHITESMOKE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_WHITE_NAME), CSSColors.CSS_WHITE_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_YELLOWGREEN_NAME), CSSColors.CSS_YELLOWGREEN_RGB_VALUE); assertEquals(CSSColors.getColor(CSSColors.CSS_YELLOW_NAME), CSSColors.CSS_YELLOW_RGB_VALUE); assertNull(CSSColors.getColor(null)); assertNull(CSSColors.getColor("")); assertNull(CSSColors.getColor("fjdsfijsdofijdsofijertngf")); } @Test public void testGetColorName() { assertNull(CSSColors.getColorName(null, true)); assertNull(CSSColors.getColorName(new Color(3, 2, 1), false)); assertNotNull(CSSColors.getColorName(new Color(4, 2, 1), true)); assertEquals(CSSColors.getColorName(CSSColors.CSS_ALICEBLUE_RGB_VALUE, false), CSSColors.CSS_ALICEBLUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_ANTIQUEWHITE_RGB_VALUE, false), CSSColors.CSS_ANTIQUEWHITE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_AQUAMARINE_RGB_VALUE, false), CSSColors.CSS_AQUAMARINE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_AZURE_RGB_VALUE, false), CSSColors.CSS_AZURE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_BEIGE_RGB_VALUE, false), CSSColors.CSS_BEIGE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_BISQUE_RGB_VALUE, false), CSSColors.CSS_BISQUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_BLACK_RGB_VALUE, false), CSSColors.CSS_BLACK_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_BLANCHEDALMOND_RGB_VALUE, false), CSSColors.CSS_BLANCHEDALMOND_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_BLUE_RGB_VALUE, false), CSSColors.CSS_BLUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_BLUEVIOLET_RGB_VALUE, false), CSSColors.CSS_BLUEVIOLET_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_BROWN_RGB_VALUE, false), CSSColors.CSS_BROWN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_BURLYWOOD_RGB_VALUE, false), CSSColors.CSS_BURLYWOOD_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_CADETBLUE_RGB_VALUE, false), CSSColors.CSS_CADETBLUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_CHARTREUSE_RGB_VALUE, false), CSSColors.CSS_CHARTREUSE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_CHOCOLATE_RGB_VALUE, false), CSSColors.CSS_CHOCOLATE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_CORAL_RGB_VALUE, false), CSSColors.CSS_CORAL_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_CORNFLOWERBLUE_RGB_VALUE, false), CSSColors.CSS_CORNFLOWERBLUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_CORNSILK_RGB_VALUE, false), CSSColors.CSS_CORNSILK_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_CRIMSON_RGB_VALUE, false), CSSColors.CSS_CRIMSON_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_CYAN_RGB_VALUE, false), CSSColors.CSS_CYAN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DARKBLUE_RGB_VALUE, false), CSSColors.CSS_DARKBLUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DARKCYAN_RGB_VALUE, false), CSSColors.CSS_DARKCYAN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DARKGOLDENROD_RGB_VALUE, false), CSSColors.CSS_DARKGOLDENROD_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DARKGRAY_RGB_VALUE, false), CSSColors.CSS_DARKGRAY_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DARKGREEN_RGB_VALUE, false), CSSColors.CSS_DARKGREEN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DARKKHAKI_RGB_VALUE, false), CSSColors.CSS_DARKKHAKI_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DARKMAGENTA_RGB_VALUE, false), CSSColors.CSS_DARKMAGENTA_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DARKOLIVEGREEN_RGB_VALUE, false), CSSColors.CSS_DARKOLIVEGREEN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DARKORANGE_RGB_VALUE, false), CSSColors.CSS_DARKORANGE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DARKORCHID_RGB_VALUE, false), CSSColors.CSS_DARKORCHID_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DARKRED_RGB_VALUE, false), CSSColors.CSS_DARKRED_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DARKSALMON_RGB_VALUE, false), CSSColors.CSS_DARKSALMON_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DARKSEAGREEN_RGB_VALUE, false), CSSColors.CSS_DARKSEAGREEN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DARKSLATEBLUE_RGB_VALUE, false), CSSColors.CSS_DARKSLATEBLUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DARKSLATEGRAY_RGB_VALUE, false), CSSColors.CSS_DARKSLATEGRAY_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DARKTURQUOISE_RGB_VALUE, false), CSSColors.CSS_DARKTURQUOISE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DARKVIOLET_RGB_VALUE, false), CSSColors.CSS_DARKVIOLET_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DEEPPINK_RGB_VALUE, false), CSSColors.CSS_DEEPPINK_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DEEPSKYBLUE_RGB_VALUE, false), CSSColors.CSS_DEEPSKYBLUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DIMGRAY_RGB_VALUE, false), CSSColors.CSS_DIMGRAY_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_DODGERBLUE_RGB_VALUE, false), CSSColors.CSS_DODGERBLUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_FIREBRICK_RGB_VALUE, false), CSSColors.CSS_FIREBRICK_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_FLORALWHITE_RGB_VALUE, false), CSSColors.CSS_FLORALWHITE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_FORESTGREEN_RGB_VALUE, false), CSSColors.CSS_FORESTGREEN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_GAINSBORO_RGB_VALUE, false), CSSColors.CSS_GAINSBORO_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_GHOSTWHITE_RGB_VALUE, false), CSSColors.CSS_GHOSTWHITE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_GOLD_RGB_VALUE, false), CSSColors.CSS_GOLD_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_GOLDENROD_RGB_VALUE, false), CSSColors.CSS_GOLDENROD_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_GRAY_RGB_VALUE, false), CSSColors.CSS_GRAY_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_GREEN_RGB_VALUE, false), CSSColors.CSS_GREEN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_GREENYELLOW_RGB_VALUE, false), CSSColors.CSS_GREENYELLOW_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_HONEYDEW_RGB_VALUE, false), CSSColors.CSS_HONEYDEW_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_HOTPINK_RGB_VALUE, false), CSSColors.CSS_HOTPINK_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_INDIGO_RGB_VALUE, false), CSSColors.CSS_INDIGO_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_IVORY_RGB_VALUE, false), CSSColors.CSS_IVORY_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_INDIANRED_RGB_VALUE, false), CSSColors.CSS_INDIANRED_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_KHAKI_RGB_VALUE, false), CSSColors.CSS_KHAKI_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_LAVENDER_RGB_VALUE, false), CSSColors.CSS_LAVENDER_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_LAVENDERBLUSH_RGB_VALUE, false), CSSColors.CSS_LAVENDERBLUSH_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_LAWNGREEN_RGB_VALUE, false), CSSColors.CSS_LAWNGREEN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_LEMONCHIFFON_RGB_VALUE, false), CSSColors.CSS_LEMONCHIFFON_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_LIGHTBLUE_RGB_VALUE, false), CSSColors.CSS_LIGHTBLUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_LIGHTCORAL_RGB_VALUE, false), CSSColors.CSS_LIGHTCORAL_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_LIGHTCYAN_RGB_VALUE, false), CSSColors.CSS_LIGHTCYAN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_LIGHTGOLDENRODYELLOW_RGB_VALUE, false), CSSColors.CSS_LIGHTGOLDENRODYELLOW_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_LIGHTGRAY_RGB_VALUE, false), CSSColors.CSS_LIGHTGRAY_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_LIGHTGREEN_RGB_VALUE, false), CSSColors.CSS_LIGHTGREEN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_LIGHTPINK_RGB_VALUE, false), CSSColors.CSS_LIGHTPINK_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_LIGHTSALMON_RGB_VALUE, false), CSSColors.CSS_LIGHTSALMON_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_LIGHTSEAGREEN_RGB_VALUE, false), CSSColors.CSS_LIGHTSEAGREEN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_LIGHTSKYBLUE_RGB_VALUE, false), CSSColors.CSS_LIGHTSKYBLUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_LIGHTSLATEGRAY_RGB_VALUE, false), CSSColors.CSS_LIGHTSLATEGRAY_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_LIGHTSTEELBLUE_RGB_VALUE, false), CSSColors.CSS_LIGHTSTEELBLUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_LIGHTYELLOW_RGB_VALUE, false), CSSColors.CSS_LIGHTYELLOW_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_LIME_RGB_VALUE, false), CSSColors.CSS_LIME_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_LIMEGREEN_RGB_VALUE, false), CSSColors.CSS_LIMEGREEN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_MAGENTA_RGB_VALUE, false), CSSColors.CSS_MAGENTA_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_MAROON_RGB_VALUE, false), CSSColors.CSS_MAROON_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_MEDIUMAQUAMARINE_RGB_VALUE, false), CSSColors.CSS_MEDIUMAQUAMARINE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_MEDIUMBLUE_RGB_VALUE, false), CSSColors.CSS_MEDIUMBLUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_MEDIUMORCHID_RGB_VALUE, false), CSSColors.CSS_MEDIUMORCHID_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_MEDIUMPURPLE_RGB_VALUE, false), CSSColors.CSS_MEDIUMPURPLE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_MEDIUMSEAGREEN_RGB_VALUE, false), CSSColors.CSS_MEDIUMSEAGREEN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_MEDIUMSLATEBLUE_RGB_VALUE, false), CSSColors.CSS_MEDIUMSLATEBLUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_MEDIUMSPRINGGREEN_RGB_VALUE, false), CSSColors.CSS_MEDIUMSPRINGGREEN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_MEDIUMTURQUOISE_RGB_VALUE, false), CSSColors.CSS_MEDIUMTURQUOISE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_MEDIUMVIOLETRED_RGB_VALUE, false), CSSColors.CSS_MEDIUMVIOLETRED_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_MIDNIGHTBLUE_RGB_VALUE, false), CSSColors.CSS_MIDNIGHTBLUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_MINTCREAM_RGB_VALUE, false), CSSColors.CSS_MINTCREAM_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_MISTYROSE_RGB_VALUE, false), CSSColors.CSS_MISTYROSE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_MOCCASIN_RGB_VALUE, false), CSSColors.CSS_MOCCASIN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_NAVAJOWHITE_RGB_VALUE, false), CSSColors.CSS_NAVAJOWHITE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_NAVY_RGB_VALUE, false), CSSColors.CSS_NAVY_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_OLDLACE_RGB_VALUE, false), CSSColors.CSS_OLDLACE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_OLIVEDRAB_RGB_VALUE, false), CSSColors.CSS_OLIVEDRAB_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_OLIVE_RGB_VALUE, false), CSSColors.CSS_OLIVE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_ORANGERED_RGB_VALUE, false), CSSColors.CSS_ORANGERED_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_ORANGE_RGB_VALUE, false), CSSColors.CSS_ORANGE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_ORCHID_RGB_VALUE, false), CSSColors.CSS_ORCHID_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_PALEGOLDENROD_RGB_VALUE, false), CSSColors.CSS_PALEGOLDENROD_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_PALEGREEN_RGB_VALUE, false), CSSColors.CSS_PALEGREEN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_PALETURQUOISE_RGB_VALUE, false), CSSColors.CSS_PALETURQUOISE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_PALEVIOLETRED_RGB_VALUE, false), CSSColors.CSS_PALEVIOLETRED_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_PAPAYAWHIP_RGB_VALUE, false), CSSColors.CSS_PAPAYAWHIP_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_PEACHPUFF_RGB_VALUE, false), CSSColors.CSS_PEACHPUFF_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_PERU_RGB_VALUE, false), CSSColors.CSS_PERU_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_PINK_RGB_VALUE, false), CSSColors.CSS_PINK_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_PLUM_RGB_VALUE, false), CSSColors.CSS_PLUM_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_POWDERBLUE_RGB_VALUE, false), CSSColors.CSS_POWDERBLUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_PURPLE_RGB_VALUE, false), CSSColors.CSS_PURPLE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_RED_RGB_VALUE, false), CSSColors.CSS_RED_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_ROSYBROWN_RGB_VALUE, false), CSSColors.CSS_ROSYBROWN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_ROYALBLUE_RGB_VALUE, false), CSSColors.CSS_ROYALBLUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_SADDLEBROWN_RGB_VALUE, false), CSSColors.CSS_SADDLEBROWN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_SALMON_RGB_VALUE, false), CSSColors.CSS_SALMON_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_SANDYBROWN_RGB_VALUE, false), CSSColors.CSS_SANDYBROWN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_SEAGREEN_RGB_VALUE, false), CSSColors.CSS_SEAGREEN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_SEASHELL_RGB_VALUE, false), CSSColors.CSS_SEASHELL_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_SIENNA_RGB_VALUE, false), CSSColors.CSS_SIENNA_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_SILVER_RGB_VALUE, false), CSSColors.CSS_SILVER_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_SKYBLUE_RGB_VALUE, false), CSSColors.CSS_SKYBLUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_SLATEBLUE_RGB_VALUE, false), CSSColors.CSS_SLATEBLUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_SLATEGRAY_RGB_VALUE, false), CSSColors.CSS_SLATEGRAY_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_SNOW_RGB_VALUE, false), CSSColors.CSS_SNOW_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_SPRINGGREEN_RGB_VALUE, false), CSSColors.CSS_SPRINGGREEN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_STEELBLUE_RGB_VALUE, false), CSSColors.CSS_STEELBLUE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_TAN_RGB_VALUE, false), CSSColors.CSS_TAN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_TEAL_RGB_VALUE, false), CSSColors.CSS_TEAL_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_THISTLE_RGB_VALUE, false), CSSColors.CSS_THISTLE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_TOMATO_RGB_VALUE, false), CSSColors.CSS_TOMATO_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_TURQUOISE_RGB_VALUE, false), CSSColors.CSS_TURQUOISE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_VIOLET_RGB_VALUE, false), CSSColors.CSS_VIOLET_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_WHEAT_RGB_VALUE, false), CSSColors.CSS_WHEAT_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_WHITESMOKE_RGB_VALUE, false), CSSColors.CSS_WHITESMOKE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_WHITE_RGB_VALUE, false), CSSColors.CSS_WHITE_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_YELLOWGREEN_RGB_VALUE, false), CSSColors.CSS_YELLOWGREEN_NAME); assertEquals(CSSColors.getColorName(CSSColors.CSS_YELLOW_RGB_VALUE, false), CSSColors.CSS_YELLOW_NAME); } @Test public void testGetRGBColour() { assertNull(CSSColors.getRGBColour(null)); assertNull(CSSColors.getRGBColour("")); assertNull(CSSColors.getRGBColour("dsqdqsdgfhfdsfs")); assertNull(CSSColors.getRGBColour("#12")); assertNull(CSSColors.getRGBColour("#DHS78EZ7DS")); assertEquals(CSSColors.getRGBColour("#580"), new Color(85, 136, 0)); assertEquals(CSSColors.getRGBColour("#ff1493"), CSSColors.CSS_DEEPPINK_RGB_VALUE); assertEquals(CSSColors.getRGBColour("blue"), CSSColors.CSS_BLUE_RGB_VALUE); assertEquals(CSSColors.CSS_BLUE_RGB_VALUE, CSSColors.getRGBColour("rgb( 0% , 0% , 100% )")); assertEquals(CSSColors.CSS_BLUE_RGB_VALUE, CSSColors.getRGBColour("rgb( 0 , 0 , 255 )")); } @Test public void testSVGRGBtoRGB() { assertNull(CSSColors.SVGRGBtoRGB(null)); assertNull(CSSColors.SVGRGBtoRGB("")); assertNull(CSSColors.SVGRGBtoRGB("dsfdgdui")); assertNull(CSSColors.SVGRGBtoRGB("rgbdf")); assertNull(CSSColors.SVGRGBtoRGB("rgb()")); assertNull(CSSColors.SVGRGBtoRGB("rgb(")); assertNull(CSSColors.SVGRGBtoRGB("rgb(a, b, c)")); assertNull(CSSColors.SVGRGBtoRGB("rgb(12, 76, )")); assertNull(CSSColors.SVGRGBtoRGB("rgb(12, )")); assertNull(CSSColors.SVGRGBtoRGB("rgb(,,)")); assertNull(CSSColors.SVGRGBtoRGB("rgb(123,12,98,98)")); assertNull(CSSColors.SVGRGBtoRGB("rgb(98721,-12,0987)")); assertNull(CSSColors.SVGRGBtoRGB("rgb(0%,0,0%)")); assertEquals(CSSColors.CSS_BLUE_RGB_VALUE, CSSColors.SVGRGBtoRGB("rgb(0,0,255)")); assertEquals(CSSColors.CSS_BLUE_RGB_VALUE, CSSColors.SVGRGBtoRGB("rgb( 0 , 0 , 255 )")); assertEquals(CSSColors.CSS_BLUE_RGB_VALUE, CSSColors.SVGRGBtoRGB("rgb( 0% , 0% , 100% )")); } } latexdraw-2.0.8+1.orig/junit/test/TestColorButton.java0000644000000000000000000000265111347255510017571 0ustar /* * TestColorButton.java */ package junit.test; import java.awt.Color; import junit.framework.TestCase; import latexDraw.ui.components.ButtonIcon; import latexDraw.ui.components.ColorButton; import org.junit.Before; import org.junit.Test; /** * This class contains tests on the class ColorButton.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 06/26/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestColorButton extends TestCase { private ColorButton cb1; private ColorButton cb2; private final Color c = new Color(100, 100, 100); @Override @Before public void setUp() { ButtonIcon bi = new ButtonIcon(c); cb1 = new ColorButton("coucou"); cb2 = new ColorButton(bi); assertEquals(c, cb2.getColor()); } @Test public void testGetSetColor() { cb2.setColor(c); assertEquals(c, cb2.getColor()); assertNull(cb1.getColor()); } } latexdraw-2.0.8+1.orig/junit/test/TestAbstractPstricksParser.java0000644000000000000000000005507711347255510021774 0ustar /* * TestAbstractPstricksParser.java */ package junit.test; import java.awt.Color; import java.awt.geom.Point2D; import junit.framework.TestCase; import latexDraw.parsers.pstricks.PSTricksParserActionsManager; import latexDraw.psTricks.DviPsColors; import latexDraw.psTricks.PSTricksConstants; import org.junit.Test; /** * This class contains tests to PSTricks parser.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 12/18/06
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ @SuppressWarnings("nls") public class TestAbstractPstricksParser extends TestCase { @Test public void testGoToNextChar() throws Exception { int[] i = {0}; String str = "\n \t \n \t .dsq";//$NON-NLS-1$ PSTricksParserActionsManager.goToNextChar(str, i); assertEquals(str.charAt(i[0]), '.'); } @Test public void testConvertCm() throws Exception { assertEquals(PSTricksParserActionsManager.convertInCm(10., "cm"),10.);//$NON-NLS-1$ assertEquals(PSTricksParserActionsManager.convertInCm(10., "in"),10.*PSTricksConstants.INCH_VAL_CM);//$NON-NLS-1$ assertEquals(PSTricksParserActionsManager.convertInCm(10., "pt"),10./PSTricksConstants.CM_VAL_PT);//$NON-NLS-1$ assertEquals(PSTricksParserActionsManager.convertInCm(10., "mm"),1.);//$NON-NLS-1$ assertEquals(PSTricksParserActionsManager.convertInCm(10., null),10.); assertEquals(PSTricksParserActionsManager.convertInCm(10., ""),10.);//$NON-NLS-1$ try { PSTricksParserActionsManager.convertInCm(10., "sddsq"); //$NON-NLS-1$ fail("testConvertCm");//$NON-NLS-1$ } catch(Exception e) { /**/} } @Test public void testReadOneCoord() throws Exception { PSTricksParserActionsManager.readOneCoordinate("(1,2)", 0, 0, true);//$NON-NLS-1$ PSTricksParserActionsManager.readOneCoordinate("(1,)", 0, 0, true); //$NON-NLS-1$ PSTricksParserActionsManager.readOneCoordinate("(,2)", 0, 0, true); //$NON-NLS-1$ PSTricksParserActionsManager.readOneCoordinate("(,)", 0, 0, true); //$NON-NLS-1$ PSTricksParserActionsManager.readOneCoordinate("(\n , \n 2)", 0, 0, true);//$NON-NLS-1$ PSTricksParserActionsManager.readOneCoordinate("(-0.1,0.2)", 0, 0, true); //$NON-NLS-1$ Point2D.Double pt = PSTricksParserActionsManager.readOneCoordinate("(-0.1,0.2)", 0, 0, true);//$NON-NLS-1$ assertEquals(-0.1, pt.x); assertEquals(0.2 , pt.y); pt = PSTricksParserActionsManager.readOneCoordinate("(+1,)", 0, 0, true);//$NON-NLS-1$ assertEquals(1., pt.x); assertEquals(Double.NaN, pt.y); } @Test public void testReadEqualInteger() throws Exception { int id[] = {0}; assertEquals(PSTricksParserActionsManager.readEqualInteger(id, "=10"), 10);//$NON-NLS-1$ id[0] = 0; assertEquals(PSTricksParserActionsManager.readEqualInteger(id, "=+10"), 10);//$NON-NLS-1$ id[0] = 0; assertEquals(PSTricksParserActionsManager.readEqualInteger(id, "=+++++10"), 10);//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualInteger(id, "=10");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualInteger(id, " = \n 2");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualInteger(id, " = 2");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualInteger(id, "=20erzrfd");//$NON-NLS-1$ try { int id2[] = {-1}; PSTricksParserActionsManager.readEqualInteger(id2, "=10");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} try { int id2[] = {3}; PSTricksParserActionsManager.readEqualInteger(id2, "=10");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualInteger(id, "10");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualInteger(id, "==10");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualInteger(id, "==-10");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualInteger(id, "=--10");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualInteger(id, "=-1-0");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualInteger(id, "= ");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualInteger(id, null); fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualInteger(id, "");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualInteger(id, "= ezrezr");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} } @Test public void testReadEqualReal() throws Exception { int id[] = {0}; assertEquals(PSTricksParserActionsManager.readEqualReal(id, "=++-+--+-10"), 10.);//$NON-NLS-1$ id[0] = 0; assertEquals(PSTricksParserActionsManager.readEqualReal(id, "=10"), 10.);//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualReal(id, "=10");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualReal(id, "=0.2");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualReal(id, "=.2");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualReal(id, " = \n 0.2");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualReal(id, " = .2");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualReal(id, "=-.2");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualReal(id, "=-2");//$NON-NLS-1$ try { int id2[] = {-1}; PSTricksParserActionsManager.readEqualReal(id2, "=10");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} try { int id2[] = {3}; PSTricksParserActionsManager.readEqualReal(id2, "=10");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualReal(id, "10");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualReal(id, "==10");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualReal(id, "==-10");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualReal(id, "=-1-0");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualReal(id, "=..10");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualReal(id, "=.1.0");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualReal(id, "= ");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualReal(id, null); fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualReal(id, "");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} } @Test public void testReadEqualRealUnit() throws Exception { int id[] = {0}; assertEquals(PSTricksParserActionsManager.readEqualRealUnit(id, "=10"), 10.);//$NON-NLS-1$ id[0] = 0; assertEquals(PSTricksParserActionsManager.readEqualRealUnit(id, "=10cm"), 10.);//$NON-NLS-1$ id[0] = 0; assertEquals(PSTricksParserActionsManager.readEqualRealUnit(id, "=10mm"), 1.);//$NON-NLS-1$ id[0] = 0; assertEquals(PSTricksParserActionsManager.readEqualRealUnit(id, "=10 pt"), 10./PSTricksConstants.CM_VAL_PT);//$NON-NLS-1$ id[0] = 0; assertEquals(PSTricksParserActionsManager.readEqualRealUnit(id, "=10in"), 10.*PSTricksConstants.INCH_VAL_CM);//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualRealUnit(id, "=10 pt");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualRealUnit(id, "=10 cm");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualRealUnit(id, "=10 mm");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualRealUnit(id, "=10 in");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualRealUnit(id, "=0.2 pt");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualRealUnit(id, "=.2 pt");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualRealUnit(id, " = 0.2\n pt");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualRealUnit(id, " = .2");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualRealUnit(id, "=.2");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualRealUnit(id, "=-.2");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualRealUnit(id, "=-2");//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readEqualRealUnit(id, "=4");//$NON-NLS-1$ try { int id2[] = {-1}; PSTricksParserActionsManager.readEqualRealUnit(id2, "=10 pt");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} try { int id2[] = {3}; PSTricksParserActionsManager.readEqualRealUnit(id2, "=10 pt");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualRealUnit(id, "10 pt");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualRealUnit(id, "==10 pt");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualRealUnit(id, "==-10 pt");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualRealUnit(id, "=-1-0 pt");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualRealUnit(id, "=..10 pt");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualRealUnit(id, "=.1.0 pt");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualRealUnit(id, "= cm ");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualRealUnit(id, "==10 dsd");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualRealUnit(id, null); fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readEqualRealUnit(id, "");//$NON-NLS-1$ fail("testReadEqualRealUnit");//$NON-NLS-1$ }catch(Exception e) { /* */} } @Test public void testReadRealUnit() throws Exception { int id[] = {0}; assertEquals(PSTricksParserActionsManager.readRealUnit(id, ".5", true), .5);//$NON-NLS-1$ id[0] = 0; assertEquals(PSTricksParserActionsManager.readRealUnit(id, "10", true), 10.);//$NON-NLS-1$ id[0] = 0; assertEquals(PSTricksParserActionsManager.readRealUnit(id, "10cm", true), 10.);//$NON-NLS-1$ id[0] = 0; assertEquals(PSTricksParserActionsManager.readRealUnit(id, "10mm", false), 1.);//$NON-NLS-1$ id[0] = 0; assertEquals(PSTricksParserActionsManager.readRealUnit(id, "10 pt", true), 10./PSTricksConstants.CM_VAL_PT);//$NON-NLS-1$ id[0] = 0; assertEquals(PSTricksParserActionsManager.readRealUnit(id, "10in", true), 10.*PSTricksConstants.INCH_VAL_CM);//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readRealUnit(id, "10 pt", true);//$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readRealUnit(id, "10 cm", false); //$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readRealUnit(id, "10 mm", true); //$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readRealUnit(id, "=0 in", false); //$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readRealUnit(id, "0.2 pt", true); //$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readRealUnit(id, ".2 pt", true); //$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readRealUnit(id, " 0.2\n pt", true); //$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readRealUnit(id, " .2", true); //$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readRealUnit(id, ".2", true); //$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readRealUnit(id, "-.2", true); //$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readRealUnit(id, "-2", true); //$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readRealUnit(id, "4", true); //$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readRealUnit(id, "++--+++---+4", true); //$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readRealUnit(id, "+++4", true); //$NON-NLS-1$ id[0] = 0; PSTricksParserActionsManager.readRealUnit(id, "---4", true); //$NON-NLS-1$ try { int id2[] = {-1}; PSTricksParserActionsManager.readRealUnit(id2, "10 pt", true); //$NON-NLS-1$ fail("testReadEqualRealUnit"); //$NON-NLS-1$ }catch(Exception e) { /* */} try { int id2[] = {3}; PSTricksParserActionsManager.readRealUnit(id2, "10 pt", true); //$NON-NLS-1$ fail("testReadEqualRealUnit"); //$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readRealUnit(id, "-1-0 pt", true); //$NON-NLS-1$ fail("testReadEqualRealUnit"); //$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readRealUnit(id, "..10 pt", true); //$NON-NLS-1$ fail("testReadEqualRealUnit"); //$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readRealUnit(id, ".1.0 pt", true); //$NON-NLS-1$ fail("testReadEqualRealUnit"); //$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readRealUnit(id, " cm ", true); //$NON-NLS-1$ fail("testReadEqualRealUnit"); //$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readRealUnit(id, null, true); fail("testReadEqualRealUnit"); //$NON-NLS-1$ }catch(Exception e) { /* */} id[0] = 0; try { PSTricksParserActionsManager.readRealUnit(id, "", true); //$NON-NLS-1$ fail("testReadEqualRealUnit"); //$NON-NLS-1$ }catch(Exception e) { /* */} } @Test public void testParseNewrgbcolorParameters() { try { PSTricksParserActionsManager.parseNewrgbcolorParameters(null); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewrgbcolorParameters(" "); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewrgbcolorParameters("newrgbcolor{name}{1 1 1}"); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewrgbcolorParameters("{rgbColourTest}{1 1 0}"); assertEquals(DviPsColors.getColour("rgbColourTest"), new Color(255, 255, 0)); } catch(Exception e) { fail(); } try { PSTricksParserActionsManager.parseNewrgbcolorParameters("{ \nrgbColourTest\n }\n { 1 \n \t 1 \n0 \n }"); assertEquals(DviPsColors.getColour("rgbColourTest"), new Color(255, 255, 0)); } catch(Exception e) { fail(); } try { PSTricksParserActionsManager.parseNewrgbcolorParameters("{rgbColourTest}{0.5, 0.5, 0.5}"); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewrgbcolorParameters("{test rgbColourTest}{0.5 0.5 0.5}"); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewrgbcolorParameters("{0.1234}{0.5 0.5 0.5}"); fail(); } catch(Exception e) { /* Good */ } } @Test public void testParseNewcmykcolorParameters() { try { PSTricksParserActionsManager.parseNewcmykcolorParameters(null); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewcmykcolorParameters(" "); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewcmykcolorParameters("newcmykcolor{name}{1 1 1 1}"); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewcmykcolorParameters("{cmykColourTest}{0.5 0.1 0.3 0.6}"); assertEquals(DviPsColors.getColour("cmykColourTest"), new Color(51, 92, 71)); } catch(Exception e) { fail(); } try { PSTricksParserActionsManager.parseNewcmykcolorParameters("{ \ncmykColourTest\n }\n { 0.5 \n \t 0.1 \n0.3 \n 0.6}"); assertEquals(DviPsColors.getColour("cmykColourTest"), new Color(51, 92, 71)); } catch(Exception e) { fail(); } try { PSTricksParserActionsManager.parseNewcmykcolorParameters("{cmykColourTest}{0.5, 0.5, 0.5cm 1t}"); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewcmykcolorParameters("{test cmykColourTest}{0.5 0.5 0.5 1}"); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewcmykcolorParameters("{0.1234}{0.5 0.5 0.5 1}"); fail(); } catch(Exception e) { /* Good */ } } @Test public void testParseNewhsbcolorParameters() { try { PSTricksParserActionsManager.parseNewhsbcolorParameters(null); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewhsbcolorParameters(" "); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewhsbcolorParameters("newhsbcolor{name}{1 1 1}"); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewhsbcolorParameters("{hsbColourTest}{1 1 0}"); assertEquals(DviPsColors.getColour("hsbColourTest"), Color.getHSBColor(1, 1, 0)); } catch(Exception e) { fail(); } try { PSTricksParserActionsManager.parseNewhsbcolorParameters("{ \nhsbColourTest\n }\n { 1 \n \t 1 \n0 \n }"); assertEquals(DviPsColors.getColour("hsbColourTest"), Color.getHSBColor(1, 1, 0)); } catch(Exception e) { fail(); } try { PSTricksParserActionsManager.parseNewhsbcolorParameters("{hsbColourTest}{0.5, 0.5, 0.5}"); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewhsbcolorParameters("{test hsbColourTest}{0.5 0.5 0.5}"); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewhsbcolorParameters("{0.1234}{0.5 0.5 0.5}"); fail(); } catch(Exception e) { /* Good */ } } @Test public void testParseNewgrayParameters() { try { PSTricksParserActionsManager.parseNewgrayParameters(null); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewgrayParameters(" "); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewgrayParameters("newgray{name}{1 1 1}"); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewgrayParameters("{grayColourTest}{0.5}"); assertEquals(DviPsColors.getColour("grayColourTest"), new Color(128, 128, 128)); } catch(Exception e) { fail(); } try { PSTricksParserActionsManager.parseNewgrayParameters("{ \ngrayColourTest\n }\n { \t \n 0.5 \r}"); assertEquals(DviPsColors.getColour("grayColourTest"), new Color(128, 128, 128)); } catch(Exception e) { fail(); } try { PSTricksParserActionsManager.parseNewgrayParameters("{grayColourTest}{0.5cm}"); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewgrayParameters("{test grayColourTest}{0.5}"); fail(); } catch(Exception e) { /* Good */ } try { PSTricksParserActionsManager.parseNewgrayParameters("{0.1234}{0.5}"); fail(); } catch(Exception e) { /* Good */ } } @Test public void testIsCharToIgnore() { assertTrue(PSTricksParserActionsManager.isCharToIgnore(' ')); assertTrue(PSTricksParserActionsManager.isCharToIgnore('\t')); assertTrue(PSTricksParserActionsManager.isCharToIgnore('\n')); assertTrue(PSTricksParserActionsManager.isCharToIgnore('\r')); assertFalse(PSTricksParserActionsManager.isCharToIgnore('1')); assertFalse(PSTricksParserActionsManager.isCharToIgnore('a')); assertFalse(PSTricksParserActionsManager.isCharToIgnore('&')); assertFalse(PSTricksParserActionsManager.isCharToIgnore('M')); } } latexdraw-2.0.8+1.orig/junit/test/TestResources.java0000644000000000000000000002616111347255510017273 0ustar /* * TestRessources */ package junit.test; import java.net.URL; import javax.swing.ImageIcon; import junit.framework.TestCase; import org.junit.Test; /** * This class contains tests the ressources.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 02/14/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestResources extends TestCase { @Test public void testRessources() { assertNotNull(loadImageIcon("/res/LaTeXDrawIcon.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/LaTeXDrawSmall.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/emblem-important.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/help-browser.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/comment.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/preferences-desktop-theme.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/preferences-system.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/New.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/hatch/hatch.none.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/hatch/hatch.vert.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/hatch/hatch.horiz.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/hatch/hatch.cross.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.arc.left.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.arc.right.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.arc.r.left.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.arc.r.right.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.arrow.left.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.arrow.right.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.barEnd.left.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.barEnd.right.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.barIn.left.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.barIn.right.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.bracket.left.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.bracket.right.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.bracket.r.left.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.bracket.r.right.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.circle.end.left.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.circle.end.right.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.circle.in.left.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.circle.in.right.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.dbleArrow.left.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.dbleArrow.right.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.disk.end.left.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.disk.end.right.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.disk.in.left.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.disk.in.right.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.none.left.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.none.right.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.rarrow.left.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.rarrow.right.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.rdbleArrow.left.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.rdbleArrow.right.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.roundIn.left.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/arrowStyles/line.roundIn.right.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/dotStyles/dot.asterisk.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/dotStyles/dot.none.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/dotStyles/dot.bar.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/dotStyles/dot.o.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/dotStyles/dot.cross.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/dotStyles/dot.diamond.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/dotStyles/dot.diamondF.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/dotStyles/dot.ocross.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/dotStyles/dot.oplus.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/dotStyles/dot.pentagon.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/dotStyles/dot.pentagonF.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/dotStyles/dot.plus.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/dotStyles/dot.square.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/dotStyles/dot.squareF.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/dotStyles/dot.triangle.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/dotStyles/dot.triangleF.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/lineStyles/lineStyle.none.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/lineStyles/lineStyle.dashed.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/lineStyles/lineStyle.dotted.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/doubleBoundary/double.boundary.middle.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/doubleBoundary/double.boundary.inner.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/doubleBoundary/double.boundary.outer.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/grid.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/Copy.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/Paste.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/Cut.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/Draw.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/text.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/polygon.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/rotation.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/InFrontSelect.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/behindSelect.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/background.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/foreground.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/Undo.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/Redo.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/Magnify.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/MagnifyPlus.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/MagnifyMinus.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/wedge.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/Arc.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/document-open.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/document-save.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/document-save-as.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/circle.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/del.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/dot.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/ellipse.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/empty.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/line.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/rectangle.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/rhombus.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/select.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/square.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/triangle.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/Print.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/Object.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/AutoBorders.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/go-next.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/join.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/separate.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/view-refresh.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/bezierCurve.png"));//$NON-NLS-1$ assertNotNull(loadImageIcon("/res/chord.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/CopySel.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/go-previous.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/joinedLines.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/ok.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/emblem-unreadable.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/list-add.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/list-remove.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/stop.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/image-x-generic.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/thickness.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/hatch/gradient.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/displayGrid.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/rotation180.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/rotation90.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/rotation270.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/mirrorH.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/mirrorV.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/axes.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/texEditor.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/delimitor.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/freehand/curve.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/freehand/line.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/BezierCurves/closeCurve.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/BezierCurves/closeLine.png")); //$NON-NLS-1$ assertNotNull(loadImageIcon("/res/closedBezier.png")); //$NON-NLS-1$ } public ImageIcon loadImageIcon(String path) { URL url; try { url = getClass().getResource(path); if(url==null) return null; return new ImageIcon(url); }catch(Exception e) { return null; } } } latexdraw-2.0.8+1.orig/junit/test/parser/0000755000000000000000000000000011347255510015104 5ustar latexdraw-2.0.8+1.orig/junit/test/parser/svg/0000755000000000000000000000000011347255510015703 5ustar latexdraw-2.0.8+1.orig/junit/test/parser/svg/parsers/0000755000000000000000000000000011347255510017362 5ustar latexdraw-2.0.8+1.orig/junit/test/parser/svg/parsers/TestURIReferenceParser.java0000644000000000000000000000217611347255510024526 0ustar package junit.test.parser.svg.parsers; import junit.framework.TestCase; import latexDraw.parsers.svg.parsers.URIReferenceParser; import org.junit.Test; @SuppressWarnings("nls") public class TestURIReferenceParser extends TestCase { @Test public void testConstructor() { try { new URIReferenceParser(null); fail(); } catch(IllegalArgumentException e) { /* */ } new URIReferenceParser("test"); } @Test public void testGetURI() { URIReferenceParser p = new URIReferenceParser("url(#id)"); assertEquals(p.getURI(), "id"); p.setCode(""); assertEquals(p.getURI(), ""); p.setCode("url(#id"); assertEquals(p.getURI(), ""); p.setCode("url#id)"); assertEquals(p.getURI(), ""); p.setCode("url(id)"); assertEquals(p.getURI(), ""); p.setCode(null); assertEquals(p.getURI(), ""); p.setCode("u"); assertEquals(p.getURI(), ""); p.setCode("ur"); assertEquals(p.getURI(), ""); p.setCode("url"); assertEquals(p.getURI(), ""); p.setCode("url("); assertEquals(p.getURI(), ""); p.setCode("url()"); assertEquals(p.getURI(), ""); p.setCode("url(#)"); assertEquals(p.getURI(), ""); } } latexdraw-2.0.8+1.orig/junit/test/parser/svg/parsers/TestSVGLengthParser.java0000644000000000000000000002030511347255510024043 0ustar package junit.test.parser.svg.parsers; import java.text.ParseException; import junit.framework.TestCase; import latexDraw.parsers.svg.SVGLength; import latexDraw.parsers.svg.parsers.SVGLengthParser; import latexDraw.parsers.svg.parsers.UnitProcessor; import org.junit.Test; /** * Tests the class SVGLengthParser.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/24/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1
    */ @SuppressWarnings("nls") public class TestSVGLengthParser extends TestCase { @Test public void testParseLength() { SVGLengthParser p; SVGLength l; try { new SVGLengthParser(null); fail(); } catch(IllegalArgumentException e){ /* */ } try { p = new SVGLengthParser(""); l = p.parseLength(); fail(); } catch(ParseException e){ /* */ } try { p = new SVGLengthParser("1m"); l = p.parseLength(); fail(); } catch(ParseException e){ /* */ } try { p = new SVGLengthParser("m"); l = p.parseLength(); fail(); } catch(ParseException e){ /* */ } try { p = new SVGLengthParser("1p"); l = p.parseLength(); fail(); } catch(ParseException e){ /* */ } try { p = new SVGLengthParser("1e1i"); l = p.parseLength(); fail(); } catch(ParseException e){ /* */ } try { p = new SVGLengthParser("1ci"); l = p.parseLength(); fail(); } catch(ParseException e){ /* */ } try { p = new SVGLengthParser("1 c "); l = p.parseLength(); fail(); } catch(ParseException e){ /* */ } try { p = new SVGLengthParser("1mm"); l = p.parseLength(); assertEquals(l.getValueAsString(), "1"); assertEquals(l.getLengthType(), SVGLength.LengthType.MM); assertEquals(UnitProcessor.toUserUnit(1, SVGLength.LengthType.MM), l.getValue()); } catch(ParseException e){ fail(); } try { p = new SVGLengthParser("0.65 cm"); l = p.parseLength(); assertEquals(l.getValueAsString(), "0.65"); assertEquals(l.getLengthType(), SVGLength.LengthType.CM); assertEquals(UnitProcessor.toUserUnit(0.65, SVGLength.LengthType.CM), l.getValue()); } catch(ParseException e){ fail(); } try { p = new SVGLengthParser("\t -10.65 \t \n pc"); l = p.parseLength(); assertEquals(l.getValueAsString(), "-10.65"); assertEquals(l.getLengthType(), SVGLength.LengthType.PC); assertEquals(UnitProcessor.toUserUnit(-10.65, SVGLength.LengthType.PC), l.getValue()); } catch(ParseException e){ fail(); } try { p = new SVGLengthParser("\t -10.65e2 \t \n px \t "); l = p.parseLength(); assertEquals(l.getValueAsString(), "-10.65e2"); assertEquals(l.getLengthType(), SVGLength.LengthType.PX); assertEquals(UnitProcessor.toUserUnit(-10.65e2, SVGLength.LengthType.PX), l.getValue()); } catch(ParseException e){ fail(); } try { p = new SVGLengthParser("\t -10.65e0pt \t "); l = p.parseLength(); assertEquals(l.getValueAsString(), "-10.65e0"); assertEquals(l.getLengthType(), SVGLength.LengthType.PT); assertEquals(UnitProcessor.toUserUnit(-10.65e0, SVGLength.LengthType.PT), l.getValue()); } catch(ParseException e){ fail(); } try { p = new SVGLengthParser("\t -1.in \t "); l = p.parseLength(); assertEquals(l.getValueAsString(), "-1."); assertEquals(l.getLengthType(), SVGLength.LengthType.IN); assertEquals(UnitProcessor.toUserUnit(-1., SVGLength.LengthType.IN), l.getValue()); } catch(ParseException e){ fail(); } try { p = new SVGLengthParser("-1."); l = p.parseLength(); assertEquals(l.getValueAsString(), "-1."); assertEquals(l.getLengthType(), SVGLength.LengthType.NUMBER); assertEquals(UnitProcessor.toUserUnit(-1., SVGLength.LengthType.NUMBER), l.getValue()); } catch(ParseException e){ fail(); } } @Test public void testParseNumberOrPercent() { SVGLengthParser p; SVGLength l; try { p = new SVGLengthParser("1mm"); l = p.parseNumberOrPercent(); assertEquals(l.getValueAsString(), "1"); assertEquals(l.getLengthType(), SVGLength.LengthType.NUMBER); assertEquals(UnitProcessor.toUserUnit(1, SVGLength.LengthType.NUMBER), l.getValue()); } catch(ParseException e){ fail(); } try { p = new SVGLengthParser("0.876"); l = p.parseNumberOrPercent(); assertEquals(l.getValueAsString(), "0.876"); assertEquals(l.getLengthType(), SVGLength.LengthType.NUMBER); assertEquals(UnitProcessor.toUserUnit(0.876, SVGLength.LengthType.NUMBER), l.getValue()); } catch(ParseException e){ fail(); } } @Test public void testParseCoordinate() { SVGLengthParser p; SVGLength l; try { p = new SVGLengthParser(""); l = p.parseCoordinate(); fail(); } catch(ParseException e){ /* */ } try { p = new SVGLengthParser("1m"); l = p.parseCoordinate(); fail(); } catch(ParseException e){ /* */ } try { p = new SVGLengthParser("m"); l = p.parseCoordinate(); fail(); } catch(ParseException e){ /* */ } try { p = new SVGLengthParser("1p"); l = p.parseCoordinate(); fail(); } catch(ParseException e){ /* */ } try { p = new SVGLengthParser("1e1i"); l = p.parseCoordinate(); fail(); } catch(ParseException e){ /* */ } try { p = new SVGLengthParser("1ci"); l = p.parseCoordinate(); fail(); } catch(ParseException e){ /* */ } try { p = new SVGLengthParser("1 c "); l = p.parseCoordinate(); fail(); } catch(ParseException e){ /* */ } try { p = new SVGLengthParser("1mm"); l = p.parseCoordinate(); assertEquals(l.getValueAsString(), "1"); assertEquals(l.getLengthType(), SVGLength.LengthType.MM); assertEquals(UnitProcessor.toUserUnit(1, SVGLength.LengthType.MM), l.getValue()); } catch(ParseException e){ fail(); } try { p = new SVGLengthParser("0.65 cm"); l = p.parseCoordinate(); assertEquals(l.getValueAsString(), "0.65"); assertEquals(l.getLengthType(), SVGLength.LengthType.CM); assertEquals(UnitProcessor.toUserUnit(0.65, SVGLength.LengthType.CM), l.getValue()); } catch(ParseException e){ fail(); } try { p = new SVGLengthParser("\t -10.65 \t \n pc"); l = p.parseCoordinate(); assertEquals(l.getValueAsString(), "-10.65"); assertEquals(l.getLengthType(), SVGLength.LengthType.PC); assertEquals(UnitProcessor.toUserUnit(-10.65, SVGLength.LengthType.PC), l.getValue()); } catch(ParseException e){ fail(); } try { p = new SVGLengthParser("\t -10.65e2 \t \n px \t "); l = p.parseCoordinate(); assertEquals(l.getValueAsString(), "-10.65e2"); assertEquals(l.getLengthType(), SVGLength.LengthType.PX); assertEquals(UnitProcessor.toUserUnit(-10.65e2, SVGLength.LengthType.PX), l.getValue()); } catch(ParseException e){ fail(); } try { p = new SVGLengthParser("\t -10.65e0pt \t "); l = p.parseCoordinate(); assertEquals(l.getValueAsString(), "-10.65e0"); assertEquals(l.getLengthType(), SVGLength.LengthType.PT); assertEquals(UnitProcessor.toUserUnit(-10.65e0, SVGLength.LengthType.PT), l.getValue()); } catch(ParseException e){ fail(); } try { p = new SVGLengthParser("\t -1.in \t "); l = p.parseCoordinate(); assertEquals(l.getValueAsString(), "-1."); assertEquals(l.getLengthType(), SVGLength.LengthType.IN); assertEquals(UnitProcessor.toUserUnit(-1., SVGLength.LengthType.IN), l.getValue()); } catch(ParseException e){ fail(); } try { p = new SVGLengthParser("-1."); l = p.parseCoordinate(); assertEquals(l.getValueAsString(), "-1."); assertEquals(l.getLengthType(), SVGLength.LengthType.NUMBER); assertEquals(UnitProcessor.toUserUnit(-1., SVGLength.LengthType.NUMBER), l.getValue()); } catch(ParseException e){ fail(); } } } latexdraw-2.0.8+1.orig/junit/test/parser/svg/parsers/TestSVGPointsParser.java0000644000000000000000000001126411347255510024102 0ustar package junit.test.parser.svg.parsers; import java.awt.geom.Point2D; import java.text.ParseException; import junit.test.parser.TestCodeParser; import latexDraw.parsers.svg.parsers.SVGPointsParser; import org.junit.Before; public class TestSVGPointsParser extends TestCodeParser { @Override @Before public void setUp() { parser = new SVGPointsParser(""); parser2 = new SVGPointsParser(""); } @Override public void testParse() { try { parser.setCode(" 1, 2, \t 3\n 4 \r ,5 6 \n \t "); parser.parse(); assertNotNull(((SVGPointsParser)parser).getPoints()); assertEquals(((SVGPointsParser)parser).getPoints().firstElement(), new Point2D.Double(1., 2.)); assertEquals(((SVGPointsParser)parser).getPoints().elementAt(1), new Point2D.Double(3., 4.)); assertEquals(((SVGPointsParser)parser).getPoints().lastElement(), new Point2D.Double(5., 6.)); } catch(ParseException e) { fail(); } try { parser.setCode("dsf"); parser.parse(); }catch(ParseException e) { /* */ } try { parser.setCode("10 10 10"); parser.parse(); }catch(ParseException e) { /* */ } try { parser.setCode("10,, 10 10 10"); parser.parse(); }catch(ParseException e) { /* */ } try { parser.setCode(",10 10 10 10"); parser.parse(); }catch(ParseException e) { /* */ } try { parser.setCode("10 10 10,"); parser.parse(); }catch(ParseException e) { /* */ } try { parser.setCode("10 10 aa 10"); parser.parse(); }catch(ParseException e) { /* */ } try { parser.setCode("10 10 10e 10"); parser.parse(); }catch(ParseException e) { /* */ } try { parser.setCode("10 10E 10 10"); parser.parse(); }catch(ParseException e) { /* */ } } @Override public void testSkipComment() { // No comment allowed. } @Override public void testSkipWSP() { parser.setCode(" \r \t \n 10 10"); parser.skipWSP(); assertEquals(parser.getChar(), '1'); } public void testIsWSP() { parser.setCode(" \r\t\na"); assertTrue(parser.isWSP()); parser.nextChar(); assertTrue(parser.isWSP()); parser.nextChar(); assertTrue(parser.isWSP()); parser.nextChar(); assertTrue(parser.isWSP()); parser.nextChar(); assertFalse(parser.isWSP()); parser.nextChar(); assertFalse(parser.isWSP()); } public void testSkipWSPComma() { parser.setCode(" \r , \t \n 10 10"); ((SVGPointsParser)parser).skipWSPComma(); assertEquals(parser.getChar(), '1'); parser.setCode(" \r , \t \n , 10 10"); ((SVGPointsParser)parser).skipWSPComma(); assertEquals(parser.getChar(), ','); } public void testReadNumber() { SVGPointsParser p = (SVGPointsParser)parser; try { p.setCode("10"); assertEquals(p.readNumber(), 10.); p.setCode("+10"); assertEquals(p.readNumber(), 10.); p.setCode("-10"); assertEquals(p.readNumber(), -10.); p.setCode("-10."); assertEquals(p.readNumber(), -10.); p.setCode("-.1"); assertEquals(p.readNumber(), -.1); p.setCode("10e2"); assertEquals(p.readNumber(), 1000.); p.setCode("10e-2"); assertEquals(p.readNumber(), 0.1); p.setCode("10e+2"); assertEquals(p.readNumber(), 1000.); p.setCode("10E2"); assertEquals(p.readNumber(), 1000.); p.setCode("10E-2"); assertEquals(p.readNumber(), 0.1); p.setCode("10E+2"); assertEquals(p.readNumber(), 1000.); p.setCode("0.E+2"); assertEquals(p.readNumber(), 0.); } catch(ParseException e) { e.printStackTrace(); fail(); } try { p.setCode(".E+2"); assertEquals(p.readNumber(), 0.); } catch(ParseException e) { /* */} try { p.setCode(".Efd+2"); assertEquals(p.readNumber(), 0.); } catch(ParseException e) { /* */} try { p.setCode(""); assertEquals(p.readNumber(), 0.); } catch(ParseException e) { /* */} try { p.setCode(" \t"); assertEquals(p.readNumber(), 0.); } catch(ParseException e) { /* */} try { p.setCode("aa"); assertEquals(p.readNumber(), 0.); } catch(ParseException e) { /* */} try { p.setCode("."); assertEquals(p.readNumber(), 0.); } catch(ParseException e) { /* */} try { p.setCode("--10"); assertEquals(p.readNumber(), 0.); } catch(ParseException e) { /* */} try { p.setCode("+-10"); assertEquals(p.readNumber(), 0.); } catch(ParseException e) { /* */} } public void testGetPoints() { try { parser.setCode(" 1, 2,3 4 5,6"); parser.parse(); assertNotNull(((SVGPointsParser)parser).getPoints()); assertEquals(((SVGPointsParser)parser).getPoints().firstElement(), new Point2D.Double(1., 2.)); assertEquals(((SVGPointsParser)parser).getPoints().elementAt(1), new Point2D.Double(3., 4.)); assertEquals(((SVGPointsParser)parser).getPoints().lastElement(), new Point2D.Double(5., 6.)); } catch(ParseException e) { fail(); } } } latexdraw-2.0.8+1.orig/junit/test/parser/svg/parsers/TestUnitProcessor.java0000644000000000000000000000270511347255510023710 0ustar package junit.test.parser.svg.parsers; import junit.framework.TestCase; import latexDraw.parsers.svg.SVGLength; import latexDraw.parsers.svg.parsers.UnitProcessor; import org.junit.Test; /** * Tests the class UnitProcessor.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 10/24/07
    * @author Arnaud BLOUIN
    * @version 0.1
    * @since 0.1
    */ public class TestUnitProcessor extends TestCase { @Test public void testToUserUnit() { try { UnitProcessor.toUserUnit(1, null); fail(); } catch(IllegalArgumentException e){ /* */ } assertEquals(UnitProcessor.toUserUnit(1., SVGLength.LengthType.CM), 35.43307); assertEquals(UnitProcessor.toUserUnit(1., SVGLength.LengthType.MM), 3.543307); assertEquals(UnitProcessor.toUserUnit(1., SVGLength.LengthType.PT), 1.25); assertEquals(UnitProcessor.toUserUnit(1., SVGLength.LengthType.PC), 15.); assertEquals(UnitProcessor.toUserUnit(1., SVGLength.LengthType.IN), 90.); } } latexdraw-2.0.8+1.orig/junit/test/parser/svg/parsers/TestCSSStyleParser.java0000644000000000000000000000576111347255510023724 0ustar package junit.test.parser.svg.parsers; import java.text.ParseException; import junit.test.parser.TestCodeParser; import latexDraw.parsers.svg.parsers.CSSStyleHandler; import latexDraw.parsers.svg.parsers.CSSStyleParser; import org.junit.Before; public class TestCSSStyleParser extends TestCodeParser implements CSSStyleHandler { protected String name; protected String value; @Override @Before public void setUp() { parser = new CSSStyleParser("", this); parser2 = new CSSStyleParser("", this); } @Override public void testParse() { try { name = null; value = null; parser.setCode(""); parser.parse(); assertNull(name); assertNull(value); }catch(ParseException e) {fail();} try { name = null; value = null; parser.setCode("\t \n/**/ \n\r \t /* fldijfsd */ \n"); parser.parse(); assertNull(name); assertNull(value); }catch(ParseException e) {fail();} try { parser.setCode("stroke\t \n/**/ :\n\r \t red/* fldijfsd */ \n"); parser.parse(); assertEquals(name, "stroke"); assertEquals(value, "red"); }catch(ParseException e) {fail();} try { parser.setCode("stroke\t \n/**/ :\n\r \t red/* fldijfsd */ ;\nstroke-width : 2cm"); parser.parse(); assertEquals(name, "stroke-width"); assertEquals(value, "2cm"); }catch(ParseException e) {fail();} } @Override public void testSkipComment() { try { parser.setCode("fill:/*test*/green"); parser.parse(); assertEquals(name, "fill"); assertEquals(value, "green"); }catch(ParseException e) {fail();} try { parser.setCode(" /* fksduh fdssd \n \t fdsf d */ stroke : blue"); parser.parse(); assertEquals(name, "stroke"); assertEquals(value, "blue"); }catch(ParseException e) {fail();} try { parser.setCode("fill:green /* fkdhf fss */ "); parser.parse(); assertEquals(name, "fill"); assertEquals(value, "green"); }catch(ParseException e) {fail();} try { parser.setCode("stroke: /**/ blue "); parser.parse(); assertEquals(name, "stroke"); assertEquals(value, "blue"); }catch(ParseException e) {fail();} try { parser.setCode("stroke:/**/blue;"); parser.parse(); assertEquals(name, "stroke"); assertEquals(value, "blue"); }catch(ParseException e) {fail();} try { parser.setCode("fill:green /* fkdhf fss */;/*f*/stroke/*fds fsd*/:/**/blue/*fgdds */"); parser.parse(); assertEquals(name, "stroke"); assertEquals(value, "blue"); }catch(ParseException e) {fail();} } @Override public void testSkipWSP() { try { parser.setCode("fill:green ;stroke:blue"); parser.parse(); assertEquals(name, "stroke"); assertEquals(value, "blue"); }catch(ParseException e) {fail();} try { parser.setCode(" \n \t \r stroke\t\n \r: \r \t\n blue \r\t \n \t ;\t\t\n\r fill\t\r :\n green \r \t "); parser.parse(); assertEquals(name, "fill"); assertEquals(value, "green"); }catch(ParseException e) {fail();} } public void onCSSStyle(String n, String v) { name = n; value = v; } } latexdraw-2.0.8+1.orig/junit/test/parser/TestLPSTParser.java0000644000000000000000000000075111347255510020551 0ustar package junit.test.parser; import junit.test.parser.pst.TestPSTParser; import latexDraw.parsers.latexdraw.LPSTParser; import org.junit.Before; public class TestLPSTParser extends TestPSTParser { @Override @Before public void setUp() { parser = new LPSTParser(""); parser2 = new LPSTParser(""); } public void testGetShapes() { assertNotNull(((LPSTParser)parser).getShapes()); } @Override public void testParse() { // TODO Auto-generated method stub } } latexdraw-2.0.8+1.orig/junit/test/parser/TestCodeParser.java0000644000000000000000000001073311347255510020642 0ustar package junit.test.parser; import junit.framework.TestCase; import latexDraw.parsers.CodeParser; public abstract class TestCodeParser extends TestCase { protected CodeParser parser; protected CodeParser parser2; public void testInitialise() { parser.setPosition(10); parser.initialise(); assertTrue(parser.getPosition()==0); } public void testGetCharAt() { parser.setCode("test"); assertEquals(CodeParser.EOC, parser.getCharAt(-2)); assertEquals(CodeParser.EOC, parser.getCharAt(10)); assertEquals(CodeParser.EOC, parser.getCharAt(4)); assertEquals('t', parser.getCharAt(0)); assertEquals('e', parser.getCharAt(1)); assertEquals('s', parser.getCharAt(2)); assertEquals('t', parser.getCharAt(3)); } public void testGetCode() { String code = "this is my code"; parser.setCode(code); assertEquals(parser.getCode(), code); code = ""; parser.setCode(code); assertEquals(parser.getCode(), code); } public void testSetCode() { String code = "a piece of code"; parser.setPosition(10); parser.setCode(code); assertTrue(parser.getPosition()==0); parser.setCode(null); assertEquals(parser.getCode(), code); } public void testNextChar() { parser.setCode("code"); assertTrue(parser.nextChar()=='o'); assertTrue(parser.nextChar()=='d'); assertTrue(parser.nextChar()=='e'); assertTrue(parser.nextChar()==CodeParser.EOC); assertTrue(parser.nextChar()==CodeParser.EOC); assertTrue(parser.nextChar()==CodeParser.EOC); parser.setPosition(20); assertTrue(parser.nextChar()==CodeParser.EOC); } public void testGetChar() { parser.setCode("my code"); assertTrue(parser.getChar()=='m'); parser.setPosition(1); assertTrue(parser.getChar()=='y'); parser.setPosition(2); assertTrue(parser.getChar()==' '); parser.setPosition(10); assertTrue(parser.getChar()==CodeParser.EOC); } public void testIsEOC() { parser.setCode(""); assertTrue(parser.isEOC()); parser.setCode("aa"); assertFalse(parser.isEOC()); parser.nextChar(); assertFalse(parser.isEOC()); parser.nextChar(); assertTrue(parser.isEOC()); parser.setPosition(100); assertTrue(parser.isEOC()); } public void testGetPosition() { parser.initialise(); assertTrue(parser.getPosition()==0); parser.setPosition(10); assertTrue(parser.getPosition()==10); parser.setPosition(100); assertTrue(parser.getPosition()==100); } public abstract void testSkipComment(); public abstract void testSkipWSP(); public abstract void testParse(); public void testIsEOL() { parser.setCode(""); assertFalse(parser.isEOL()); parser.setCode("a"); assertFalse(parser.isEOL()); parser.nextChar(); assertFalse(parser.isEOL()); parser.setCode("a\n"); assertFalse(parser.isEOL()); parser.nextChar(); assertTrue(parser.isEOL()); parser.setCode("a\r"); assertFalse(parser.isEOL()); parser.nextChar(); assertTrue(parser.isEOL()); parser.setCode("a\r\n"); assertFalse(parser.isEOL()); parser.nextChar(); assertTrue(parser.isEOL()); assertTrue(parser.getPosition()==2); } public void testSetPosition() { parser.setCode(""); parser.setPosition(10); assertEquals(10, parser.getPosition()); parser.setPosition(-1); assertEquals(10, parser.getPosition()); parser.setPosition(Integer.MAX_VALUE); assertEquals(Integer.MAX_VALUE, parser.getPosition()); parser.setPosition(Integer.MIN_VALUE); assertEquals(Integer.MAX_VALUE, parser.getPosition()); } public void testIncLinePosition() { parser.setLinePosition(1); parser.incLinePosition(); assertEquals(2, parser.getLinePosition()); parser.incLinePosition(); assertEquals(3, parser.getLinePosition()); parser.incLinePosition(); assertEquals(4, parser.getLinePosition()); } public void testSetLinePosition() { parser.setLinePosition(10); assertEquals(10, parser.getLinePosition()); parser.setLinePosition(0); assertEquals(10, parser.getLinePosition()); parser.setLinePosition(-10); assertEquals(10, parser.getLinePosition()); parser.setLinePosition(20); assertEquals(20, parser.getLinePosition()); parser.setLinePosition(Integer.MIN_VALUE); assertEquals(20, parser.getLinePosition()); parser.setLinePosition(Integer.MAX_VALUE); assertEquals(Integer.MAX_VALUE, parser.getLinePosition()); } public void testGetCoreCode() { assertNotNull(parser.getCodeCore()); } public void testSetCodeCore() { parser2.setCodeCore(parser.getCodeCore()); assertEquals(parser2.getCodeCore(), parser.getCodeCore()); } } latexdraw-2.0.8+1.orig/junit/test/parser/latexdraw/0000755000000000000000000000000011347255510017077 5ustar latexdraw-2.0.8+1.orig/junit/test/parser/pst/0000755000000000000000000000000011347255510015712 5ustar latexdraw-2.0.8+1.orig/junit/test/parser/pst/TestPSTParametersParser.java0000644000000000000000000006074011347255510023273 0ustar package junit.test.parser.pst; import java.awt.Color; import junit.test.parser.TestCodeParser; import latexDraw.parsers.pst.PSTParameters; import latexDraw.parsers.pst.PSTParametersParser; import latexDraw.psTricks.DviPsColors; import latexDraw.psTricks.PSTricksConstants; import org.junit.Before; public class TestPSTParametersParser extends TestCodeParser { @Override @Before public void setUp() { parser = new PSTParametersParser("", null); parser2 = new PSTParametersParser("", null); } @Override public void testParse() { try { PSTParametersParser pars = (PSTParametersParser)parser; PSTParameters param = new PSTParameters(); pars.setParam(param); pars.setCode(""); pars.parse(); try { pars.setCode(" ["); pars.parse(); fail(); }catch(Exception e) { e.printStackTrace(); } pars.setCode("[ ]"); pars.parse(); pars.setCode("[]"); pars.parse(); pars.setCode("]"); pars.parse(); pars.setCode("[%comment\n]"); pars.parse(); pars.setCode("[ \n \t ]"); pars.parse(); pars.setCode("[linewidth=0.2, linewwidth=0.2]"); pars.parse(); pars.setCode("[linewidth=0.2 linewwidth=0.2]"); pars.parse(); pars.setCode("[linewidth=0.2, , linecolor=red]"); pars.parse(); assertEquals(Color.RED, param.lineColor); pars.setCode("[linewidth=0.2,linewidth=5]"); pars.parse(); assertEquals(5., param.lineWidth); pars.setCode("[,]"); pars.parse(); pars.setCode("[=2]"); pars.parse(); pars.setCode("[fldsjf=fdsf]"); pars.parse(); pars.setCode("[fldsjf=]"); pars.parse(); pars.setCode("[fldsjf=,]"); pars.parse(); pars.setCode("[=,dfs]"); pars.parse(); parse_linewidth(param); parse_doubleline(param); parse_linecolor(param); parse_boxsep(param); parse_dotsep(param); parse_doublesep(param); parse_doublecolor(param); parse_dimen(param); parse_dash(param); parse_fillcolor(param); parse_fillstyle(param); parse_framearc(param); parse_framesep(param); parse_gradbegin(param); parse_gradend(param); parse_gradlines(param); parse_gradmidpoint(param); parse_gradangle(param); parse_gangle(param); parse_hatchangle(param); parse_hatchwidth(param); parse_hatchsep(param); parse_hatchcolor(param); parse_linestyle(param); parse_shadowsize(param); parse_shadowangle(param); parse_shadowcolor(param); }catch(Exception e) { fail(); } } private void parse_shadowcolor(PSTParameters param) { try { Color c = new Color(120,110,120); DviPsColors.addUserColour(c, "mycol4"); parser.setCode("[shadowcolor \t=\t white]"); parser.parse(); assertEquals(Color.WHITE, param.shadowCol); parser.setCode("[shadowcolor\r=\nmycol4]"); parser.parse(); assertEquals(c, param.shadowCol); parser.setCode("[shadowcolor\t=\tfdsfds]"); parser.parse(); assertEquals(c, param.shadowCol); parser.setCode("[shadowcolor\r=]"); parser.parse(); assertEquals(c, param.shadowCol); parser.setCode("[shadowcolor%dfsfds\n\t\r]"); parser.parse(); assertEquals(c, param.shadowCol); }catch(Exception e) { fail(); } } private void parse_shadowangle(PSTParameters param) { try { parser.setCode("[shadowangle \t % fds \n \t %dfsf\n \t =\t\n\r.4]"); parser.parse(); assertEquals(.4, param.shadowAngle); parser.setCode("[shadowangle%dsq\n=\t0.8]"); parser.parse(); assertEquals(.8, param.shadowAngle); parser.setCode("[shadowangle=20..]"); parser.parse(); assertEquals(0.8, param.shadowAngle); parser.setCode("[shadowangle\t=%dsq\n-20]"); parser.parse(); assertEquals(-20., param.shadowAngle); parser.setCode("[shadowangle=-.2]"); parser.parse(); assertEquals(-.2, param.shadowAngle); parser.setCode("[shadowangle\t=\t---+--0.40]"); parser.parse(); assertEquals(-.4, param.shadowAngle); parser.setCode("[shadowangle\t=\t+++--+0.80]"); parser.parse(); assertEquals(.8, param.shadowAngle); }catch(Exception e) { fail(); } } private void parse_shadowsize(PSTParameters param) { try { parser.setCode("[shadowsize\t=\t \r\n.4]"); parser.parse(); assertEquals(.4, param.shadowSize); parser.setCode("[shadowsize= .8\r\n\tcm]"); parser.parse(); assertEquals(.8, param.shadowSize); parser.setCode("[shadowsize=2 cm\t]"); parser.parse(); assertEquals(2., param.shadowSize); parser.setCode("[shadowsize\r%fdsf\n=\n\t 2.2%comment\r cm]"); parser.parse(); assertEquals(2.2, param.shadowSize); parser.setCode("[shadowsize=2 in]"); parser.parse(); assertEquals(2.*PSTricksConstants.INCH_VAL_CM, param.shadowSize); parser.setCode("[%fdfsd\n shadowsize =2pt ]"); parser.parse(); assertEquals(2./PSTricksConstants.CM_VAL_PT, param.shadowSize); parser.setCode("[shadowsize = 2mm]"); parser.parse(); assertEquals(0.2, param.shadowSize); }catch(Exception e) { fail(); } } private void parse_linestyle(PSTParameters param) { try { parser.setCode("[linestyle = test]"); parser.parse(); assertEquals("test", param.lineStyle); parser.setCode("[linestyle =]"); parser.parse(); assertEquals("test", param.lineStyle); parser.setCode("[linestyle =%fdsf\n]"); parser.parse(); assertEquals("test", param.lineStyle); parser.setCode("[linestyle =1289K3]"); parser.parse(); assertEquals("test", param.lineStyle); parser.setCode("[linestyle =0.3]"); parser.parse(); assertEquals("test", param.lineStyle); parser.setCode("[linestyle\t=\taa]"); parser.parse(); assertEquals("aa", param.lineStyle); }catch(Exception e) { fail(); } } private void parse_hatchcolor(PSTParameters param) { try { Color c = new Color(120,110,110); DviPsColors.addUserColour(c, "mycol3"); parser.setCode("[hatchcolor \t=\t white]"); parser.parse(); assertEquals(Color.WHITE, param.hatchCol); parser.setCode("[hatchcolor\r=\nmycol3]"); parser.parse(); assertEquals(c, param.hatchCol); parser.setCode("[hatchcolor\t=\tfdsfds]"); parser.parse(); assertEquals(c, param.hatchCol); parser.setCode("[hatchcolor\r=]"); parser.parse(); assertEquals(c, param.hatchCol); parser.setCode("[hatchcolor%dfsfds\n\t\r]"); parser.parse(); assertEquals(c, param.hatchCol); }catch(Exception e) { fail(); } } private void parse_hatchsep(PSTParameters param) { try { parser.setCode("[hatchsep\t=\t \r\n.4]"); parser.parse(); assertEquals(.4, param.hatchSep); parser.setCode("[hatchsep= .8\r\n\tcm]"); parser.parse(); assertEquals(.8, param.hatchSep); parser.setCode("[hatchsep=2 cm\t]"); parser.parse(); assertEquals(2., param.hatchSep); parser.setCode("[hatchsep\r%fdsf\n=\n\t 2.2%comment\r cm]"); parser.parse(); assertEquals(2.2, param.hatchSep); parser.setCode("[hatchsep=2 in]"); parser.parse(); assertEquals(2.*PSTricksConstants.INCH_VAL_CM, param.hatchSep); parser.setCode("[hatchsep = 2 pt ]"); parser.parse(); assertEquals(2./PSTricksConstants.CM_VAL_PT, param.hatchSep); parser.setCode("[hatchsep = 2mm]"); parser.parse(); assertEquals(0.2, param.hatchWidth); }catch(Exception e) { fail(); } } private void parse_hatchwidth(PSTParameters param) { try { parser.setCode("[hatchwidth\t=\t \r\n.4]"); parser.parse(); assertEquals(.4, param.hatchWidth); parser.setCode("[hatchwidth= .8\r\ncm]"); parser.parse(); assertEquals(.8, param.hatchWidth); parser.setCode("[hatchwidth=2 cm]"); parser.parse(); assertEquals(2., param.hatchWidth); parser.setCode("[hatchwidth\r%fdsf\n=\n\t 2.2%comment\r cm]"); parser.parse(); assertEquals(2.2, param.hatchWidth); parser.setCode("[hatchwidth=2 in]"); parser.parse(); assertEquals(2.*PSTricksConstants.INCH_VAL_CM, param.hatchWidth); parser.setCode("[hatchwidth = 2 pt ]"); parser.parse(); assertEquals(2./PSTricksConstants.CM_VAL_PT, param.hatchWidth); parser.setCode("[hatchwidth = 2mm]"); parser.parse(); assertEquals(0.2, param.hatchWidth); }catch(Exception e) { fail(); } } private void parse_hatchangle(PSTParameters param) { try { parser.setCode("[hatchangle \t % fds \n \t %dfsf\n \t =\t\n\r.4]"); parser.parse(); assertEquals(.4, param.hatchAngle); parser.setCode("[hatchangle%dsq\n=\t0.8]"); parser.parse(); assertEquals(.8, param.hatchAngle); parser.setCode("[hatchangle=20..]"); parser.parse(); assertEquals(0.8, param.hatchAngle); parser.setCode("[hatchangle\t=%dsq\n-20]"); parser.parse(); assertEquals(-20., param.hatchAngle); parser.setCode("[hatchangle=-.2]"); parser.parse(); assertEquals(-.2, param.hatchAngle); parser.setCode("[hatchangle\t=\t---+--0.40]"); parser.parse(); assertEquals(-.4, param.hatchAngle); parser.setCode("[hatchangle\t=\t+++--+0.80]"); parser.parse(); assertEquals(.8, param.hatchAngle); }catch(Exception e) { fail(); } } private void parse_gangle(PSTParameters param) { try { parser.setCode("[gangle \t % fds \n \t %dfsf\n \t =\t\n\r.4]"); parser.parse(); assertEquals(.4, param.gangle); parser.setCode("[gangle%dsq\n=0.8]"); parser.parse(); assertEquals(.8, param.gangle); parser.setCode("[gangle=20..]"); parser.parse(); assertEquals(0.8, param.gangle); parser.setCode("[gangle\t=%dsq\n-20]"); parser.parse(); assertEquals(-20., param.gangle); parser.setCode("[gangle=-.2]"); parser.parse(); assertEquals(-.2, param.gangle); parser.setCode("[gangle\t=\t---+--0.40]"); parser.parse(); assertEquals(-.4, param.gangle); parser.setCode("[gangle\t=\t+++--+0.80]"); parser.parse(); assertEquals(.8, param.gangle); }catch(Exception e) { fail(); } } private void parse_gradangle(PSTParameters param) { try { parser.setCode("[gradangle\t% fds \r %fdsfsd\n \t %dfsf\n \t =\t\n\r.4]"); parser.parse(); assertEquals(.4, param.gradAngle); parser.setCode("[gradangle%dsq\n=0.8]"); parser.parse(); assertEquals(.8, param.gradAngle); parser.setCode("[gradangle=20]"); parser.parse(); assertEquals(20., param.gradAngle); parser.setCode("[gradangle\t=%dsq\n-20]"); parser.parse(); assertEquals(-20., param.gradAngle); parser.setCode("[gradangle=-.2]"); parser.parse(); assertEquals(-.2, param.gradAngle); parser.setCode("[gradangle\t=\t---0.40]"); parser.parse(); assertEquals(-.4, param.gradAngle); parser.setCode("[gradangle\t=\t+0.80]"); parser.parse(); assertEquals(.8, param.gradAngle); }catch(Exception e) { fail(); } } private void parse_gradmidpoint(PSTParameters param) { try { parser.setCode("[gradmidpoint\t% fds \r %fdsfsd\n \t %dfsf\n \t =\t\n\r.4]"); parser.parse(); assertEquals(.4, param.gradMidPoint); parser.setCode("[gradmidpoint=0.8]"); parser.parse(); assertEquals(.8, param.gradMidPoint); parser.setCode("[gradmidpoint=2]"); parser.parse(); assertEquals(0.8, param.gradMidPoint); parser.setCode("[gradmidpoint=20]"); parser.parse(); assertEquals(0.8, param.gradMidPoint); parser.setCode("[gradmidpoint=-2]"); parser.parse(); assertEquals(0.8, param.gradMidPoint); parser.setCode("[gradmidpoint\t=\t0.5]"); parser.parse(); assertEquals(0.5, param.gradMidPoint); }catch(Exception e) { fail(); } } private void parse_gradlines(PSTParameters param) { try { parser.setCode("[gradlines\t=\t4]"); parser.parse(); assertEquals(4, param.gradLines); parser.setCode("[gradlines=.8]"); parser.parse(); assertEquals(4, param.gradLines); parser.setCode("[gradlines=2]"); parser.parse(); assertEquals(2, param.gradLines); parser.setCode("[gradlines\t=\t1.4]"); parser.parse(); assertEquals(1, param.gradLines); }catch(Exception e) { fail(); } } private void parse_gradend(PSTParameters param) { try { Color c = new Color(110,110,110); DviPsColors.addUserColour(c, "mycol2"); parser.setCode("[gradend \t=\t white]"); parser.parse(); assertEquals(Color.WHITE, param.gradEnd); parser.setCode("[gradend\r=\nmycol2]"); parser.parse(); assertEquals(c, param.gradEnd); parser.setCode("[gradend=fdsfds]"); parser.parse(); assertEquals(c, param.gradEnd); parser.setCode("[gradend=]"); parser.parse(); assertEquals(c, param.gradEnd); parser.setCode("[gradend%dfsfds\n\t\r]"); parser.parse(); assertEquals(c, param.gradEnd); }catch(Exception e) { fail(); } } private void parse_gradbegin(PSTParameters param) { try { Color c = new Color(100,100,100); DviPsColors.addUserColour(c, "mycol"); parser.setCode("[gradbegin \t=\t white]"); parser.parse(); assertEquals(Color.WHITE, param.gradBegin); parser.setCode("[gradbegin %fdsf\r= \n mycol]"); parser.parse(); assertEquals(c, param.gradBegin); parser.setCode("[gradbegin=fdsfds]"); parser.parse(); assertEquals(c, param.gradBegin); parser.setCode("[gradbegin=]"); parser.parse(); assertEquals(c, param.gradBegin); parser.setCode("[gradbegin%dfsfds\n\t\r]"); parser.parse(); assertEquals(c, param.gradBegin); }catch(Exception e) { fail(); } } private void parse_framearc(PSTParameters param) { try { parser.setCode("[framearc\t=\t.4]"); parser.parse(); assertEquals(.4, param.frameArc); parser.setCode("[framearc=0.8]"); parser.parse(); assertEquals(.8, param.frameArc); parser.setCode("[framearc=2]"); parser.parse(); assertEquals(2., param.frameArc); parser.setCode("[framearc\t=\t4]"); parser.parse(); assertEquals(4., param.frameArc); }catch(Exception e) { fail(); } } private void parse_framesep(PSTParameters param) { try { parser.setCode("[framesep\t=\t \r\n.4]"); parser.parse(); assertEquals(.4, param.frameSep); parser.setCode("[framesep= .8\r\ncm]"); parser.parse(); assertEquals(.8, param.frameSep); parser.setCode("[framesep=2 cm]"); parser.parse(); assertEquals(2., param.frameSep); parser.setCode("[framesep\r%fdsf\n=\n\t 2.2%comment\r cm]"); parser.parse(); assertEquals(2.2, param.frameSep); parser.setCode("[framesep=2 in]"); parser.parse(); assertEquals(2.*PSTricksConstants.INCH_VAL_CM, param.frameSep); parser.setCode("[framesep = 2 pt ]"); parser.parse(); assertEquals(2./PSTricksConstants.CM_VAL_PT, param.frameSep); parser.setCode("[framesep = 2mm]"); parser.parse(); assertEquals(0.2, param.frameSep); }catch(Exception e) { fail(); } } private void parse_fillcolor(PSTParameters param) { try { parser.setCode("[fillcolor=green]"); parser.parse(); assertEquals(Color.GREEN, param.fillColor); parser.setCode("[\n\r\t fillcolor\t%fdsf\r=\ncyan]"); parser.parse(); assertEquals(Color.CYAN, param.fillColor); parser.setCode("[fillcolor=fdsfds]"); parser.parse(); assertEquals(Color.CYAN, param.fillColor); parser.setCode("[fillcolor =]"); parser.parse(); assertEquals(Color.CYAN, param.fillColor); parser.setCode("[fillcolor %dfsfds\n]"); parser.parse(); assertEquals(Color.CYAN, param.fillColor); }catch(Exception e) { fail(); } } private void parse_fillstyle(PSTParameters param) { try { parser.setCode("[fillstyle = test]"); parser.parse(); assertEquals("test", param.fillStyle); parser.setCode("[fillstyle = test*]"); parser.parse(); assertEquals("test*", param.fillStyle); parser.setCode("[fillstyle =]"); parser.parse(); assertEquals("test*", param.fillStyle); parser.setCode("[fillstyle =%fdsf\n]"); parser.parse(); assertEquals("test*", param.fillStyle); parser.setCode("[fillstyle =1289K3]"); parser.parse(); assertEquals("test*", param.fillStyle); parser.setCode("[fillstyle =0.3]"); parser.parse(); assertEquals("test*", param.fillStyle); parser.setCode("[fillstyle\t=\taa]"); parser.parse(); assertEquals("aa", param.fillStyle); parser.setCode("[fillstyle\t=*]"); parser.parse(); assertEquals("aa", param.fillStyle); }catch(Exception e) { fail(); } } private void parse_dash(PSTParameters param) { try { parser.setCode("[dash=.4 2]"); parser.parse(); assertEquals(.4, param.dashBlack); assertEquals(2., param.dashWhite); parser.setCode("[dash=.8 cm \n %cfds %fdsf\n %fdsf \r 4 \t cm ]"); parser.parse(); assertEquals(.8, param.dashBlack); assertEquals(4., param.dashWhite); parser.setCode("[dash=.8mm \t%fdsf\n %fdsf \r 4mm ]"); parser.parse(); assertEquals(.08, param.dashBlack); assertEquals(.4, param.dashWhite); parser.setCode("[dash=.9mm mm ]"); parser.parse(); assertEquals(.08, param.dashBlack); assertEquals(.4, param.dashWhite); parser.setCode("[dash=.9fd ]"); parser.parse(); assertEquals(.08, param.dashBlack); assertEquals(.4, param.dashWhite); parser.setCode("[dash=.d9fd ]"); parser.parse(); assertEquals(.08, param.dashBlack); assertEquals(.4, param.dashWhite); parser.setCode("[dash\r=\n.d9fd ]"); parser.parse(); assertEquals(.08, param.dashBlack); assertEquals(.4, param.dashWhite); parser.setCode("[dash=.9cm0.1cm]"); parser.parse(); assertEquals(.9, param.dashBlack); assertEquals(.1, param.dashWhite); }catch(Exception e) { fail(); } } private void parse_dimen(PSTParameters param) { try { parser.setCode("[dimen = outer]"); parser.parse(); assertEquals(PSTricksConstants.BORDERS_INSIDE, param.borderPos); parser.setCode("[dimen % fdsjif % fds\r = middle]"); parser.parse(); assertEquals(PSTricksConstants.BORDERS_MIDDLE, param.borderPos); parser.setCode("[\n %fdsfd \n \t dimen = %fds \n \n \n inner]"); parser.parse(); assertEquals(PSTricksConstants.BORDERS_OUTSIDE, param.borderPos); parser.setCode("[dimen = ]"); parser.parse(); assertEquals(PSTricksConstants.BORDERS_OUTSIDE, param.borderPos); parser.setCode("[dimen = %fdsfds \n ]"); parser.parse(); assertEquals(PSTricksConstants.BORDERS_OUTSIDE, param.borderPos); parser.setCode("[dimen = fdsfds ]"); parser.parse(); assertEquals(PSTricksConstants.BORDERS_OUTSIDE, param.borderPos); parser.setCode("[dimen = 124 ]"); parser.parse(); assertEquals(PSTricksConstants.BORDERS_OUTSIDE, param.borderPos); parser.setCode("[dimen = éà ]"); parser.parse(); assertEquals(PSTricksConstants.BORDERS_OUTSIDE, param.borderPos); parser.setCode("[dimen %dfsf \n=]"); parser.parse(); assertEquals(PSTricksConstants.BORDERS_OUTSIDE, param.borderPos); }catch(Exception e) { fail(); } } private void parse_doublecolor(PSTParameters param) { try { parser.setCode("[doublecolor = green]"); parser.parse(); assertEquals(Color.GREEN, param.dbleColor); parser.setCode("[doublecolor %fdsf\r= \n cyan]"); parser.parse(); assertEquals(Color.CYAN, param.dbleColor); parser.setCode("[doublecolor=fdsfds]"); parser.parse(); assertEquals(Color.CYAN, param.dbleColor); parser.setCode("[doublecolor =]"); parser.parse(); assertEquals(Color.CYAN, param.dbleColor); parser.setCode("[doublecolor %dfsfds\n]"); parser.parse(); assertEquals(Color.CYAN, param.dbleColor); }catch(Exception e) { fail(); } } private void parse_doublesep(PSTParameters param) { try { parser.setCode("[doublesep=.4]"); parser.parse(); assertEquals(.4, param.dbleSep); parser.setCode("[doublesep=0.8cm]"); parser.parse(); assertEquals(.8, param.dbleSep); parser.setCode("[doublesep=2 cm]"); parser.parse(); assertEquals(2., param.dbleSep); parser.setCode("[doublesep \r %fdsf\n\t=\n\t 2.2\n%comment\r cm]"); parser.parse(); assertEquals(2.2, param.dbleSep); parser.setCode("[doublesep=2 in]"); parser.parse(); assertEquals(2.*PSTricksConstants.INCH_VAL_CM, param.dbleSep); parser.setCode("[doublesep = 2 pt ]"); parser.parse(); assertEquals(2./PSTricksConstants.CM_VAL_PT, param.dbleSep); parser.setCode("[doublesep = 2mm]"); parser.parse(); assertEquals(0.2, param.dbleSep); }catch(Exception e) { fail(); } } private void parse_dotsep(PSTParameters param) { try { parser.setCode("[dotsep=2]"); parser.parse(); assertEquals(2., param.dotStep); parser.setCode("[dotsep=2cm]"); parser.parse(); assertEquals(2., param.dotStep); parser.setCode("[dotsep=2 cm]"); parser.parse(); assertEquals(2., param.dotStep); parser.setCode("[dotsep\r\t=2.2\n%comment\r cm]"); parser.parse(); assertEquals(2.2, param.dotStep); parser.setCode("[dotsep=2 in]"); parser.parse(); assertEquals(2.*PSTricksConstants.INCH_VAL_CM, param.dotStep); parser.setCode("[dotsep=2 pt]"); parser.parse(); assertEquals(2./PSTricksConstants.CM_VAL_PT, param.dotStep); parser.setCode("[dotsep=2 mm]"); parser.parse(); assertEquals(0.2, param.dotStep); }catch(Exception e) { fail(); } } private void parse_boxsep(PSTParameters param) { try { parser.setCode("[boxsep=true]"); parser.parse(); assertTrue(param.boxSep); parser.setCode("[boxsep=false]"); parser.parse(); assertFalse(param.boxSep); parser.setCode("[boxsep=]"); parser.parse(); assertFalse(param.boxSep); parser.setCode("[boxsep=fdsfds]"); parser.parse(); assertFalse(param.boxSep); parser.setCode("[boxsep=%fdjsf\n \t true]"); parser.parse(); assertTrue(param.boxSep); parser.setCode("[boxsep= \t %fdjsf\n\r \t false]"); parser.parse(); assertFalse(param.boxSep); }catch(Exception e) { fail(); } } private void parse_linecolor(PSTParameters param) { try { parser.setCode("[linecolor=blue]"); parser.parse(); assertEquals(Color.BLUE, param.lineColor); parser.setCode("[linecolor=yellow]"); parser.parse(); assertEquals(Color.YELLOW, param.lineColor); parser.setCode("[linecolor=fdsfds]"); parser.parse(); assertEquals(Color.YELLOW, param.lineColor); parser.setCode("[linecolor=]"); parser.parse(); assertEquals(Color.YELLOW, param.lineColor); parser.setCode("[linecolor]"); parser.parse(); assertEquals(Color.YELLOW, param.lineColor); }catch(Exception e) { fail(); } } private void parse_doubleline(PSTParameters param) { try { parser.setCode("[doubleline=true]"); parser.parse(); assertTrue(param.dbleLine); parser.setCode("[doubleline=false]"); parser.parse(); assertFalse(param.dbleLine); parser.setCode("[doubleline=fdsfds]"); parser.parse(); assertFalse(param.dbleLine); parser.setCode("[doubleline=]"); parser.parse(); assertFalse(param.dbleLine); parser.setCode("[doubleline]"); parser.parse(); assertFalse(param.dbleLine); parser.setCode("[doubleline==_è-é]"); parser.parse(); assertFalse(param.dbleLine); }catch(Exception e) { fail(); } } private void parse_linewidth(PSTParameters param) { try { parser.setCode("[linewidth=0.2cm]"); parser.parse(); assertEquals(0.2, param.lineWidth); parser.setCode("[linewidth=0.2mm]"); parser.parse(); assertEquals(0.02, param.lineWidth); parser.setCode("[linewidth=0.2]"); parser.parse(); assertEquals(0.2, param.lineWidth); parser.setCode("[linewidth=0.2 pt]"); parser.parse(); assertEquals(0.2/PSTricksConstants.CM_VAL_PT, param.lineWidth); parser.setCode("[linewidth=0.2 in]"); parser.parse(); assertEquals(0.2*PSTricksConstants.INCH_VAL_CM, param.lineWidth); parser.setCode("[linewidth=0.2 in]"); parser.parse(); assertEquals(0.2*PSTricksConstants.INCH_VAL_CM, param.lineWidth); parser.setCode("[linewidth= aa ]"); parser.parse(); assertEquals(0.2*PSTricksConstants.INCH_VAL_CM, param.lineWidth); parser.setCode("[linewidth= aa in]"); parser.parse(); assertEquals(0.2*PSTricksConstants.INCH_VAL_CM, param.lineWidth); parser.setCode("[linewidth= in]"); parser.parse(); assertEquals(0.2*PSTricksConstants.INCH_VAL_CM, param.lineWidth); }catch(Exception e) { fail(); } } @Override public void testSkipComment() { parser.setCode("%comment\na"); assertEquals(parser.skipComment(), "comment"); assertEquals(parser.getPosition(), 9); assertEquals(parser.getLinePosition(), 2); parser.setCode("\\%not a comment\na"); assertNull(parser.skipComment()); assertEquals(parser.getPosition(), 0); assertEquals(parser.getLinePosition(), 1); parser.setCode("%comment"); assertEquals(parser.skipComment(), "comment"); assertEquals(parser.getPosition(), 9); assertEquals(parser.getLinePosition(), 2); } @Override public void testSkipWSP() { parser.setCode(" test"); parser.skipWSP(); assertEquals('t', parser.getChar()); parser.skipWSP(); assertEquals('t', parser.getChar()); parser.setCode(""); parser.skipWSP(); assertTrue(parser.isEOC()); parser.setCode(" \n \t \r test"); parser.skipWSP(); assertEquals('t', parser.getChar()); parser.skipWSP(); assertEquals('t', parser.getChar()); } } latexdraw-2.0.8+1.orig/junit/test/parser/pst/TestPSTParser.java0000644000000000000000000000211711347255510021241 0ustar package junit.test.parser.pst; import junit.test.parser.TestCodeParser; public abstract class TestPSTParser extends TestCodeParser { @Override public void testSkipComment() { parser.setCode("%comment\na"); assertEquals(parser.skipComment(), "comment"); assertEquals(parser.getPosition(), 9); assertEquals(parser.getLinePosition(), 2); parser.setCode("\\%not a comment\na"); assertNull(parser.skipComment()); assertEquals(parser.getPosition(), 0); assertEquals(parser.getLinePosition(), 1); parser.setCode("%comment"); assertEquals(parser.skipComment(), "comment"); assertEquals(parser.getPosition(), 9); assertEquals(parser.getLinePosition(), 2); } @Override public void testSkipWSP() { parser.setCode(" test"); parser.skipWSP(); assertEquals('t', parser.getChar()); parser.skipWSP(); assertEquals('t', parser.getChar()); parser.setCode(""); parser.skipWSP(); assertTrue(parser.isEOC()); parser.setCode(" \n \t \r test"); parser.skipWSP(); assertEquals('t', parser.getChar()); parser.skipWSP(); assertEquals('t', parser.getChar()); } } latexdraw-2.0.8+1.orig/junit/test/TestDelimitor.java0000644000000000000000000001022311347255510017241 0ustar package junit.test; import java.awt.Point; import junit.framework.TestCase; import latexDraw.ui.components.Delimitor; import latexDraw.util.LaTeXDrawPoint2D; import org.junit.Before; import org.junit.Test; /** * This class contains tests on the class Delimitor.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    *
    * 06/26/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestDelimitor extends TestCase { private final LaTeXDrawPoint2D p0 = new LaTeXDrawPoint2D(0, 0); private final LaTeXDrawPoint2D p1 = new LaTeXDrawPoint2D(1, 1); private final LaTeXDrawPoint2D pNull = null; private Delimitor d1; @Override @Before public void setUp() { d1 = new Delimitor(); } @Test public void testConstructors() { Delimitor d = new Delimitor(pNull); assertEquals(d.getCenter(), p0); d = new Delimitor(); assertEquals(d.getCenter(), p0); d = new Delimitor(new LaTeXDrawPoint2D(0, 0)); assertEquals(d.getCenter(), p0); } @Test public void getSetCenterXY() { try { d1.setCenter(null); fail(); }catch(IllegalArgumentException e) { /* Good */ } try { d1.setCenter(p1); } catch(Exception e) { fail(); } if(p1 != d1.getCenter()) fail(); assertEquals(p1.x, d1.getX()); assertEquals(p1.y, d1.getY()); } @Test public void setColorSet1() { d1.setColorSet1(); assertEquals(Delimitor.INTERIOR, d1.getInterior()); } @Test public void setColorSet2() { d1.setColorSet2(); assertEquals(Delimitor.INTERIOR_2, d1.getInterior()); } @Test public void setColorSet3() { d1.setColorSet3(); assertEquals(Delimitor.INTERIOR_3, d1.getInterior()); } @Test public void setColorSet4() { d1.setColorSet4(); assertEquals(Delimitor.INTERIOR_4, d1.getInterior()); } @Test public void getSetDim() { try { d1.setDim(-1.); fail(); }catch(IllegalArgumentException e) { /* Good. */ } try { d1.setDim(0.); fail(); }catch(IllegalArgumentException e) { /* Good. */ } try { d1.setDim(1.); } catch(IllegalArgumentException e) { fail(); } assertEquals(d1.getDim(), 1.); } @Test public void setCoordinates() { try { d1.setCoordinates(pNull); fail(); }catch(IllegalArgumentException e) { /* Good */ } try { d1.setCenter(p1); } catch(Exception e) { fail(); } assertEquals(p1, d1.getCenter()); } @Test public void isIn() { d1.setCenter(p0); d1.setDim(10); Point tmpPt = null; assertFalse(d1.isIn(tmpPt)); assertFalse(d1.isIn(pNull)); assertFalse(d1.isIn(new LaTeXDrawPoint2D(0, 6))); assertFalse(d1.isIn(new LaTeXDrawPoint2D(0, -6))); assertFalse(d1.isIn(new LaTeXDrawPoint2D(6, 0))); assertFalse(d1.isIn(new LaTeXDrawPoint2D(-6, 0))); assertTrue(d1.isIn(new LaTeXDrawPoint2D(0, 5))); assertTrue(d1.isIn(new LaTeXDrawPoint2D(0, -5))); assertTrue(d1.isIn(new LaTeXDrawPoint2D(5, 0))); assertTrue(d1.isIn(new LaTeXDrawPoint2D(-5, 0))); assertTrue(d1.isIn(p1)); assertTrue(d1.isIn(p0)); } @Test public void testClone() { try { Delimitor clone = (Delimitor)d1.clone(); assertEquals(clone.getCenter(), d1.getCenter()); assertEquals(clone.getDim(), d1.getDim()); assertEquals(clone.getInterior(), d1.getInterior()); assertEquals(clone.getX(), d1.getX()); assertEquals(clone.getY(), d1.getY()); } catch(Exception e) { fail(); } } @Test public void testGetSetOpacity() { try { Delimitor.setOpacity(-2); fail(); }catch(IllegalArgumentException e) { /* Good */ } try { Delimitor.setOpacity(300); fail(); }catch(IllegalArgumentException e) { /* Good */ } try { Delimitor.setOpacity(100); } catch(Exception e) { fail(); } assertEquals(Delimitor.getOpacity(), 100); } } latexdraw-2.0.8+1.orig/junit/test/TestShortcutsFrame.java0000644000000000000000000000202011347255510020256 0ustar /* * TestShortcutsFrame.java */ package junit.test; import junit.framework.TestCase; import latexDraw.ui.dialog.ShortcutsFrame; import org.junit.Test; /** * This class contains tests on the class ShortcutsFrame.
    *
    * This file is part of LaTeXDraw
    * Copyright (c) 2005-2008 Arnaud BLOUIN
    *
    * LaTeXDraw is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version.
    *
    * LaTeXDraw is distributed without any warranty; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details.
    * *
    * 06/26/07
    * @author Arnaud BLOUIN
    * @version 2.0.0
    */ public class TestShortcutsFrame extends TestCase { @Test public void testShortcutsFrame() { try { new ShortcutsFrame(); }catch(Exception e) { fail(); } } } latexdraw-2.0.8+1.orig/install_vista.vbs0000644000000000000000000000047011347255510015071 0ustar Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.GetFile("installer.jar") Set objShell = CreateObject("Shell.Application") params = "-jar " & objFSO.GetAbsolutePathName(objFile) & " " & objFSO.GetAbsolutePathName(objFile) objShell.ShellExecute "javaw", params, "", "runas" latexdraw-2.0.8+1.orig/release_note.txt0000644000000000000000000011127711347255510014717 0ustar Version 2.0.8 - fixed #535631: cannot export as pdf using pdfcrop if the path of latex binaries is defined - fixed #483517: when importing a picture into a drawing, the created eps picture is not located at the right place - fixed #506868: in some cases, copying or cutting shapes does not respect the original order ******************************************************************* Version 2.0.7 - March 7th 2010 - fixed #531658: pdf export broken on Windows ******************************************************************* Version 2.0.6 - January 18th 2010 - added: Turkish localisation - improvement: check in the installer the java version is 6 or newer - fixed #506849: cannot create PS/PDF documents in some cases - fixed #483528: pictures saved into a SVG document cannot be loaded - fixed #483520: picture badly scaled when included in a drawing and exported as ps/pdf/latex - fixed #502915: fonts not always embedded - fixed #504743: bad management of invalid SVG documents - fixed #295531: in the batch convert panel, the field 'add sub folders' does not appear with gtk laf - fixed #505284: when importing SVG lines, the last point is missing - fixed #505515: attribute 'style' not used during import ******************************************************************* Version 2.0.5 - October 06th 2009 - added: can export a drawing as a pdf document using latex AND pdfcrop - fixed #434030: export as ps (latex) does not work anymore - fixed #433971: the "export as picture" dialog as a bad title - fixed #434204: generated ps (latex) documents are not cropped - fixed #306954: SVG import: some SVG shapes generate empty code - fixed #306953: attribute inheritance does not work for text attributes - fixed #435265: better management of SVG font-size - fixed #195898: a too small triangle/rhombus is not visible - fixed #440739: the size of shapes with double borders are badly saved ******************************************************************* Version 2.0.4 - September 20th 2009 - added: new localisation, Polish - fixed #428405: freeze while exporting as pdf on Vista/XP - fixed #402096: use alternative runtime.exec() - fixed #402099: improve management of temp files - fixed #402104: pdf/ps files have a weird title ******************************************************************* Version 2.0.3 - July 3rd 2009 - added: latex EPS and PDF export (need a latex distribution to work) - added: new localisation, Italian - fixed #268988: widgets not updated when loading an SVG doc - fixed #305154: bad parsing of points path for SVG-polygon and SVG-polylines - fixed #305413: cannot parse CSS styles with WSP or comments - fixed #392168: crash while changing cm to inch in drawing preferences - fixed: in some cases, wrong floating-point syntax was generated (e.g. 14E-01) - fixed: on Ubuntu Jaunty the Palatino font is not well managed - fixed: the rotation field did not really work for polygons and lines - fixed: exported EPS drawings can hide, in some cases, the text of a tex document - fixed: desorganisation of some shapes while joining them - translations updated ******************************************************************* Version 2.0.2 - added: a field to change and view the zoom - fixed #292090: crash when undoing the joining of two shapes - fixed #295577: crash while creating a grid with gtk laf - fixed #296970: SVG: bad management of attributes inheritance - fixed #296248: SVG: the attribute 'fill' must be by default to 'black' - fixed #181513: freeze while opening SVG document that contains DOCTYPE - fixed #291507: crash while opening some SVG files - fixed #289943: cannot undo a change of coordinates (Bezier curve/polygon) - fixed #289936: can open parameters panel while several figures are selected - fixed #291489: no name when exporting a saved drawing - fixed #293194: no name when saving as a saved drawing - fixed #293190: no label for undoing distribution/alignment but an error message - fixed #268090: cannot open a file that contains a space in command line - fixed #294746: problem with the grid menus when a drawing is open - fixed #294724: some changes does not set the drawing as "modified" - fixed #287404: misspelling for group/separate figures and strings updated - fixed #238142: inverted round bracket arrow not well plotted ******************************************************************* Version 2.0.1 - October 31th 2008 - added: hatchings angle is now managed - fixed #289881: crash when joining figures - fixed #264270: text font and text size not loaded from SVG documents - fixed #268037: italic and bold text not loaded from SVG documents - fixed #268979: borders of the auto adjustment not saved - fixed #267117: translation error - fixed #268973: borders cannot be selected when in auto adjustment ******************************************************************* Version 2.0 - July 25th 2008 - added: SVG import/export - added: can align (left, right, top,...) figures - added: can distribute figures - added: a menu item to create a new drawing with the selected figures - added: a button to copy the code of the selected figures - added: US English language (clear distinction between US and British English) - added: German translation - added: the latex command 'put' is managed. But its use is not advice since it is not a PSTricks command and it creates some problems with rput and uput commands. You should use the rput command instead - improvement: new icons; - improvement: better performance when the grid is displayed - improvement: can open latexdraw with a pstricks file - improvement: preferences are now stored in an XML file - improvement: the position of the main frame, its size and position of the slidebar are now saved in the preferences file - improvement: better plotting of rhombus, triangle and polygon - change: the default format of latexdraw is now SVG, files with the old format can still be opened - change: closed bézier-curves cannot have a second arrow anymore - change: the shape handlers are more simply drawn in order to be less CPU and memory consumers - fixed #1884433: changing rotation angle in the parameters panel do nothing (for lines and polygons) - fixed: while saving, wrong dialog title displayed when the interface ask if the drawing must be replaced - fixed: it was impossible to select a item of a toolbar with Compiz activated on Linux - fixed: problem of focus with toolbars on Linux - fixed: rotation field in the freehand parameters panel - fixed: no warning when quitting and when the drawing was modified via a parameters frame - fixed: some dot shapes were badly plotted - fixed: bezier curves and lines have their borders not well drawn when having a shadow - fixed: the cancel button of the preferences panel had no effect - fixed: a lot of minor bugs PSTricks parser 0.5: - added: rotatebox, rotateleft, rotateright and rotatedown commands are managed - added: definecolor{name}{cmyk}{c m y k} is supported - added: newrgbcolor, newcmykcolor, newgray and newhsbcolor commands are supported - fixed: false error report when some unknown commands are parsed - fixed: when importing a document, figures can be inserted several times - fixed: freeze when importing a lot of Bézier curves because of the code optimisations - fixed: crash when importing a bad formed piece of code containing too many closing braces - fixed: crash when importing a pscustom block composed of Bézier curves - fixed: crash when importing a Bézier curve having only two equal points - fixed: unit definition was not considered while parsing rput command - fixed: \} not well parsed *************************************************************** Version 1.9.5 - October 20th 2007 - fixed: transparency not always managed in imported pictures; - fixed: problem when trying to select a figure to put behind/in front of the selected figure; - fixed: crash when undo "join figures"; - fixed: crash when putting a figure behind one another; - fixed: cannot open a .ldp containing a picture; - fixed: crash when joining several figures; - fixed: cannot change the parameters of joined figures; - fixed: a selected figure can be exported with its border. *************************************************************** Version 1.9.4 - September 1st 2007 - fixed: an error occurred when using alt-right/left/... and no figure was selected; - fixed: saving a drawing froze the program under gtk theme under Linux; - fixed: the size of an elliptic framed box was badly computed (again!); - fixed: bezier curves: arrow colour not exported in PSTricks; - fixed: joined-lines arrows can be in the wrong side; - fixed: "joined-lines" menu was missing in the popup-menu; - fixed: too small figures cannot be created; - fixed: problems with arrows and line/joined-lines; - fixed: a line/joined-lines/arc/bezier curve/circle is not visible when all its points are at the same location; - fixed: the code is never updated before its printing; - fixed: the grid was printed with the drawing; - fixed: grid: the dotted sub-grid not well defined; - fixed: the pstricks code of a grid can generate number such as 1E-07; - fixed: the dot-size field is not updated when resizing a dot; - fixed: an error can occurred when using mirrors/position buttons with no selected figure; - fixed: the printed code is always a unique page; - change: jlibeps replaces EPSGraphics; - change: importation of a WMF picture is removed. PSTricks parser 0.4.2: - fixed: parameters beginning with '9' cannot be parsed; - fixed #1703716: origin={...} in parameters does not work. *************************************************************** Version 1.9.3 - June 20th 2007 - fixed: wrong colour definition for carnationPink; - fixed: undo/redo manager not always well updated; - fixed: sometimes, no warning appears when the drawing is modified and the user leaves LaTeXDraw; - fixed: choices list do nothing when selecting the same choice; - fixed: export menu not updated when cutting and pasting; - fixed: problem with toolbar, gtk "look and feel" and java 6; - fixed: buttons not well updated with ctrl-A; - fixed: in rare case, joined figures can launch exceptions; - fixed: when separating joined figures, the code is not updated; - fixed: freehand: if first point=last point, the figure is not created; - fixed: user comments can be truncated. PSTricks parser 0.4.1: - fixed #1703713: {} and {>} arrows command should be parsed. **************************************************************** Version 1.9.2 - May 31th 2007 - added: a button in the frame of errors to copy the log; - improvement: preferences and templates are stored in the profile of the user - improvement: templates are not loaded at start-up; - improvement: double line for joined-lines; - improvement: can define the compression rate when exporting in jpg format; - improvement: in the frame of parameters, the glimpse panel automatically zoom in/out to view to whole figure and the figure is always placed in the centre of the panel; - improvement: in the frame of parameters, you can move the glimpse figure with the mouse; - improvement: in the frame of parameters for Bézier curve, you can choose if, when moving a point, its control points are moved too; - fixed #1703723: figure not always well filled; - fixed: the stroke of double-line was badly used for bezier curves/joined-lines - fixed: when importing a picture, its eps version is saved in the profile if we can save it in the folder; - fixed: exception and some problems when undo/redo joined figures; - fixed: scalebox{1} must be placed before begin{pspicture}; - fixed: exception when rotating several joined figures; - fixed: a template menu item will not be created if its .ldt file does not exist; - fixed: template thumbnails were not always updated; - fixed: selection did not always work with arcs and Bézier curves. PSTricks parser 0.4: - added: \pspicture and \endpspicture are managed; - added: \normalcolor is managed; - added: arrows=<-| is managed; - fixed: an invalid \begin{pspicture} command must launch a fatal error; - fixed: unknown command not always well parsed; - fixed: a single end{pspicture} command must launch a fatal error; **************************************************************************** Version 1.9.1 - April 4th 2007 - added: more shortcuts: - "space" selects the first or the next figure (in selection mode); - ctrl+mouse wheel zoom in/out; - added: comment explaining how to rescale the whole drawing (request #1628137); - improvement: can change the parameters of several selected figures in the same time; - improvement: can define the parameters before creating a figure; - improvement: all the frames can be easily resized; - improvement: the definition of a dot is almost totally rewritten to improve the selection and to fix several bugs; - fixed #1681687: the parameters toolbar is not updated when importing a tex file; - fixed #1690426: figure not deleted when cancelling its creation with to top-right button; - fixed #1691145: freezes when a wrong file is given in command line; - fixed: exception in some cases when the frame of parameters of a dot is open; - fixed: the selection of figures works better now; - fixed: a rotated dot doesn't correctly move after loading a project; - fixed: problem when exporting a drawing as picture; - fixed: the drawing is no more affected when the number of pixels per cm changes (only the generated code); - fixed: problem when redoing after having cut several figures; - fixed: the size of the ellipse framed box was badly computed; - fixed: minor bugs. **************************************************************************** Version 1.9 - February 8th 2007 - added: a splash screen; - added: recent files manager; - added: more shortcuts: - ctrl+A select all the figures; - ctrl/shift key can be used to add/remove a figure to the selection; - can move scrollbars and figures with left, up, shift,...; - added: can update figures to the displayed grid; - added: a shortcuts frame; - added: when the code panel is closed, a button, copying the all the generated code, is visible in the toolbar; - added: a menu item to set visible all the hidden figures; - added: can choose the look and feel; - added: can change the transparency of the delimiters; - added: a menu to check update; - added: a popup menu to cut/paste/copy text from/to "insert PSTricks code" and "add comment" frames; - added: "move"/"resize/rotate" cursor is displayed when move/resize/rotate figures; - added: "code" menu now contains all code options; - improvement: free hand can be either curves or lines; - improvement: free hand can be closed or opened; - improvement: you can define the interval between each point of free hand; - improvement: akin points can be dotted/dashed; - improvement: akin points can be filled/hatched and can have a gradient; - improvement: a Bézier curve can be closed with a line or a curve; - improvement: can equilibrate the control points of a Bézier curve; - improvement: update jiu to 0.14.1; - improvement: a right-click doesn't remove the last point anymore (during the creation of a polygon/joined-lines/Bézier curve; - fixed #1621630: figures were not updated to the magnetic grid when rotated; - fixed #1621632: a very small rectangle can disappear when rotated of 90°; - fixed #1621633: cannot select a too small rectangle; - fixed #1621634: the selection of a text without framed box didn't work very well; - fixed #1621635: figures not always follow the magnetic grid when dragged; - fixed #1624345: cannot stop the creation of a polygon on Mac (mouse has one button); - fixed #1644659: the main frame lost the focus when a ListJToogleButton is displayed; - fixed #1644660: the gravity centre of a set of figures was badly computed; - fixed #1644660: polygons move when violently rotated; - fixed #1644662: problem when closing and displaying the code panel; - fixed #1644663: the parameters of the second arrow of joined lines/Bézier curve are never generated; - fixed #1645157: joined-lines are automatically filled when having a shadow; - fixed #1645158: space between dots of a dotted polygon with double boundaries was badly computed; - fixed #1645160: the fact that a dot can be filled or not was badly managed; - fixed: the size of delimiters (polygons, Bézier curves) aren't always updated; - fixed: arrows are not moved when mirrors are used (Bézier curve); - fixed: cut and paste doesn't work; - fixed: for axes, in some cases the labels are badly placed; - fixed: a lot of minor bugs; PSTricks parser 0.3: - added: \begin{figure} and \begin{center} are managed; - added: \pscustom is partially managed; - improvement: Can parse a Bézier curve with more than two points; - improvement: squared psframe is now converted in square; - improvement: arc with a line at the start to the end point is transformed in chord; *********************************************************************************** Version 1.8.2 - November 15th 2006 - fixed #1580023: the printed code doesn't take care about the width of the page; - fixed #1538675: Bézier curve/polygons/joined lines still rotate badly; - fixed #1581400: you can select a empty Bézier curve by clicking at the interior; - fixed #1591309: borders of a Bézier curve were not displayed; - fixed #1591310: can move a figure by using its borders; - fixed #1593762: parameters panel - undo has no effect when modifying a Bézier curve; - fixed #1591312: not enable to select a too small rectangle/ellipse; - fixed #1596421: a too small rectangle/ellipse is not visible; - fixed # : we must not be able to select a figure with its shadow; - fixed # : can select joinedlines/arc with the line joining their extremities; - fixed: minor bugs. PSTricks parser 0.2.3: - fixed #1579820: parser freezes when the code has { ... }; - fixed #1586013: problem when parsing a line or a polygon like \psline(2,2)(2,2)(2,2). *********************************************************************************** Version 1.8.1 - October 17th 2006 - fixed #1554750: problem with round corner (frame and square); - fixed #1561789: "code autoupdate" field (in the preferences frame) had not effect; - fixed #1562954: problem with the look & feel "metal"; - fixed #1564478: vertical mirror was horizontal mirror for text; - fixed #1564477: picture was not moved when using mirrors; - fixed #1573703: problem with checkboxes and jre 1.5.0_09 with XP look & feel; - fixed #1508200: delimiters of triangles and rhombus are sometimes badly updated; - fixed #1538675: polygons move when rotating violently; - fixed #1508202: Bézier curves rotate badly; - fixed: a lot of minor bugs. PSTricks parser 0.2.2: - fixed #1573706: problem when having both unit and xunit/yunit in the parameters. *********************************************************************************** Version 1.8 - September 13th 2006 - added: new localisation, Spanish; - added: new shape, axes; - added: magnetic grid; - added: mirrors to move figures; - added: buttons to rotate figures of 90, 180 and 270°; - added: a button to launch your LaTeX editor; - improvement: the help can be loaded with you browser: help/index.html; - improvement: Bézier curve can have arrows; - improvement: a button to close the mini-toolbars; - improvement: Bézier curve can have a double boundary; - improvement: Bézier curve can be filled, hatched and can have a gradient; - improvement: an arrow with the 'dot' shape can have its interior colour changed; - improvement: hatchsep attribute is managed; - improvement: new "About LaTeXDraw" frame; - fixed #1555339: the ilk of an arc (open, pie or chord) was never saved; - fixed #1554729: dotted/dashed double line has not it good background colour (for polygon); - fixed #1554162: the borders of the drawing are not always updated (with auto adjustment disable); - fixed #1553683: with command line, preferences and templates are not loaded; - fixed #1540561: crashing when launching the help; - fixed #1536603: eps exported files were not vectorial; - fixed #1528919: shadow for a polygon with double boundary is too small; - fixed #1528562: joined lines parameters frame: a change has no effect; - fixed #1538724: bad rotation in the frame of parameters of a drawing; - fixed #1547234: the 'draw labels' checkbox doesn't work very well in the frame of parameters of the grid; - fixed #1547235: default buttons did not always reinitialise values; - fixed #1547236: crashing when clicking on the default button of the dot frame; - fixed #1547239: round panel, for rectangle and square, is not always visible; - fixed #1548699: with JRE 1.5_08, the buttons of the toolbars are too big; - fixed #1556362: sometimes LaTeXDraw froze at startup when it checked new version; - fixed #1557509: vertical and horizontal line can be difficulty selected; - fixed: minor bugs. PSTricks parser 0.2.1: - added: axes management; - fixed #1556340: rotation angle was not managed (since 1.7) for triangle; - fixed #1556544: inversion of positions between X-labels and Y-labels; - fixed #1556548: a rotated grid (with unit not equal to 1) was badly placed. ************************************************************************************** Version 1.7 - July 23th 2006 - added: shadow management; - added: colour shifting management; - added: framed box management; - added: buttons in the frames of parameters to zoom in/out the figure; - improvement: the background of a text can be opaque; - improvement: polygons can have doubles lines; - improvement: can change the size of the rounds corners for rectangles and squares; - improvement: the frames of parameters have a better interface; - improvement: gif can be included or converted; - improvement: batch conversion: a check box define if the pictures must be converted in their directory or not; - improvement: new icons; - fixed #1404791: when refreshing the templates, there thumbnails were not updated; - fixed #1487192: when a frame of parameters is opened, the figure can be deleted or modified; - fixed #1481272: the colour of the interior of the arrows with the circle shape must be as the interior of the figure; - fixed #1487185: scrollbars are not updated when changing the font or the size of a text; - fixed #1489350: the size of a text change when zooming in and zooming out; - fixed #1489644: scrollbars of the parameters frame of grids are not always updated. - fixed #1489551: labels of grids and texts are not resized when you change the number of pixels per cm/inch of the draw; - fixed #1502040: when subgriddiv=1, borders must not be drawn; - fixed #1502043: some defaults values of lines' parameters were false; - fixed #1502048: for arcs, the start angle can be greater than the end angle to avoid problems during the drawing and the parsing (\pswedge(2,1){1.5}{300}{200}); - fixed #1502046: for Bézier curves, the controls points had a wrong size; - fixed #1502049: we must be able to fill the dot shape 'o'; - fixed #1512530: LaTeXDraw files containing picture cannot be loaded; - fixed #1512533: undo/redo: bad undo management when creating and cancelling a text/grid; - fixed #1512537: undo/redo: toolbar still active when redo a 'delete' action ; - fixed #1512538: undo/redo: the redo was never cleared when an action, different than redo, occurred; - fixed #1515149: bug in the method Line.getPerpendicularLine(): when the x-coordinate of a point of a triangle/rhombus is 0 a problem in the display occurred; - fixed #1516288: % not always replaced by \% during the code generation; - fixed #1523877: when a file is loaded, the undo/redo manager is not cleared; - fixed #1524381: batch conversion: output path was never used; - fixed #1525086: for rhombus, hatchings did not rotate because of gangle; - fixed #1526315: when "show points" option for a Bézier curve is selected, the curve must be dashed too; - fixed # : exception in Polygon.getBorders when three points have the same X-coordinate; - fixed: minor bugs. PSTricks parser 0.2: - added: shadow management; - added: colour shifting management; - added: framed box management; - added: millimetres are managed; - added: support +1 number (positive sign); - added: support numbers like ++++1, -----1, ++-+--+1; - added: support unit parameter; - fixed #1488716: linewidth=-1 must be understood as linewidth=1, idem for dotsize, ...; - fixed #1502052: for lines and arcs, arrows were not read in some cases (\psline{*->}(0,3)(5,5)); - fixed #1502053: dots was never filled; - fixed #1502711: when parsing a polygon with only two points, the third point was not created; - fixed #1502712: parsing the command \psset{origin={1,1}} launched an exception; - fixed #1502713: coordinate like (1pt, 2in) and size like {1cm} must be parsed; - fixed #1502714: when insert PSTricks code with \begin{pspicture} in comment, this commented command was understood like an uncommented command; - fixed #1502715: the format \pswedge{3}{0}{70} was not supported; - fixed #1515871: when you insert pstricks code like \begin{center}\begin{pspicture} the \begin{pspicture} was ignored; - fixed #1516165: the \% command was ignored; - fixed #1519847: pink colour not managed; - fixed #1519934: text not always parsed; - fixed #1520384: \bf and \it have no effect; - fixed #1523726: error during the parsing of the command \psgrid; for instance \rput(0,0){\psgrid} didn't work. ************************************************************************************** Version 1.6 - May 2nd 2006: WARNING: YOU MUST REPLACE THE FORMER 'Classic grid.ldp' OF THE TEMPLATES DIRECTORY BY THE NEW 'Classic grid.ldp' OF THE LaTeXDraw1.6_bin.zip. - fixed: several fields were exported to be localisable, while they should not to be (1); - fixed: polygon: borders was not updated when the thickness was changed; - fixed: problem when check the version of the preferences file; - fixed: grids did not rotate very when rotating several figures; - fixed: when paste, the scrollbars were not updated; - fixed: the grid was exported with the draw; - fixed: the packages \usepackage{color} and \usepackage{pstricks} are replaced by \usepackage[usenames,dvipsnames]{pstricks}; - fixed: "move figure" was badly managed by the undo/redo manager; - fixed: a problem when resize several selected figures containing polygons or derived figures; - fixed: when loading a file, the delimiters of severals figures were not updated; - fixed: when paste, toolbar was still activated; - fixed: for rectangles, delimiters were not updated when paste; - fixed: for circles and ellipses, borders were not updated when the thickness changed; - fixed: toolbar was still activated when click in a empty place when searching a figure to put behind/in front; - fixed: \caption{fig: is replaced by \caption{; - fixed: { and } were replaced by \string \{ ... So no command was possible; - fixed: the description of the draw was not saved (label, caption ,...); - fixed: when load a file with comments, the comments are too much '%'; - fixed: the borders of the selection was not updated when pasted several texts; - fixed: not able to have French translation; - fixed: the borders of the texts and of the grids were not always updated -> bad position of texts; - fixed: if a text was empty, you could not select it but it existed in the code panel; - fixed: problem in the management of the position of grids; - fixed: grids had not read/write stream methods (2); - fixed: when change a coordinate in a parameters frame and close the frame, the modified figure is not updated whereas; - fixed: glimpse figures (rectangle, square, ..) were not updated when change their width, ... in their parameters frame; - fixed: the grid was exported when exporting in eps; - fixed: in several cases, a figure does not rotate when the angle is 180°; - fixed: figures can move during the resizement of several polygons ; - fixed: the zoom was not managed when loading a file; - fixed: "dot-in" arrows change of position when the arrows is moved; - fixed: space between a double arrow must be like the arrows not like the line; - fixed: one of the doubles arrows for arc was not updated by the parameters of the arrow; - fixed: if the arrows are of the same kind, there parameters must be the same; - fixed: when you save a drawing and a figure is selected, it was hardly to unselect it; - fixed: it was possible to have an code for arrows like '{>>--}...' instead of '{>>-}'; - fixed: space between two lines of an hatching was badly managed; - fixed: problem when copy/paste a rhombus or a triangle; - fixed: problem when editing points of rhombus/triangle with their frame of parameters; - fixed: scrollbars not updated when cut/delete the unique figure of a drawing; - fixed: problem when resize several figures; - fixed: option "showpoints" was not save for arcs; - fixed: several minor bugs; - improvement: for dot, 'rput' is replaced by 'dotangle'; - improvement: more shapes for arrows: )-( and ]-[ are managed; - improvement: better management of the arrowheads and the grids; - improvement: for rhombus, 'rput' is replaced by 'gangle'; - improvement: can change the position of the labels of the grids; - improvement: CPU, memory, speed optimisation; - improvement: akin points code generator generates less points; - added: export as PNG; - added: export as BMP; - added: export as PPM; - added: can insert pictures; - added: new figure, joined lines; - added: LaTeXDraw can be used to convert jpeg|png|wmf|bmp|ppm pictures in eps|jpeg|png|ppm pictures with a batch processing; - added: the LaTeXDraw manual; - added: import PSTricks code (PSTricks parser version 0.1); - added: can insert PSTricks code in a draw (use the PSTricks parser). - regression: if, you load a saved project with 1.5.1 or 1.5.1.1 , the language is French and several figures of the draw have doubles boundaries, then the position of the doubles boundaries will be always 'inner'; because of the bug (1); - regression: because of the bug (2), LaTeXDraw can not open file from 1.5.1.1 and older with grids. By the same way, old templates with grids are not compatible with LaTeXDraw 1.6. ************************************************************************************** Version 1.5.1.1 - January 28th 2006: - fixed: minor bug with the isModified attribute; - fixed: ellipse didn't rotate very well; - fixed: error during the read of templates: templates could not be loaded; - fixed: when put '%' in comments or in a text, it was considered as a start of a comment by the TeX parser; - fixed: when a '\' was in a text, the label, ... it was considered as a command; - fixed: an exception appeared during the selection of figures when the draw was empty; - fixed: display->grid was not updated when change the unit of length (always in cm); - fixed: an exception occurred when drawing a triangle; - fixed: borders could not move; - fixed: problem when clicking on a triangle or on a rhombus; - fixed: problem when change a triangle or a rhombus; - fixed: the rectangle was not updated when dragging one of these delimiters; - fixed: polygon generate now a pspolygon, not a psline; - fixed: error when testing the version of the software. ************************************************************************************** Version 1.5.1 - January 20th 2006: - fixed: figure id could be as big as 12982109 for example; - fixed: params button was active when several figures were selected; - fixed: the rotation of several selected or joined figures didn't rotated the gravity centre of these figures; - fixed: error when shifting a triangle or a rhombus (shift method not overridden); - fixed: a dotted line began before the first point; - fixed: the delimiters of a square could not be selected (pb in isIn); - fixed: isModified was activated when we confirmed preferences frame; - fixed: a problem when loading a template from former version; - fixed: arc choice created a problem of display in the parameters frame; - fixed: cut/paste managed in the undo/redo; - fixed: cut figures didn't remove them from the selection; - fixed: change cm to inch, didn't update the scales; - fixed: an error when initialise components of the square parameters frame; - fixed: dble boundaries weren't filled very well with round rectangle/square; - fixed: getBorders(..) not overridden in the class BézierCurve; - fixed: menu "export as template" was never activated; - improvement: better rotation of the figures; - improvement: CPU, memory, speed optimisation; - improvement: better management of the resizing of rotated figures; - added: can check new version; - added: status bar; - added: support localisation; - added: new localisation, French. ************************************************************************************** Version 1.5 - January 13th 2006: - fixed: bug in intersect method; - fixed: bug with the default button in the parameters frames; - fixed: when we click the button default during the creation of a text or a grid, the figure wasn't deleted; - fixed: bug when saving parameters of a line in the parameters frame; - fixed: problem with the rescale methods; - fixed: minor bug in the code generation methods with the interior colour; - fixed: an horizontal line cannot be selected with the rectangle selector; - fixed: in the draw method of ArrowHead; round bracket used wrong attribute; - fixed: bugs in the ArrowHead code generator method; - fixed: bug in the arc code generator method; - fixed: problem when resize several figures containing at least a non-resizable figure like grid or text; - fixed: problem during the first selection akin points: the borders were wrong; - fixed: problem when resize several figures after a rotation; - fixed: wrong management of the bounds of the figures; - fixed: North-East-South-West rectangle's delimiters where managed with squares; - fixed: problem of approximations in the code generator methods: values like 10E-4 could appeared; - fixed: problem when drawing a line, in the setLastPoint method; - fixed: a bug in the method line.findPoints(Point p, double distance) with horizontal line; - fixed: in the method Figure.getBordersPoint(int), if id=-1, the function didn't return the good point; - fixed: It was possible to create a polygon with 2 points; it's not the goal of a polygon but a line; - fixed: with wedge and pie, the interiors line were not managed in the isIn method; - fixed: the borders of a text were too small; - fixed: when launch a new project, the name of the former project still remain; - fixed: print draw: if several figures were selected, they weren't printed; - fixed: print draw: zoom was activated; - fixed: when export as PSTricks, the code was not updated; - fixed: Delimiter write method didn't save the dimension of the delimiter; - fixed: PSTricks position of a text was wrong; - fixed: error when redo; - fixed: the draw method of a dot didn't display round shape well; - fixed: bug with links in the help frame; - fixed: Figure class could not be deserialisable; - fixed: several minor bugs; - improvement: new icons; - improvement: improvement of the exceptions management; - improvement: changes in the parameters toolbar; - improvement: use of spinners; - improvement: new kind of buttons; - improvement: code optimisations (thanks to Eclipse); - improvement: a lots of more parameters for figures; - improvement: "showpoints" function is now enable for arc; - improvement: arrowheads for arc; - improvement: the PSTricks code is updated only on the mouse released (speed optimisation); - added: a panel is into the parameters frames in order to have a glimpse of the modified figure; - added: new figure, grid; - added: hatching management; - added: can join/separate several figures; - added: can create and import patterns (groups of figures) ; - added: new figure, Bézier curve; - added: a frame for the properties of the draw: can add label, caption, position; - added: double boundary; - added: the borders of the figures can be in the position "inner", "outer" or "middle"; - added: a button in the codepanel in order to close the panel; - added: a button to copy all the text and one to copy the selected text in the clipboard. ************************************************************************************** Version 1.0.2 - 10/22/2005: - TeXDraw is now LaTeXDraw - fixed: bug in the polygon code generation method - fixed: bug in all code generation methods - fixed: bug in the ellipse, circle, arc code generation methods ************************************************************************************** Version 1.0.1 - 10/10/2005: - fixed: bug with isModified attribute - fixed: a possible bug with open/save actions latexdraw-2.0.8+1.orig/build_installer.xml0000644000000000000000000000162011347255510015375 0ustar latexdraw-2.0.8+1.orig/META-INF/0000755000000000000000000000000011347255510012640 5ustar latexdraw-2.0.8+1.orig/META-INF/MANIFEST.MF0000644000000000000000000000015211347255510014270 0ustar Manifest-Version: 1.0 Ant-Version: Apache Ant 1.6.5 Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.) latexdraw-2.0.8+1.orig/res/0000755000000000000000000000000011347255510012271 5ustar latexdraw-2.0.8+1.orig/res/texEditor.png0000644000000000000000000000070011347255510014743 0ustar PNG  IHDRĴl;bKGD pHYs  `IDAT8+DQ5h(C!Q6fi55DiKHIȂXvlX!$ɂ^ea3S_s=ν.ֈMgkcl=[|zq".Ao r0_VA'COa,%ۍY1'&}QG(>XbM}f`Ú.Ŕ{" p a _~"kpϨmlNf?0 ^p^A5LxGGtIRsf5vM y~QP+?݇bEx|.5 N`*s}G4u jA3ϠCeb]t|jskcfe ESl4IENDB`latexdraw-2.0.8+1.orig/res/pdf.png0000644000000000000000000000054011347255510013547 0ustar PNG  IHDR bKGD pHYs  tIME  /lTIDATx͓?jBA' vA+`cx ZJB`cZil~6?a a[찳oDl1cztC/d϶}|wٓX%cOz 1`5FSA=NUY= N'Ae ? /|\PP}&?{ƂVA4X蚼4rkπ: ,c V_!ɽtctIENDB`latexdraw-2.0.8+1.orig/res/rhombus.png0000644000000000000000000000147111347255510014461 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8_HSQik贼pwk̴䲋V DQDTp!Z"A(zB+7C:-tk%ea8w~Οl($an,2%ciT6[o:0),cK4?Bk[ 0Iա'p֒]{~"֞Kn3,**:4==00֤m9O.IbBK[;sK=&%KQ*>mNfX '.BYҰM֕%ώN|7ܦBP2ZFZF( g;Icׄk~߆\.WD"ID zVn8J \JᷱmFIqk@ (Dփ{Qf,HW҂yu8JSɺ:*"$8%;&7"DLRWA5S)7R4{i{[(=e?q?8"IfnxZC}vEfw')11g6Q'cpP![ܹ ECiGE[.;I |O-$OF+Xt9*ux>-_UUU]Bau@''vr7D *1,Tfszc ,> d2}'c MuuA!(?TXҸVIENDB`latexdraw-2.0.8+1.orig/res/text-x-generic.png0000644000000000000000000000101311347255510015635 0ustar PNG  IHDRĴl;bKGD pHYs B(xtIME +l|IDAT8˵jAoV* (*Q^D =Hb0GAQ<,(!eA͸  ;<;0Jh<>S˳w^C=FƼBzjy*"â~rlWH OUu[\~)GQtuدedGx{p m;հ3qIENDB`latexdraw-2.0.8+1.orig/res/triangle.png0000644000000000000000000000123311347255510014603 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<-IDAT8kAl6qҴZwOD< +B{j=x@,8T(DГ^D )dhݕM`_|030C8T_PӴl6/s5(Rŷ,+s H!0QbZzD7Ms[M2y kwAabرオ|zNZτ󉯵ZMsg@ <j BS[dfl>4K+˲} /*dc@ M~#XoPZ}HDz~g0v4qyW^?FG~14oc ~ڑ0@foŠ]~\(N35+r鶓b!GsUug-HDs~=jCN 90}}hҴeYc@=a$ Rt6hRRy $?:v}kh%RlNyh.{A%NhǸ#8~ZަF  ]דp(ޢa5[TIENDB`latexdraw-2.0.8+1.orig/res/emblem-important.png0000644000000000000000000000211411347255510016251 0ustar PNG  IHDRĴl;bKGD pHYs B(xtIME  ,' FIDAT8˅]h\Es?3Mn?BmĖT0* F+D)>>Ԃ"} *Z "->hZKZLbӴ4d7w{LJMp93ga?p]Bh’y⩓i^5䶝Ǖ@}0[,P&;1$܂F_7DTKj. Fdt==Hn|ͥouqڱ,[/6=E@a'Ӄdz+'Z [uY(-YV0Ԇ5ceS-4y*(U"h`e-z>%sWG?Iuta]ep}[;B!+'Ѭbڕf_ZFw ԷU[U97`Ŭ &kT#/*U!%-vW5ŭZs]U@c5ܙAF7EӐUM9daipDfٗE5!")V yą % 9˓3m}>"# x`X溊Ǫ[ gzˁbz}V_(@C7K1%L:㚦} /s fDM0+tN_Z3c#˻xSM~PVţ?v`3S#7m5w+ Ƃ5t-6KK!H Є|,jRM;n]m=}#[Yc pq̽9ݸ&X■iZ> illlT$QUui#SֶeIHj~BP˝cF6Ml&{󁶗O-߈#sZYqI$֦*c4OS`֕jf@.܌̥l)PUY6k cWw-xK$KubwxZD']ן4-waq)=F>[tKZ!tQv*8Qnvyka<@x:8:'9ŧ녱1c_d{و%W\4M[*@mtkyZtrBU4H.ȋGί_\H`X6^\Rq.`TUM,Pn([ƨA_d2Wɐ% z%.xy駦 Ovݱ,+:>>~ ,dfz)䁣K^RHYd\{A:ж@3^^^(wW-3NA%TxL Fp/3H$z0::ztMww 9m{R(q۶m07p88Jme۶PizzzޓDf5ٶmOH$2\p$" ?IENDB`latexdraw-2.0.8+1.orig/res/separate.png0000644000000000000000000000071711347255510014610 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<aIDAT8ҿkQo%`,Zl4TZXXD "B,-Ig!'67o/9nwq`y;÷N6Ylc=3{f2Sfp nx˖s'[`?Hv <̛i;炭`׫&`0.`O2^D+'GZu w``'vj7kl`3s)"*gpuB5|?N=؉*"9+8P3+.{c ;K#ƙãeX]ט0 _CЭeyT?84"nцIENDB`latexdraw-2.0.8+1.orig/res/list-remove.png0000644000000000000000000000037411347255510015251 0ustar PNG  IHDRĴl;bKGD pHYs B(xtIME ;w({IDAT8풱 a F6n` w#8#aֶ"]Y؈ Gx !$_wnN=Tzn?Y+FMIzWvgHi\o$p.009Ʌ;,pp$ݥUIR Wb1OIENDB`latexdraw-2.0.8+1.orig/res/axes.png0000644000000000000000000000066611347255510013747 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<HIDAT8JAZaEV|QPSS 513A|Q 51`{uohk*($JRUIv6p,]K ffTI߀,CI @̎QieB`׉ůzPҜCYҵ+O |XPJ0J20$通я%Ij IMI XҤ{"D$M]>هt@H_hyO_O7fvW&y+[ -`+p T"))x|\_1G$fسQ"9 86VA90$?+sIENDB`latexdraw-2.0.8+1.orig/res/freehand/0000755000000000000000000000000011347255510014045 5ustar latexdraw-2.0.8+1.orig/res/freehand/curve.png0000644000000000000000000000110511347255510015674 0ustar PNG  IHDR8NsBIT|d pHYsnu>tEXtSoftwarewww.inkscape.org<IDATHϋMasMS Ĕtf%;P66Vv6J!EQj"e,K )b1A~d1<]&7s9s2O};sy>ssGje 0ux7/^eyeX4T>QMLcc@744sn-ZLι@0O1@{}؊C瘉-aZSA`;0a?c?c*rOFCP+NOϸoA\~[.CU8ϱw@smDZi)e%Eb7^D/<J|u đ:\[+ ǗkW_5@G1_8aj]Bm7ϟE|7w8)N;kÍUl8T-4a ZTQ^97-rRJsS ؾʥ(IENDB`latexdraw-2.0.8+1.orig/res/freehand/line.png0000644000000000000000000000103311347255510015477 0ustar PNG  IHDR8z߮sBIT|d pHYsnu>tEXtSoftwarewww.inkscape.org<IDATH=HQCDd""ѩBil!"ZBZ[*&^ "*8x|OtϽ9SDzXQ58Eī$ED G0\t~/]AᇖAB÷hmU#ۈ^Z]U+EueNZTk} EĤm慜2IENDB`latexdraw-2.0.8+1.orig/res/rectangle.png0000644000000000000000000000061411347255510014744 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8N1;2$ĉ&.H kwk.X$q13 lMNzۦ_Ͻmj8gKJ@Rhtm>&=O 5Bp&yIΤ^x$ VKDLrZe#&^}.k0f1"mǡDUcn;x&ͥTOEmr׃tƸ3ĵؐ=^ X|,)`+=T0~um~n;SIENDB`latexdraw-2.0.8+1.orig/res/circle.png0000644000000000000000000000157211347255510014245 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org< IDAT8]h#U9IL6m!$օ ֽ) [Rw@]BAz㝷K* 셫 CXJ& Mi,i1ͦ>̜=}缊s\pS3Մ"|k}Ӷ/[&J)iW2XgT2/`sز_j5o"b_9맧P쏎3r}m;0d2'OTtOUUU9JUnӗ%<+!-ႄ^f[ەx|%4݉3OTuRIORL>?pO_>}l7Lr\@BRI'"Ҵ0OC=m0Z>Ձ~To/ p|utgDRB|{UXWR]nmnD ңi;e2.WWG%?g/"cmcr$p@e |(M%`0x߲pݟܸw| N =!B]Dn\֭p $wFGGߨpxԩiR]QRvLɫe؛i*‡>|~n })ggg;V3333_z4q>n!gnnyH:LFfl۾P,Ck  Bh44<o7K$\/כbȃva*)^L6b6Z7 zF >f "QxUifm^1Q a,Mj6|]C>[[{GԪ ~-a?,P(/0IENDB`latexdraw-2.0.8+1.orig/res/Undo.png0000644000000000000000000000176311347255510013713 0ustar PNG  IHDRĴl;bKGD pHYs B(xtIME 8?TIDAT8˭_h[UǿM{]t\u>̗"[բȊ21ʄ>QEA>>8(/ -[ctaݬڤuB{[.Yxǽ=øtnd2] iK CG43vHoCg{m`e'G*~E2ްpôS7N`U83#<F0lr/}AC"JG^G=P(=lxtÏ?=P%l-ٽuW3Y#Y\)6fzUpx{i{z%dV+ CG64 [_|i\ǟBy̷zDhCӬZ¬@O~\[I-""fx嘇tuqi*-lp/OYz? +YPu̵}GxMZ]܅սu1AE,IENDB`latexdraw-2.0.8+1.orig/res/text.png0000644000000000000000000000053711347255510013770 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8͔=jBA;36BY] KpGp.!`aSZ v!x#<<ܹq$R%=3ko/<+i|] Xp(䵁&0(nށIyb`|[` vcjJXd!/'$}_rX:'T: <@Tl9dL/J|Ў/%۹kfGQ {X?7U{O2mIENDB`latexdraw-2.0.8+1.orig/res/select.png0000644000000000000000000000047211347255510014261 0ustar PNG  IHDRĴl;bKGD pHYs  IDAT8Oc?-- 9j0"dA@P,ogPظ`afhFXh)`T_>ؓ YpaCg""d[Ia Nl0)B} F>'7mp%Fk'2܀E9c8aa#dW }_-!>H-zt 3h aY`F$s"f.x+'MIENDB`latexdraw-2.0.8+1.orig/res/join.png0000644000000000000000000000067011347255510013741 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<JIDAT8J@bM0+/R½n| W\Ck7pmmqafbbɁ704N4UEUqZ ̡ s̲.<2|2|x捈[nqpIDHDm!aF[dL@UYNXsX3kX(Ya=gC;ʀ{$2Ѕ.u }< 18/p @P<RZF-af́:U4F\T>]۔ HaV%X!f5G0w[_abLpLn9/JjIENDB`latexdraw-2.0.8+1.orig/res/stop.png0000644000000000000000000000064611347255510013772 0ustar PNG  IHDRLѥbKGD[IDATx/q?ѐkKca``jObbiA$b,:jr.Y!oyOT QM17@YU^.'ʥd^T"HNs;̩n:K`2,5P@TI6ⵞTUEUH|F}we   Q$%&8'Sr3e`ln٤"-1^P!K؅޽{ÿ0xiTu]RsGǑ%/_vƍSkBOMOΕr{3;tI::N* Xb: c\JR  AXFk & QƊX)لֆT*E 2JaH!>J.R XM!N9ٌy M%B5--hTN$"cQ˸ tI?G_oƫ/}Q .Dwa_E5%K4!^˽ɼ@﷔ o^|:*uh5/5@"jQ SFY^A>"oIENDB`latexdraw-2.0.8+1.orig/res/comment.png0000644000000000000000000000071211347255510014441 0ustar PNG  IHDRĴl;bKGD pHYs  jIDAT8O픿KBQǻ!a9H$D1hܵ"Z!AA*h!"_y7 x9{N罾ܧrggKegl[uo u栏%m+ |YNP! "~%2\e*"q8V23haڋZG ?f~;6iĠ Isf˻ /pIZSp;p)ݏO2̸Eccmb6}p0%BFK܋/1H&DAŦ  >Tors=s2|?ŽG3IqC˥߼/}[GׅMrJRg(L,h$s#/d%%#so}l|tD;6>^}LO_Ąעȳt鵠~G/|譄E;o[~}ye}SscԩHjG:u}v=ҊJPSC䑏8Ê"DgHƣXDO']+fpR?+c'uog*Y!,6_8ҳ~Y2z]{7熱.~>:N墈Njev#HɉjxH$b>#at5gXH&9{l, s[X !ֳZ.D"ic!j寧@{ؒxs^[?}DBx,BhNwiw8/-CZٜ#-t5ogdAZU9y;7$e0R/r EQ$ IEWF7EAhbth*6م-wlL*R5P$IԹ612O:;6Qn *pXh$6;_nu<%IaG޽r 3Nvgrjo; dK,|B~Mjkku`0=6~j~`2ÕYyIK\N6&V Y3XXh̛,)xX yhC煵p:11ēmgYCLLLp'nJIENDB`latexdraw-2.0.8+1.orig/res/document-properties.png0000644000000000000000000000126011347255510017006 0ustar PNG  IHDRĴl;bKGD pHYs B(xtIME  (`{=IDAT8˵kPL4#'xʦ'q9Cwh뒺{O^7x $?0@%vDIPס*Gq{⻻w'=O"BcQSJ|t~* ys^^^iJ)񻨸Lfc88??O@nJUWSBΦ6l}})l`)%J)<=! -5!NS. NP|\bqq!cZհ,:bq˻q s}}MZ}|ߏ35϶ml4M6anIӑJ)g8^ZP&E̖zT* hvMO_R!܇9A긷 ޠC3|.ȹ M[ᬑXY.vc3ضUTP)h~ ͯE} oU,N8Z߮$Ff.$ԌR O u͹ϺB$>| jK_0 NWՀ0#r JI)ةS2{Z tBr"d.KEk8 }Mᤄ<IENDB`latexdraw-2.0.8+1.orig/res/CopySel.png0000644000000000000000000000120511347255510014353 0ustar PNG  IHDRĴl;sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8=@$|(5'(qRP IQQPF'Dh(\K((`O8nzǻϾ3;EUeNgًu<;` "_,߼s*h_0Tcc4" 08n 4l6k_J=X,h6a "ɻN$$ܖ_ "|$JX~~k|R0l6{fJ/"VLym4^ JUJח"8`0(U[ǥmM*Ae&'R EQf-NR)|Wm8:UE$oZ8t):BDIJ,g4}y><uy<} q*RqEՊ|ͫ}Q"`)z=SJpyamۅ bnl.k2x*v7.WGbZ%#nH|p41qFޓ3༉H8fo}_ a ~IENDB`latexdraw-2.0.8+1.orig/res/rotation.png0000644000000000000000000000155311347255510014642 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8Mh\Uތ3IL`% -n-+Q" .lUFn )*vQf#f!E8H?mҦfK3iy^q{DUY"{XU縓Pm2о q3xa\SKyg,=1{.: }`J@j("xttUI0 TuTO} p V՟ZoCF҈v\Q *oT+O=2QzU^j!tfBdⅧp hX& 7?lLg5 &DBԍ\3`$d<8 2w,ww`Fm;7 HVIENDB`latexdraw-2.0.8+1.orig/res/dot.png0000644000000000000000000000105311347255510013564 0ustar PNG  IHDR bKGD pHYs  tIME 8 a.IDATxYJAnQQ< WW T73c}UUu @'䮼.gs`Vdٺdk '" F[x,e{G.>e`dYىc^jBF r ȵѦQL0-Bwc]ImL}0_4% \RJX!m_4Op r,r[iiD INq4"vx>ϷTJGbYXp7բ^ }ɉq-3FA|g. $ ,"?] H>l.k167!򗁯*Tc^b fzVoqEMNrItQ/k_guP ~m8IENDB`latexdraw-2.0.8+1.orig/res/Magnify.png0000644000000000000000000000115111347255510014367 0ustar PNG  IHDR gAMA abKGD pHYs  d_tIME0r$#IDATxӽkqWt֡C R|@ t@(i;7B\)J piڦO~ ?}S!븁g _b}wqp"#>0}8 @e4A|OhZ ST*udY&"x7?$߳J=8yNU8JwΡ@a "An|.tlLo_бLer< VJ>h?THTVA\h'< XL5jPP.S.S,dvvVǢ(Rvt:Fa$k߳Vi n]/^n{uoJZ3}0s.`AӞILޞSOS<3Ժ?;ILR3m4r3khh_3nȑnIENDB`latexdraw-2.0.8+1.orig/res/behindSelect.png0000644000000000000000000000145211347255510015372 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8MlTU3QBJh XaBLwhةİdB vna+>,`aB 0ja,{~А?qID0SOIL `Ċ Xx:fu>3]'!vJ)`uowSoI3U[ޤyh~{+Α=,aP orY;:u[Nv)*ef7z6N3}j0FOm S%= XMȫN]Iy`ٷ,Y'I(OÕh)Áb!74nS<|6C3P8x(mY}i|Ś~NMj(B^d2Yy2jwf ʆ%*6vo1VC8*_IkV_}+pn;L!iW S).u#,&7n$_P3{Jlfock 1o6&nu^C%g,dB_@g@A}ά }xmЏ[YʁGRbb 1Bw6ZÕX8fԧp O]f6 Xc񓤥Gnt,IENDB`latexdraw-2.0.8+1.orig/res/Redo.png0000644000000000000000000000145211347255510013672 0ustar PNG  IHDRĴl;bKGD pHYs B(xtIME #K(OIDAT8˭MkQs#4֊"T VX(m,. fGŶ ki&G373Idx0p9s.cqn} X\+ _Żi?xnSh"tIo&Eb[IeyD"pj QZ]ZrH%pS Vb@4æX\?`Qei+Y  fIy|%\3 _\t&P(emBEl E2 @xJ̯BQ;`(Yip- @Ш iUr]E-hmDŽVlrfv9 ip2 N@EDK.{[BAZa˜[ t*/MVλ?4$+}T ib@R/ °9 Oe]:7xzGt\.R(;L_*OF^5T)D Jebƣ"VeUߊcl.wXora?>V*ڡ.|eZK:Draf{pj&ǖ#s1I[ •G("OjEu3?:!nAnC:cIENDB`latexdraw-2.0.8+1.orig/res/BezierCurves/0000755000000000000000000000000011347255510014701 5ustar latexdraw-2.0.8+1.orig/res/BezierCurves/closeLine.png0000644000000000000000000000034511347255510017326 0ustar PNG  IHDR8NsBIT|d pHYsnu>tEXtSoftwarewww.inkscape.org<bIDATH햱 @ mDŸЂ^rT>E( , M ӂ @rOkH Ӝ'~LD_iOiAw/Y۞0IENDB`latexdraw-2.0.8+1.orig/res/BezierCurves/closeCurve.png0000644000000000000000000000103111347255510017514 0ustar PNG  IHDR8NsBIT|d pHYsnu>tEXtSoftwarewww.inkscape.org<IDATH׽kQ]#I!SRERH i ڙOhec/Q$,D"`DD%gY dww8{}DJaFjFO5R WO)-$UQ2~"puM# K~\ &q y9) 5j+46g8߲<;G[N<_p9c?0޶mT? =ھ ;M|h3Dɵ>-bSƚz&r10繱uDRD^7{K^:k+L[ ډ&Ӱ6i؁*XGDpW}W)o-Z)#_zRIENDB`latexdraw-2.0.8+1.orig/res/InFrontSelect.png0000644000000000000000000000154611347255510015524 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8ke-&%EAAKjj+ŅkJ/ЊKEEQiUZ".-BiJ'QK2iI︘K3I>p6<UN`CTGr_t*z׹dYx1Ƌ'b<"^$1 hbH8Q.j =0*K%Vwɿ{4\.7vra&p s4*#Nj 蜫68v2uW\`W'"3Ϫ:"Ɔd9_]n}Xu|rߍgq)GTD5Cg8|pCg:g3fCHm361i.| K,q#G9nO֣y`?ԁ0ьucllsOc?gq1˹>NݍMLC5d HkhMzBw#ofkZ@,F3!ı#jSُOI/ڛ_a& !PqEݻGyƯ=i *b`h&T_7a+BYIENDB`latexdraw-2.0.8+1.orig/res/image-x-generic.png0000644000000000000000000000160411347255510015741 0ustar PNG  IHDRĴl;bKGD pHYs B(xtIME 1)IDAT8ՕOEޞޝf1D#Aѣg!G \<+xYL uuE#nc&̄=d3;{ig2hbCQUۥN, ,cX91Qy>M!F١z@: ,VGgÂI>|?Q)[@oeXGm#?Œؽ`IENDB`latexdraw-2.0.8+1.orig/res/rotation180.png0000644000000000000000000000150611347255510015071 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8݋UU|hΘ9"XEAPAe"h`P7 HP02tчX BY# M0|.ΙqQ}YZ23 il̎5 &_k)vΏǜJz[) ԁ;@ l~Thv9؋C/ 5w `R0l{ lwg_βK_(Jn^??._H:5Vmvސ,)6:XxZ_]Xվ'=۰8 F1_N⤇+^}\uIݴRɨ\P\}حY~῕2AzI %ъ›>HRD5OT : jz=OTaFzCPW~`a>wc}8bp 4nO" afj^AٍOΟƥF%1xJ@8/99K9doeˋTɼ7>M7dKAY(Q羟=9\;zFœIP$ߛ$rNn7?|BکJxt"l9H3DX؃DA~pW.v-ത0@;^ |Myxqx8$m>U䁛! lC)yKZp%q=lMDR{d_IENDB`latexdraw-2.0.8+1.orig/res/doubleBoundary/0000755000000000000000000000000011347255510015247 5ustar latexdraw-2.0.8+1.orig/res/doubleBoundary/double.boundary.middle.png0000644000000000000000000000071211347255510022306 0ustar PNG  IHDR bKGD pHYs  tIME  5tEXtCommentCreated with The GIMP for the TeXDraw project|vIDATxڥԿ+qG.?.1\IN0 d(ؕɄb$N?pww}هڕ6p5Z;ˎcchTHy59tUĔȚf51`͚;M C'֍&/11S8SoQj1ISo|[hV7:V:IENDB`latexdraw-2.0.8+1.orig/res/doubleBoundary/double.boundary.outer.png0000644000000000000000000000072011347255510022205 0ustar PNG  IHDR bKGD pHYs  tIME  9X 5tEXtCommentCreated with The GIMP for the TeXDraw project|vIDATxڥԽ.QX%DbCc!!ZR)q Q{@|۸ "D$dVUbd'ǛL>ɜ9h_8PMN vg_Q^L!l )=b \`7gOj;T{ |B97Qr)84GK~N>>JJIPPIIII%sbb1nnnHs=IkŪ%øHkԎK|ntRNS@fbKGDH pHYs  IDAT[                        x;l8IENDB`latexdraw-2.0.8+1.orig/res/MagnifyMinus.png0000644000000000000000000000114311347255510015404 0ustar PNG  IHDR gAMA abKGD pHYs  d_tIME7k IDATx?o@'Ȃ1z*$&ur-&Kn$  $b,lH拪H@a(/nMI'w(.՜-,3*x le -ha/PJI!0ƠVz!ks8Fp])rc a|>fVRM0z!RbGReX ;0pǮ  oyhف8S {|RXXdrCc kk9~.)qQcs<ָn p:s5tgW6GӀEph4zyxH}T~Z^}xk=~!syը x{k/SzIENDB`latexdraw-2.0.8+1.orig/res/align/alignLeft.png0000644000000000000000000000122411347255510015775 0ustar PNG  IHDR]sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8TNQ=y,6&JBcae/ +ҖBh =Xň0˲awg{,vXaQ};sܙ 67 Fso?zCDm ia2KXP A:3 dnm?}`9]ⰶ^ѺK*+c]P6&d,Ɛ|~%̄B3(4SF'VxyCc6twן5C F($i9 h}Pjw.f}̹75Y[{Y7o6okq:>@{!vpQCF[ˁv]H܎*KK8P}Ր¹\΅~ܠ/"OUH jT !DUqyyyAUXYYy1 w߭?sPAZsgtz\*i"bT5WF?Yqj81$plZ jဇT"2U;r?O<HIENDB`latexdraw-2.0.8+1.orig/res/align/alignTop.png0000644000000000000000000000125011347255510015644 0ustar PNG  IHDR isBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<%IDAT8Aƿ73I wZ 6U$AH!WXY؈hc+h,,DDNPAKdN6a>vxo x}QVk+rǛQse6}\jw1[y|ʭb)9/ƧW>ޜ䟷ZюRլo=DU9|4-Q[Daڸ=qK@ЊC 4˟[066wV[fq"⬵y\nLNN !D@m=r~z68 {Y@ $@ZV|sLFѨlVOuh T#XJ{o-:UQ1 s Xi  Z⪮ttŌz-fP1oz<ºso;ľb"cbU0d! \pn,-8K஧v WE}䉮y}E򇹵dH~Uvɛ׃rg|˺7ϟ@aI*b@b F%ArΈ^{߽~'#GЌZٙ=7ٱh!ϿfxG2 ݷkAԨ"tBKݝ}1"_M*JZïRggȇkw_ۼt1+J򲘋}y6<[4.֥LMM\`g̎IENDB`latexdraw-2.0.8+1.orig/res/align/alignRight.png0000644000000000000000000000123111347255510016156 0ustar PNG  IHDR]sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8nSA`;8 H[J"*:D+ (y SDBH:K ׂ ǎpNwۜˆ~jRUO{RI[ BFXe; @χ "By76"f7zv{;.*Pe`Ԋbzz2AQ8ps5h SfgVdmtt-l `Rc7qz _|$:]O!|p&'b\6'b@w55{qUq;&n6KRz P˩h\>SR`HR$YV1sH%OB QQ {T,55Ue1"r""vD1H^xYO_*IENDB`latexdraw-2.0.8+1.orig/res/align/alignMiddleVert.png0000644000000000000000000000134211347255510017143 0ustar PNG  IHDRgsBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<_IDAT8TKQ=o&!G~2ACh` Hk[8.t  Z*h٪AA+6i8Pp jY8f޻LH=RUt˗.ԯN5taY9Xy9 U]]'O]O` WۈlxgO(Ekol<,_gu`q Y,Ik!#D]>4P T-5qU)3,8)m<-gvV%BEYbӓPRQRR/ qw.Jֻ)nzJ^^ + gKKoA鵵DV o߇vض_iԴ l)E(;1cumhjةl`q/sPY~156]SU=Q'0Ƹx<[\\|@>dRG{o[vgffO @HlcQB2#mDOr`as`qMT**L#0n ɟ9`sDg)Q:_D IENDB`latexdraw-2.0.8+1.orig/res/grid.png0000644000000000000000000000340111347255510013722 0ustar PNG  IHDR pHYs  tIME  ঴5tEXtCommentCreated with The GIMP for the TeXDraw project|v_IDATxT"wnnHHn::nMIn &4f/ ###dn &4e,c Ff##"\neawn &*cFw #Ȥ`"bHHH8\6*Dś\ #d";nLwewwA"wKbsIENDB`latexdraw-2.0.8+1.orig/res/dotStyles/0000755000000000000000000000000011347255510014263 5ustar latexdraw-2.0.8+1.orig/res/dotStyles/dot.triangle.png0000644000000000000000000000074711347255510017373 0ustar PNG  IHDRXbKGD pHYs  IDATxڵ?hSA]QbS$bPAJ]t .(M R7i 94Jy/Ip{{RJZյ34_S3Hu癋rTCZuKy80o^F |B /ҢBϣA!Ly|xavZB %/6-rжhb$PhcJjfepŖj~u$3Sv.(6= 5S! 3*Wv39Î+Ьou}Y(F&uY`;s0| 5v_P0m;hh3Hku~s!IENDB`latexdraw-2.0.8+1.orig/res/dotStyles/dot.plus.png0000644000000000000000000000023311347255510016537 0ustar PNG  IHDRw=bKGD pHYs  ;IDATx10BQ:ؤf P70p$n0|'UIENDB`latexdraw-2.0.8+1.orig/res/dotStyles/dot.pentagonF.png0000644000000000000000000000056611347255510017506 0ustar PNG  IHDR}\bKGD pHYs  IDATxڽNAИ((Q0 #%D(31!9xPjmnI.\gDU-Qc[.s|t## Xh$N h'nS^/~XKf]K ]-ͅ1pQUBXe.;<w[k&{]˱-\$'9Mi.":E_ n#E{,Rm~a^1aD̞˭l&dIENDB`latexdraw-2.0.8+1.orig/res/dotStyles/dot.asterisk.png0000644000000000000000000000066011347255510017405 0ustar PNG  IHDR]bKGD pHYs  PIDATxڵMKQ4i%BQPVfbBHp.\~A&QmR᪝ ZQ"3dr}{QJd6tT7UA51>Zlh;!G]J9C@Ny}IgcY==ŋM#2þkR/ϲr4G9e6IJ׸u|h~= s" (]Bf4?LRk"SSZ̎P/ZZ~ Rrm2̡Kxui,̱J0槒Ka'k.Ph(BihtI];H*?W~OkIENDB`latexdraw-2.0.8+1.orig/res/dotStyles/dot.diamond.png0000644000000000000000000000122411347255510017170 0ustar PNG  IHDR BbKGD pHYs  4IDATxڽ?hSQ^^^|Ib#4$Ԫ#qA:HqqQ?SuR'AB(dd(Ls_^.߅w瞋brR0haSEh<ԶqA&@XͦQ;Ō8:"PRIj-uD(BF߻ UNsXV,GÇP@Y{ E؝`X&3"?HB pZ7AӶ]W@ ,jQmc a4,0Y`8q\WCs"ecxaыe!ɠB"~1=/ #1FMe [*iUٶ De(EЪЉ628L5FGSɺ\>6L^Dx o&Ma7Ͷ0%~Mԡ},&I)֋{):bńw"r7/&n9sGcٛk"czcᆘelZXRm|k!.yIENDB`latexdraw-2.0.8+1.orig/res/dotStyles/dot.diamondF.png0000644000000000000000000000116111347255510017276 0ustar PNG  IHDR i;bKGD pHYs  IDATxڵkQ?Li<EhsB"D;k4VJ*AbB"pH8⏽{68,Lg|}ڨ׸&OP6fZt([˧(ruMѼ<5):6jEVT_9-q3G] 8ZÀa;'=ʵ`19o3]Aq +r*5I0'BTijﳞ3PNrY yWìeS  KOб#\OK8f _F9b`Y>nzŠV yЩa3,; ,f{朣2} R/;jeỢ|c#2HDi^Ğ0|4 i X$|q2` MchNa|WyOq|"Dge _KcI34 > LM7*on4pL^)=X@QUj05@EV,d+i(K+IqЏV%Pc@@ -2i$ }wv{ "P%0F1-1Տ֊~Ԙ1VLe{bwfKl$30x !"4ԀϿM0/nhz#7} Y9g퀞@aZ,LJ VN. ca\IENDB`latexdraw-2.0.8+1.orig/res/dotStyles/dot.o.png0000644000000000000000000000101411347255510016010 0ustar PNG  IHDRbKGD pHYs  IDATxڭJBQWH0+!jd$IQ 3լF#ߣA ,ۂ=޽:쳌Ks&\ x9ԶADZGp }^NB.C >˙)ҿ<6_?r_7 -IsrJx".'bLֹL~sU}CDƘs'"sa[=JJP+ PUsjWjfK\X",fI%]&E{+XW 'EC.I} qyPV]*J,D81kj !`Otf4)%v;+tgJ8[,1OGԏyt#Omr$W(DV8u&s DbQ⪴oI<ٕpIENDB`latexdraw-2.0.8+1.orig/res/dotStyles/dot.oplus.png0000644000000000000000000000103411347255510016716 0ustar PNG  IHDRbKGD pHYs  IDATxڭJ#Qc:;`"3 xY 8+ >TZ\=-R4 OK{#jU~:W"B+,ͩC;z ?'+ b_4M)nqPλ$Hawdb|s.IKӔ4$wP KyJչ«WJT `ǢFH&Iᦓ?&M%sWDVnIԤ]yT$Q*pSaHUWH3,y롉(D=iYfM}x4)Mw:6z6"@埸g&1Mtfp@RĎ)EKkZL_e:' $"/LaK7V%˒-df$-WX08IENDB`latexdraw-2.0.8+1.orig/res/dotStyles/dot.none.png0000644000000000000000000000056611347255510016524 0ustar PNG  IHDRĴl;bKGD pHYs  IDATxڵAN0E]ĭ*V zr$$>;$n9J4oly<Ue0]TJ)"*":RRsYwUuO79h^[;My7?T/KS>5o%űР3֪n_[b۪ݬq(*"uTU #X2c.x^ykP*cslycm&;ms| 4ʗ.%`6$c}?[!IENDB`latexdraw-2.0.8+1.orig/res/dotStyles/dot.bar.png0000644000000000000000000000026711347255510016327 0ustar PNG  IHDRUbKGD pHYs  WIDATxc?)q_ l ?~@^_ ~31F-lԲQF-lԲQF-H`cLhGIENDB`latexdraw-2.0.8+1.orig/res/dotStyles/dot.squareF.png0000644000000000000000000000020011347255510017154 0ustar PNG  IHDRVΎWbKGD pHYs   IDATxcd``@@%0jШA4X z#omIENDB`latexdraw-2.0.8+1.orig/res/dotStyles/dot.cross.png0000644000000000000000000000043711347255510016713 0ustar PNG  IHDRrP6bKGD pHYs  IDATxڵ 0_å Cv37_դCw) Ɗk0fu\5 q 56XI&]Aۻ_p ?TIYлH$R._H)ֲe4 f> 6f34c}6srN&SiӄT/v\x(IENDB`latexdraw-2.0.8+1.orig/res/dotStyles/dot.square.png0000644000000000000000000000024611347255510017060 0ustar PNG  IHDRVΎWbKGD pHYs  FIDATxԱ 1B*:/@߄KCݑT"3!Ie(45@N^A.'ůIENDB`latexdraw-2.0.8+1.orig/res/dotStyles/dot.pentagon.png0000644000000000000000000000105711347255510017374 0ustar PNG  IHDR}\bKGD pHYs  IDATxڭkQ?K.1:X(:Cqppq\\\G:trӡ*VATpAP,4: i${HpX~KY.7?4zWr kʥ=Y:Gٌ'OR_ #U.3k֔ys|ng(q/p5dy_s8v\Vfę!^X+0Ƴ8gXEo01I4}{a{jMEѧo0_9вˢ]%Cűx+3*jo]·Qց4X.pvU`Z@31{zW1yy9{}<\ruZsTL>i)6f #:?|C+ySIENDB`latexdraw-2.0.8+1.orig/res/dotStyles/dot.triangleF.png0000644000000000000000000000067011347255510017474 0ustar PNG  IHDRXbKGD pHYs  XIDATxڵԱKayXeT 5 nQ[Ck--?DH'ojwoyޗ5~pIh'Zk5alY5&msef9,Zߑ7h%|& ŸbWJ6 %&w!%I%lK;xW)[+=G71x8[R -98sN9\gO(jr1x hA[t$RqnBBvR3\v*lvP_Em)[{?H?!s~ESIENDB`latexdraw-2.0.8+1.orig/res/emblem-unreadable.png0000644000000000000000000000163311347255510016343 0ustar PNG  IHDRĴl;bKGD pHYs B(xtIME  3K!(IDAT8˝ˋ\E MYAYeM #]`q1$W&D ?3:.@qέ;9u`7oX>61/s= ;^gWѶ]ATEsUzwyハL?:b$5ZhR24Тu0`DiѦ_"֡z Ƈ QFf~~B `xVMY,8Pu!*1Љ(BfhSCU;v؆ L$/^ ☎$ɕZ&KNq$$ĥK,-/3w^wsxHU u?[,&oN| D4,"KC3zݩs6.I$ES??#hCUe˩m5Il% =Kcufc&']ru4A%Ha ./2=~<[[^I xR U,(м9?z4~$^«WR yA*h>~LZh]Mkv^Z ʨJhU(ТFA搦AM3 /eV(pYK\`_?wYLo ~tO`+ TQuɩ26o=]97j}ۆ[O7ޛPgT30ڟwꛭTzHz+"01H=  # ڸwmw.Ȍ]E︒_{w\@HDgzlՊ¶mɺq98+sr~a_ܯ[sm)q @QKö1\8xxT_:ʱңF蟭Nh|4m7/P'T#գo-GrwX< ;'쏵Qy] -OW*b2u1SIENDB`latexdraw-2.0.8+1.orig/res/parabola.png0000644000000000000000000000332211347255510014560 0ustar PNG  IHDR bKGD pHYs  tIME  t_IDATxT+%Z  #g )$] x'"a$dB:B#g|!  x RI8)2.HIENDB`latexdraw-2.0.8+1.orig/res/MagnifyPlus.png0000644000000000000000000000116111347255510015234 0ustar PNG  IHDR gAMA abKGD pHYs  #utIMEDIDATx;kQgYHL" $6kH5 h d~T6vF&NLWHn'Tnfs87I[j5e >npe.\f!NDE0y˲,0vsGe>Cl PSW*<1Û?*F$)`LL&&锅a(IC3+QP@(Cbς AQV2pb)yNQh4vq54,S*X;/ڲ,ST`(y RnL.͕ 0<0ln.$8mE&y0MӛһF{KJERq:߶yyi'Y[d+ښʊG<|p _IgT>֙uaֽOUO7̾fxsLk 5X]eyY뿀{h_'|>]%&DRb[>\az@Dc˲{۬בN,Cc ʪ-{eB@J/~ώ s`Ɏ?\IENDB`latexdraw-2.0.8+1.orig/res/closeIn.png0000644000000000000000000000102311347255510014367 0ustar PNG  IHDR* pHYs  ~IDATxm=hSa&7!ş&&-R0n"PЭ:)aWAqpsk;jAb&"Mm{tz8y_¢n5uv ecJC1z Dei5ǏPZZcXfh:zB~W0v0Z:$Gkj˄D}c(&?̩̰+٫G91c-a|D&OaK<-qھ{7/EQwk)kEig\v.n zgIENDB`latexdraw-2.0.8+1.orig/res/LaTeXDrawIcon.png0000644000000000000000000000362611347255510015412 0ustar PNG  IHDR;0sBIT|d pHYsaa?itEXtSoftwarewww.inkscape.org<IDATHmW[VW^g\f`r/CcVilDc!ʛ>@씠Ѥ/OEmE֖j1jaZptӹt2{}>s?|[[$eogVRI.#¹B PPS՛vow3C;zBFFBQ %LE6ja*JUE: 4xAu?c"31ՌJe0H UJRU=sjU#:WkUTfl5#9%7BDH-&g̉.ׂi9p9l>1flf0QT{L&ѩZJq%T"Gw'6a$̘&R -=#? hFQՐBCGNhl7+: D۫/bI>/(0+l("b3j,3gi~JWXTҁJ-#*s0jkb+'DCt!D{1 y*$]>ys떍W,[0tjذnEӁ'>puϵޱu|(wT*N_ڰj{;uu@FjyIH _Ms+Y|;x7N 1b4!Ҋ ǿˬCP2aRI ?)g?۶965h1Ƙnͅh.c]{Fg6MJVd]Kʔ*d@w/ ]`,WHD#DDuza]_PTUijZsY*2祟s͟&"<3E:S,1br>",T*[e&CkORy7o-?aXъm#5"kjܸQL16ijssʃۚu[|-7` htNj%o8K_ 5pӪ/hŮ߷7|+E!̇ʟ(t·>!X+xƅNR/|IENDB`latexdraw-2.0.8+1.orig/res/preferences-system.png0000644000000000000000000000217711347255510016631 0ustar PNG  IHDRĴl;bKGD pHYs  d_tIME  %yQI IDAT8˥Lu_q)ࡖriV  eijX ۓQ֚c--s&i-ؔg;C%v8.@;?Am}g{>Ͼk~?DB=WvBhGiMBhŀ/JA/ Q6>=۷<%ԜS`I 0`}=222"UEB;1/gMNyKe!8íV+(] -F`ILḺ7c}޲e 6mDT$I?3yE%(jњ%;\!~?iZdJ`kut6DۧeB`!DJ||o/4=SHo}r:Հj+72E'ڣC֟m+\_hƲ$Z[[isfpSZUu; og|{#g8Z9qTSE7%\p+C^JMr.Ե%Ef5|8tdn^IVQ#u>,H+ZjEPH4($ ypf#>.;7 ܨ`L~?cO?!ʲʇW#I҂pC$kVqvɳpnOߟ-2+V=Ņ=Eʐ+,{gsE=^Kpnuߤ_P__ng~<@ee%#V<#eOSZI z؞+ ZwXt:NXe̩i466B0wҘU5FNV.$ 0<11뱱1TU{7cɶX_nq~)Ѿ6%b&jUg``Ś;zMMѯg,PS%:Ps魇 uBb#1 JQb]b*IENDB`latexdraw-2.0.8+1.orig/res/Italic.png0000644000000000000000000000142011347255510014201 0ustar PNG  IHDRĴl;sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8ՕKTQƿ}Μ905m4 A* J2,@꥗ "$4,2%TBFM#äDΜsA'X>`c}kEc،6`FffodWXA'*?"􌂋܊:g&l sr|g~Uq{ɭgsma\ŷfP#"3tw=c`snL^ I/J:eƸTw앞o?TfuW)6>.񓋋r喾qtʲ{nFULW*^we x8$MkhFQC})pΪ`>8.[ gL53LNUxO&3E,kÓ]zCM/ >5+5nmJ_;$ nB8,!Xd1 CH `"wĴUtyh*K1C!vò)B0cK`e)N,MZ.j\귊Ԥx iNl.HH01HK97rŢ.jHc,ҎGH^V@s>⪦1ǸqFO;Jkdl9ƀnL)@VZPv>,}\Gyd\5Bi^߉ հNITɰHll͜3nӖ)?FU4/],a}@8qܝ01kr08Đȁ-=])nJXb\d"CUzm)c5;_ft/EĴyϋW 3tǾg'NƐ֐8'k+z"0g4C5&8߱im˺,7`"0/M.R]MG e/$"0Ƥ FﺸqQʝ%իOMQ2ScaC0L ]qC=81raa"gu~s=}5)++ZZp:UFLߟ}6uE$ }͛ /PDFn%! !F\GPѢ1&́D a7oEcD0Ț)i\r`IENDB`latexdraw-2.0.8+1.orig/res/cursors/0000755000000000000000000000000011347255510013771 5ustar latexdraw-2.0.8+1.orig/res/cursors/RotCWDown.gif0000644000000000000000000000012711347255510016306 0ustar GIF89a! ,.؛18u1\ta2e`pzR ҵ-hZX;latexdraw-2.0.8+1.orig/res/lineStyles/0000755000000000000000000000000011347255510014424 5ustar latexdraw-2.0.8+1.orig/res/lineStyles/lineStyle.dashed.png0000644000000000000000000000053711347255510020336 0ustar PNG  IHDR-jGbKGD pHYs  IDATxc?PLCţuGM6`A0ڞ`'4. l <c ,f8zbvƌ2 K3##k?OD~` , W?gx. ǯ xC+fP|!_\d!-)[?~2Ҳ OEE0AHJ0\@eB!-&gG=QG:zPWNO<@[VIENDB`latexdraw-2.0.8+1.orig/res/lineStyles/lineStyle.none.png0000644000000000000000000000033311347255510020037 0ustar PNG  IHDR-jGbKGD pHYs  {IDATxc?PLCţuGM6`1]ap9᣶ ÁAqW r>1 ;+{!-)'E5%G=QGj!IENDB`latexdraw-2.0.8+1.orig/res/lineStyles/lineStyle.dotted.png0000644000000000000000000000062211347255510020364 0ustar PNG  IHDR-jGbKGD pHYs  2IDATx1KaB7PCXؖ5E--675QA-ECAP%eTZoA*߳BJɠZZ +b9 D46m1ղx ^o)||S >tE~gC7-m5-B(SiS#y<buuh}N&[:]xZ:/vN Ã>PxQƸIENDB`latexdraw-2.0.8+1.orig/res/LaTeXDrawSmall.png0000644000000000000000000006503211347255510015571 0ustar PNG  IHDRq2sBIT|d pHYs &=tEXtSoftwarewww.inkscape.org< IDATxYo$ɖcdnܵoo/ @ 1 =KhyУ 54۷֭ʬL&$;z܃[dXnfرG_ X x}DNE1Tޮ3*ևVhjT#k}L} ӦeoE?U;l߄.ȭmmvZ6UǶtKցT/ @{L`AmǬ֎Ώ?KiE @ @wFX0s @\4lюU;Y@veZ5 " no jx)T~4wVsǭ΋`J[AV p/[jצo @k~0NͲdǶssd`]\) VNGsg5~ _ݫeͱF3W^ZĮoN'c8Ki Fl[Vph] 8T/ rLg־6z2X0 @&w",|TnDX~xާ'`o^NtUuuݸY6Vzlĭ2ACV^M^k @k=;˽ @˗Og+򄳾I@`.ug*^,b`ag@r2-_Up֗]> w vۃ/`uC^ в{9n.]W D m,;k|aXuRP1\2U;p6/ rL`K N3-ԳfnwU=VvF܀ @Ɛ,Ǵl1t{? @i'ӎcX:n},Ǵl1Po M sӌ- 1 &vzE{ЪDzo M sӌ- 1 +S^y<\ @, |ПzorM~:ǭa@;7 p-'V;OAЙ_?nu jP40+ouDs",|%;]ܦ KjdZ0vhXq0jt(Vy{McV6l M;e;yaVv<h{21+_6$g0/w$cEsXi+A&bghtf^V;`2^0+_VM_(bb_Wm:".1"WY s @;|*w-",|%;]ܦ w(2aQ[ cʏJuSblrNz@{سDtEp2 ;` 9jslW1`^I;n 9aVvZl,=GU[G 93B;^f܊W @۔Xax^_7[`0+,|U;=9M `^ rqDǗs :Ab_Wq#uݍЛ5X{7@'7h|; @j@NгUEG] 1_EVfziHT$_'bW7ՎXnv-aVvMf6vo|Xmh{Pl ` @ڱw2;Azk\UaVvmcV鰪^eYV` @dEjJXG2}!"xbVog'uD,Hu?^; zihFl@8ԙ jm-`]!Mo|cV kiev _7k*>*1y- 爸%0acplɉ^@q-b䁟@Z5D̷-9>P],O 爸%|0VZ;[<}1~]vkĶd~̷-9>dC3J[]AĎ 6г5nadTYr[0/^lXx0k.gz x}cO6^l u0ܥ}c?:\vW[ @/ @`[Nlƍh. @/%(eS[A-"\VmJ`qkucYo z?`]4؞|o z?`]q?Xm_M; @n17@XޱwH\8\Mĵ/^` >hǭѦd @~6@`2E]F @\]4Gg/p#$T xEllkY6,[0/ @/zv1vooH^WȚvV}3v7 @_lot|a~Z} _׷(W}՛Wjiqr|pazv1~h̿`v09@3ni،\cIa4h:mb2-*~k;~[4@rcmb2-*oR:IѠ/*=mjՎ:u:FZ"/hdQ%BԦ\vVU+.o#SYۈ ( Z1˗@"W`چ1-VO+`8x; ˝ȱ$Askb؏Te qzgnX`nmqo:;0@bcV8Z~k׋~7T Jvn@Q7t`ig8n aXаZK a? Bt;AFZw"D0P@aLc& pq,Z#Չ:W qzv<M[Oҿ۷')uC_ua<9[dwߑBq29gϟnN(@?]G]Ov;J LgKQ B9x2@0X43 C2xh=49:ez\$$?INl8N(77Ht:zP- x8B-zIų2Ih>O8NiЏln82B-x'g:lI5"3*"`[lfe12ǩ$x272TJIa a:]$aU(Ӭ]f&N33EQFh%dYR+)ef HH)(3Vԫ5e%@2=;-YM"ަQ@CZ ?^÷܉V4;>e_؎:Q Gîo,f(@qvF@' vBaϷӴ\KV"It̶z4*w'EW^.C,zQ,=>g'gX QtZys<:;ۣlgeޏ)Z3wtjL H$%$0Ҟ_)D&#MƅB%efze YH3)YGPW)4DDD0xUd&#Y}rys$@H|aZ61QbgYwH}`OGGi(ZKA4_,00TDv: C0_& t{ iԐRJ۟$g8Na4ABa(RZ?%D$/RϷKDHGƀPQ2cH0k;`ھ| %h/j+2M6NՎHzsQcVc>lyl6h-/uvFt϶_~m4Vhwg@ȝPGgahU/nF/mFAd'RJBeRN_, @ ~pzH_ZlF {F_=،G]_ߋTfONJiFRH `4"%tga'8̓,:Y Gt؏ԇY0Iî*ﱹX$&(|{fZ}7I8>yl4^W4K At{y:vz_o{dto#Y5 6@H b6_4W ,.P Ȁ@+Y]xXUJ,-6ofkDMU[G  yI:i3w:B@AusV\3 RF>пb3-)ċ[o~[& vGa ^/RN=ݵ XNHkhZʍ~taT>Ni k9`_;/h*7@{Gv%$M2"n[ c @ݭB*mӹi1\#Пޟ{;c㛣ٓ`}WɈ yz|t#H ' R`0q_ӽ<;[nvvX6/FWu!f"eL?OE0߸= ۓtw{?c0Tbi9_3&^x}?I߾;I%}X) )fyz:7?;INR<iw_z}~~yt|mm u:̲2G;0 Lw"JIV6ГyfM7TX$-=:&5Xq7V Cf$#Ԕ|M?OE0߸]:C9/+Heg:$J@OVZ+ݫiV_>l,ql,DZE~8<&$(i214M3HYߨ+M }`qc(RV?ncL?OEG ywI`=gҗ'4EyOW7vڷ)Z~zZ6zvS$܅z$7`ij)*)Dx25PJѰ#/N[~{T2uH>}diFG'33̳n7)^pLXzBͻ43x`mS꧷i' ݱ 'QFh% H|0#9{'c)?"Ζ5{yJ~ow9&, <.ZOW=DNf6_ fv(g9.i>' Iƣ^,̞,3t, z(g2ΖYd.Cȟ/˪bK(q6[fN7Tq8IM'*K_KP>O"L צ@е qh{ /x>Ohwg*K3zan3|.Pk)||3bcc ޽?M8^~FXtt<* 8=ӷ߽{P.Ienj勭h6Dj=V]&/@-)a\Չ/b/-qob0/ @0,/C߿:H}VHDxa~j%hU?峭 I^>L@)LXIS#f8#IKbۏGî||}&| %EdDe$t4A7< z_A?y~>|B!//1Ҁ @}~j\%R4v[U bW)?]Bą͎ b_{*^DtyڹU7iv4Ooh:A-Hud )9~Qxd>OÇlcMf\Z/W?/=^ h-t#n!\hZfP% _D߿: xx]Z6O"6N ߼;I PUBxx-Lӌ vGtnx= &lg{L&s3_&XĄZe'FH}SGGS3'Ӎ͍RB*)NXse aH@_n)>XlhO ʗo<w/_lR՝H(`j>YjD0wE)!QyQk48)nRMG]] G]5en"yq#oi篦> @3m_".nM^|q|3~,mZ{ e[»wt{{_9Jv)"59]dRB/⾦RNb)g|V'[`O @{g훷j. Vٹj>] j̦v&ۛÀ Qp@ld0GA43X>BJ!$,30 d,;9gebvw! ótkc@~/T~e;41@"zeg !Љ= %yl|BU-5qW'tO|+N-|,PXڰ~0$@ya:65ȕswi[ZviǏAkhn27 {`n؍ЋraVoW(o -ɷj"b(`9`#ڰf^N;~Ǧآ{@nHXha:ƭɳf^N;~Ǧآ`x`$;@/Q2m/+D,XbR; @W#MA^1 ׆pE"e z` l+eі/ @_ ]9`2Xly(~ӒHN @#btlZ`g y9ǡy~/!b`NGąoiMn бie -4y(j%sD} 3v:".|sMsljM |XlL, Id5·l)5} 3`_B{v  ߟBnjX5kSv,Vk,0,zѴ;L |XXik9E#bKذ;L |Xlj'qG1a'bw/H`{mh7Xer'X2? @qkX1L"se0kZx"G ~"f~ .H,dzq淮i:so<_m`nا5 oՎ3XE^λI敻)M^ϦUq淮i5nMj @W70]xDf1w&ɫ緮i5˪h[jr'X<,6MeSe}kak缸؈j0Qyakhdzɉ[/y5-֤ZId5 @+Df1wor'%DšY"_ +'3]ì.`v<&ɫSYvK\s( IOS~aE䛿;hvM W&_dک,u}cPѰPL"ھ:}cZl(lo實`6|cza =XdН_߷ZtlMo .x&km^ +'`S+/YY6VzvWy x6ȉ^R7-1^@^r^l?mv @N|n"+ąlZJ_;o [*ښ7xMo @~N*}T6gbyg?9ho}6b ;@{jdziEN*}TڹϋFn{ s  N%ya9ѫSYkxE{HaV6Y3`#nU%Ѧ``~sb`2|ÊD򄳾sWk]/x=hr?|򄳾sWkyb`2d2D,z/ hIEUhzH aw}c [,w&FؒHo @.`$^0+_|?V@n,O @Wą"f &R`uP/7}`>b_'}cmdӈmK-|a`ZvJ @'OAdpvl-w 7`O6ض$ e5Xw]70W =6촷aKW`6xy%Eg<_]cP4oI6udXsfxv @F/OAdpv-h5N`^ @F/OAdpvT).A i, X:nqsfri-, @+6t a,ih:W*|u%A֕1 ʗ?\._h%~G`K&k @F/OAd1 @+63=yaVv3~m;E/b0r) +V Xo\~V @MeP;?u.W$&7n 1XO- _k {\y"n 0/Hv/Ԏu$oW{y±x׋} ^ heI#I6t~v#[֛5nzL`=nΖ\Xt!Wj< 70?b)]\ ݊dSdd6ֵe=51DѾ['O#D,loSBX| E7P, 0/H @j5n&QD,loSXBmm{|R|'HZn$(H-Վ 6e >*Z/rkE%R0T"eq:P;֑ @\n<`Cč[DjVm1`6bòɱ[~OOӣt;Po{~\ۿ ifL ÏYfɖ˿*YSkuz:7g7mr|t[7_~$iJ;*;^}ӓVB,`;`xI츓;Nw939eNs3q:c1 c0d/hBzOB,6 0PeekE_;wF kJ46ĞM8IWr_VGvݩfK]A(a_] #ޮItutݐ.(cיɉ<xWJ&7  ܷmN8/^~h`@4*⥗`IMv25̓h$0C\˖7Um(/0t4Դ;c -E:7խw6[IdžLa17ٟNv?䪭^jk ./*6^ix䟼+O]| 9VPYivCu%vJso`J㦺*ceEN-RE;|eNN};_)x~962:IɀݑnԗGvipc0= ILLnɠ>hըe|n@Cs_HŴk0:d#%Ekt ]@II7P[]f] )[砫gvY;wݷޞ7e/*|ͬp[;<#>p ~k_I"djH=8Q <`]NQa'@cK̹N4N3-qN 7xi"U+-Nu: v_~QĮ #\wkV7< @?ټ55e:i@M8#z_SSMYY4^WZ,uo4,9qPR#d7|簪}0 hi lPj'0BTjV޵Pv?s C/4x76swܳƱmsMΙsΩ9R (}uv~_|vI>ȡۻ{㥟V0S+Wr_}bZ@7OHV&6.NrUmky?(*m7t{_~d f JsW}LGPPjɤS}eQ[fxj֬ƖQL4kx)$WS]Y;tޛn3 yYz-rE ˖h?x#uV MѠj۫l69^YV#OĊD$.tJWP YuB- DE=|nwģV ]*ig,vYms^;pbD @'׎D"QVS]jZZ$#B{?1Ɛh\t6*KJd71 '[>C呩ЏD@l+>V`w ߦJ,p `ml9ATjs~-)rhF(Tk4-ˬz8s3Kl&>qe.OL5''l @$}o$i2Q$c%nkkMjMNCM}Lxl@Yi.x$IJ'F" 2B'ٯ7h opUb(0 lA: R(2A/[IR]Y@{ *Iuvt ޤ^=Ղ7>o5uPzb6$&n-769 Z r>fC$}d70F/f5ey :ScڲdJ4g&8V CaqZkGU=ޭX *}y!Yg lHNo(A LBz玵&jT:>X,@(zFC+hkzÌUEZQ6|݆G: $[ @sY+j0=03=\(?/K>uj.c41`zT ) @$6O^Uf~mEB| OMCPlQɨlfVt  @͢|ч%&I/ys,O?~l .//>sIŲö͵'ܘ 2S$vK/*SbF>g[9(lz BYɤW鴚s0byX%6mR<Z@pKKr5u/2m$e3m t 3F4 s"uq%%ni4,Qѭ.4:r~"6ֶܻҘAH$*@Wϰ3YL.&vuiݚr3?pbBSGέwyxcNcKo`j0QbC @V1[ހBL6\SS{7ؼsj^'5&ƞ55ez9P^QU\m|T<&=c^ʲĺMg1u88'HZ8n%+-1hj_}p+qݢ9 7tdt:TYQZş$`.P 6=w}95`6o{οH: d#kFYԔ9ùO|}p ڗpC`0̴Z5rEX M-}?lauu4OmB @}gNAsi_+(~w> PYQ(K> HT!.H>yJܾp& '͋M @A˫jέcqrn |t{?)'jT^8* sW{QZ sIDATw~dryTfg\L.7p cO?ժyMk{ r[72Mzg8 G4DQĚ2]AM }A&M3ް@0p/|=c CZH7F#p/<³;KՒޑ(2dYc 03 FE Oܱ<{̜.oБɉIW#Fw+a()rNjt:G?07wv_'^zz\Gw,d[4*HTdWgߖc2Tn/ao?>dƺ3ڽ)*hAp]h:ZM<(^= )ÿvun ƍ*Rw'Z[A0suX 6SĮAk`m `6'{" ؄%+!\ i2=O(awn?fnNNE?~wCG@ pqJ^NM4)qxO O6&;'Ǣ "do)+;0#f'#iOqq溕|677Kc47F:.^54KILFj|b&tLw ܩٕ2&ط*Iӭ.Y/kܣQaKKH4ݘ no@sNBb&&'N7t\Waͱ 3hXBSog8ăLg8vm@ڛ'V@OhX @'pl2 ]`BH$ Ė(P87s탑?õJ+ H$Ρ ]C+f$0) k'+NIN*,4즕5Pi@$8|SIsO$k6RJ\#VQ`g»Rzcf`|q<%I]7o9/E& 0-N*ߔoܓ6,fD$Jc%!IiNhNAM%FLI$c$\I @}:L*7(pK H$I$ T<`ox\ i!)>&H J@WH 7W$Jǎ fzHKU" t|S)R& Y& i~e  cKCۓ!H"ɔa p090m@EQF$Y<@$ @@$q%~HZDJ.H(_ղJHUcBI8)pe2SLA*oyC H5s4)x%T2 *f>C )Ea'GOI? _[pwIENDB`latexdraw-2.0.8+1.orig/res/document-open.png0000644000000000000000000000175111347255510015560 0ustar PNG  IHDRĴl;bKGD pHYs B(xtIME /4|vIDAT8˵_h[U?6In֦ٲsE:dd ΉA|VaԲu > Ylk?v%I,i6ɹMȶ ~~~~{~>8(F=!P[<|w ( rFqwY)w"YyW zP;o>i,|~ٹX'CC 'AtXdb|p$L_/'y|>G> 5H=~X]Pv8NZ=PTJ;VB,PJam;LgROC" ϿH6_ (n1H=¶D?fNid^ypd6e9:j]Gݕ6p;z<9c?\f(U+1Pǎ@\T=#ruh0*e0ͮV=IeR?[ ;օѱ$Q]v(mM_3@a}lDғ#1`iЇ,U`[7O*_a[ڳeRa%UrОX?fX,~ &+7DǢɾfE&&o@r*5'z̪މ浾[gM4:uxtۺhU#RߦFcs"`6kSSEv[fS8@w)ݚ`[K)_9d^IENDB`latexdraw-2.0.8+1.orig/res/Paste.png0000644000000000000000000000140511347255510014053 0ustar PNG  IHDRĴl; pHYs  tIME 6?IDAT8˥MHTQsΔ48$B ( s&,rDZd&m"j6" ]( ҅BA f̘νsq<댃yr=Tx?g'''/' '~?,d 3THUJMT"68KG(s)[ۣ5ƒVW#S'74vŇzVglR+WsC[[{NCZtzL$`}CTuYE5=sȃgq8ujvN|`D ǟTRYںZgiD=(r/J`%]FR`]BrObJIp!P?T@IW"<XW*@wH))2kv-݊B@kkm8JeFbe7s #zT^4gEFaD1Mˊ|-p8]4 ֙x=lN;$-C- #Zu;++n{#*5n|-Yފ7$Fi<tOvKT@{B^DE@lɪnS`pj@*А@6̌`pJ^a9&PkIENDB`latexdraw-2.0.8+1.orig/res/foreground.png0000644000000000000000000000123211347255510015147 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<,IDAT8jA{w1A= (DI#}x/ 9(%A n򰳻f-(f/ψct%,;즸wɒ̒LQdJM#v_.#~=zjNʲ[9ֽ#y9'0vxGs5NU$_@,4MR"DJ9U֛}wDwrjH $n <q^mP-F Te#a%Zo-*I 1a!ّ(e:=:[˨0 &*Fy0MM[cР7(dQgj5_xJihi}x/֞F@[$,}8e`݉K\^@Fԉ ikm}+k#6D Yt7-;;Z\t-MwѠikEAذ[<>8 Bkޅ2IENDB`latexdraw-2.0.8+1.orig/res/go-next.png0000644000000000000000000000164211347255510014363 0ustar PNG  IHDRĴl;sBIT|dtEXtSoftwarewww.inkscape.org<4IDAT8[hU5bE))('o탅 5ЂVAE"R|iII `Q>EPKiCZ )bK4&*54KԤӓe^>9u6чt̆5ڋ٢\ &ձym-76v/)`/Ty5oo&}?k6kMeb&hhQwYu#sN7lZlU}mʖӯȕ=2'Aա(N]Cwi`l|jZ{]NԞAőYRVw7{L),>u 1JDDdKiHdC4"ICb!-';Yq궆=AӢ`JI1.ҟHBH*Nb \ah nzp|p1dx[r?>S3>')jSDnXh40<#x,)gMv>끪LՕ&R宕O}˟>.PfYK!}9^K#fIwp)#~5CgsYn)ξ˫ U"B"g&MGZA*(AۀTH΁sK.S)SMR-'4IENDB`latexdraw-2.0.8+1.orig/res/Draw.png0000644000000000000000000000332211347255510013674 0ustar PNG  IHDR bKGD pHYs  ~tIME 2H_IDATxTI$@Ixh @Ix>>TmIx>rrIx>kk>Ix>>>>OOIx>U,@@>Ix>U,HlIx>U,HVIx>U,HVIx>U,HVIx>U,HVIx>U,HVIH%I WDI>>>H%I++W P2>#,@@>lV F##OZE$#E EhO>>mivaIENDB`latexdraw-2.0.8+1.orig/res/mirrorH.png0000644000000000000000000000105511347255510014422 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<IDAT81hAoE-j%N HIsB%HT6V"B M"XR,4%4c`0Uj(m)$!?P8U%'XQC@$jy#Eq{;頔I!2mwWf|0wʪcEo< Ͷ5ۺ$'1}p^Z8 !?9${oqLOV Xdϯ՞J.NJFnO5>uٸYV,*|?z=R录3i_lp3`I}-ؖeXA]] C~![D Q鱗4t]0R߲vd&?{J-40MycH!R(MCi=+^bژT@UtCGHJZ[e@U6!DRRRC}_P\z]ױ-1 ])FT}sItv.tVS7*}[鷿t cJ`\u<\M^]=$]tv%NP0?}pwEt .Q8r޶M2{R(!@iSc}\jX{`ӎ^ֿfb{VdL7Wnq>7ZuQˢ003e ަ/twt !0)2ތ#v̙͟2ãDAT7Ey-+ɳ5mh>vh<`!D60g  YO2rt6'Z[/? mpy^q+|@VZ̴ Ri " >@IENDB`latexdraw-2.0.8+1.orig/res/rotation270.png0000644000000000000000000000153411347255510015072 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8]UUksLfph@Ơ8k[5K`E~C$Qh=X ܹsofY=ssՋZ{Ο_kEUICDxx "@Sޤ ȶG<0H$YnR{9E`u{q&|#eJ?O`ӳRbL ll>hx|ig64j7bNe`8\&Af7vr[%+Q^%-RWM y>=Ii ؜ّܲPH#c2{wzRmU=*Iwo'#4ϊ˅XqxQ,h$vR6IkEOU+"rs7L&kubUK ;L" n\42Me) -flwߠ,׫}RN;۷,-Pq~v8tV s'I *ㄪ6WU\g^Ņp9NRƅe93lKFUESGaO=Cg >,G}:o]3\ў +d?Fҕw;nGaۧkǚɾ)+у $wC 2S~٧1427񉯻.wE8!(h?p`Ё&ȍ˃O@"bc+B hWIENDB`latexdraw-2.0.8+1.orig/res/New.png0000644000000000000000000000126411347255510013533 0ustar PNG  IHDRĴl;bKGDO4ױ pHYs B(xtIME%0C& AIDAT8˭kaTM5IDL-O]abIv^NA)N6j } q޽;H(E j, {SVD42Nlh1D1le4NOьyxI/ NԸ[NI f6ƅUP,c+Ap{պ:˫c #MIENDB`latexdraw-2.0.8+1.orig/res/mirrorV.png0000644000000000000000000000111311347255510014433 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8ԻkQ1i,3ZTD5$ 0B !`Sh?NPٍMv|̽sGBJ uanD\@gE0֊uʃ-Zg0Iw^y6RY-(ޅ8g؄qe V&2ͳ3\kJ0ͳ?8$7P2Eg($O Z'WЃۘ7tVɪ]G%֙;"i+_Iu~&~O=;M첬mnc{F"7) II#ͳ&T\$'qaǃ4/lx S%m*Y^4yv9W$Ws5-DN/VjIjJr=K؈xȂ%EMR<$c$ͳŁfc .ddZ#iIENDB`latexdraw-2.0.8+1.orig/res/delimitor.png0000644000000000000000000000075311347255510014774 0ustar PNG  IHDR bKGD pHYs  IDATxՔJPFj"Es+O@Bp"!ښ6&"-5*.ɗ N&sGTߔ/݈5]T~m7ϊKB?Q7@+2LbL| s ρ`*0mqʇna.$9$ 8PR,肾@ )6ׇ_@\, ug.Ks1<@z¿Yf8Оf^V) Ί^,I`Ylì@BzO18c=VU гDwTpFWMkغ,}qUyiqL~ K)IENDB`latexdraw-2.0.8+1.orig/res/square.png0000644000000000000000000000062211347255510014277 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<$IDAT8M@ qZ@@|B4P gM!6άy<;Z;\%u]_`20_XI׫ec0Yys{wUPچpkiM&ܜw^16@藜 7)%d!cF*t @1V!@`"yuRt>~)y&0%z܁a>>%9~ vڬWqqZ)!I"MKmNo0F16s\%@]X x7wXlQfIENDB`latexdraw-2.0.8+1.orig/res/ellipse.png0000644000000000000000000000154211347255510014436 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8_HSQǿ޻ݦT&Nk=(jACE"ao== =o(0]njK _|B)is !`&bh4!A |V%4~d1@XfsMh2Q1QU KedQ!F29aQQY{VMZ+ Q׋rx䈐u}_]]SJcj*R_T⧵5$P#^z6)Y+( N=EQ KhCǪ"gcL1)ѪO },˥ρ*sw .\ٿ'io.3RV{TU!5l8o8Lp|a/6.˲Ճnk HR:C)\TI+])^3dz(o`] -1= ]=-I@]]}߯-/ovKǝ iG [F5We鍍w! A L\G_5 \4 [?沗gqx<5>z@4iefBE͖XjjҖi[/պƞ ammө,<$)6-0zzz,|2JrjI0IENDB`latexdraw-2.0.8+1.orig/res/distrib/0000755000000000000000000000000011347255510013731 5ustar latexdraw-2.0.8+1.orig/res/distrib/distHorizRight.png0000644000000000000000000000152611347255510017420 0ustar PNG  IHDR sBIT|d pHYsq́tEXtSoftwarewww.inkscape.org<IDAT8AhTGg6Yj㵈!=yKA4^lE=+Zhz{j)bRK"ٷ6iv߼yC6f+go彧->/ρA~roe\ovf?'~4p}_' ^Á1SSSC۴{8VJr9d>177{R&''hG34r,:|R*} JGއovʥg_e_*TƋX/,|ҿGAp+wmYnz/! L [*TVw'%R;ZUTa%J'Oyk@fR HUaŁ[Pn'k`_M'VCaWA; 4.FD&t:a%#)! o֛歈 b!|*I;ۑC T}#l5hjjHAPEanzvz@}={5^(LLe x'v$:w?^?uYJv?|x%m+r܎ 8K1ԀMɈH"{OS(Oy5Z+ӡɀ)v;:f݆Y;z[&x1qwTCBY IENDB`latexdraw-2.0.8+1.orig/res/distrib/distVertBottom.png0000644000000000000000000000144711347255510017436 0ustar PNG  IHDR sBIT|d pHYsq́tEXtSoftwarewww.inkscape.org<IDAT8MHTQ7dfAAm$4hJ6.ZEDjsQѢ/R )x|ob>";Wéac(q)gC%6b]1Tn:.K>~?QGqVl9g*8q8y`-\MBbCn`mLkAUIsYN㊍ی+weo {- B~4ɉ3KŒ@ʳ,L]W8Q"(qN} <OCJDPJq<n&[ZۂR6Zcld̷?s=YԑKWN%âKiX\eX\9 l' =f`% d -g1&0^}YVW@l!\ɏ '!'yS?c? #2"O7+^[a /7FocQJEZj 11&jii6999%OLL|l_2JGW>]!k`hx.`Bk]=q8smnʣ?k4%Lw/jcC#0\]Xw(a6?SJDbR}'9{IENDB`latexdraw-2.0.8+1.orig/res/distrib/distHorizMiddle.png0000644000000000000000000000160011347255510017532 0ustar PNG  IHDR sBIT|d pHYs!3tEXtSoftwarewww.inkscape.org<IDAT8k\U{Lnb3?VU&bKEAhA dD u& 6.fbglν}yappxxhp>H{ epeSK ׁ3 6G/I48wàiR*ofj[AVZMHJAw܍4Mr@gf\Y]_ܼJ$9yj\.?fsFM` %}qBk jyұ_Z Q OepIIENDB`latexdraw-2.0.8+1.orig/res/distrib/distHorizEqual.png0000644000000000000000000000145511347255510017413 0ustar PNG  IHDR sBIT|d pHYs!3tEXtSoftwarewww.inkscape.org<IDAT8k\U;10LSd!W vJ$\Bu%P\@"?EB+B(BjtN&d޻s_LR{~;+Ag(N S?~6U ||0w@p p-rV5Zj!+*"/-]hܾ}ɨFUkõ_666,Vkfu6{{l?d"! ޘͽH"!X#"kovc75Z!vƜB5RiN{R)_1*"577GmsꗍVҫ$|vمE$dzzz>>}닋oeHht7vxEI2`%@j ;5썮jR</"BDXkǬqks.V;9ЭZIENDB`latexdraw-2.0.8+1.orig/res/distrib/distHorizLeft.png0000644000000000000000000000150711347255510017234 0ustar PNG  IHDR sBIT|d pHYsq́tEXtSoftwarewww.inkscape.org<IDAT8?hY?F?Irő + p'(Zh#"VXH@ERXYPQB zf/lfgYLV6 }}!K@7p vïa~-Q7Wp40^;"0 6`[ 3/`Ç*s Ao|7}}}\.wODpgV)}ȑ#]]&&&vvv299ID6P]4R^~G<]bwkT\RT*5I޾/֬q꒞UVajY- Xk*Cq*jX\^`i u6?ք@t$@(CSPJC` l(e& iħ_)qX0A80n8b&p668  k! '@]tp QKYVb-J Dss"`-)Lw,灑#s{%k";y`Ֆic1M|W_;Qb*0ts[Дǚ 15=,J Ј#G &kֺl_, +)E9AE 4[{?[z?;>IENDB`latexdraw-2.0.8+1.orig/res/distrib/distVertMiddle.png0000644000000000000000000000154211347255510017364 0ustar PNG  IHDR-sBIT|d pHYsq́tEXtSoftwarewww.inkscape.org<IDAT8MhUs&1qA4 ۴nڍHV\ ua0 , ..* !S0q@fQ 5 t2?u19rއr9@V;J0EXzvxJOAK8қPMAkN@ΝL 0k<  |?ǀ'A9O\wZ>6hɵںnob׈N `|SkN-R]x_󌅨\0k=7E  UEDl_m8ZE}VLE6A!*}be-nͲ,-}YvRE m" <=ЋUy5CL[{RҚhPܛXŖĻDda!rXNM WfUU5P*J X!25Kexn^"lPUr_lȧrzҸΘ9[^tINlyT6 㿓9<F:y9ܛDlJ[2} "s6kIAЅ;I@3L=96*qZ[XmXؐ8P;ՁߪsXǐYQIENDB`latexdraw-2.0.8+1.orig/res/Object.png0000644000000000000000000000146311347255510014211 0ustar PNG  IHDRĴl;bKGD pHYs  IDAT8MHTQױCI̾jQ!AJEPDE-IjSڴ0ERMT1D "H*Lp;c:3.;pwyw.k4snar EC1^G*7>DZ- 5t5xFjJŠ7H ;)3.#m+H| ;۫7K8jecAI Sm,<γ.L"3ne~N!$EN۹OEjfʛsީԤ&vJ_wIsaZ-Ǧ^^I^3yk/r~ =<'}ccEmit)ᖴ4Z޼)^t /xP]sZoH@9qdZ%?䎩,0;rmHe)UvrȪZB{FNK3"[AT G--J#4O.JcJ+j*qePئhay(mQQAۿMJW<C$p)[2űɦh&><qݰ'|M dC1I^K"y9sT|Vz9; Kܦ=py%m\#`+8O<D PV?gzxH7)PK\>ck"8crˍ^:Ňi?G! 3֘Jl\M!*$ƶe?IENDB`latexdraw-2.0.8+1.orig/res/bezierCurve.png0000644000000000000000000000065511347255510015272 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<?IDAT8ԿJ\A AD2DLc6NAKh |S IIi-T`HIXw ssfFfdMUbfxw76~p.Vn88CItO` 76~f׎pl𹴻t)2SD\ oSx*^C sx'XăzqOxߪZ~]Z8-^Sla +S~𫠛7vx^Nzvc >&?Y_ʼ~TDq]ifv7KQ3IENDB`latexdraw-2.0.8+1.orig/res/document-save.png0000644000000000000000000000217611347255510015557 0ustar PNG  IHDRĴl;bKGD pHYs B(xtIME 4Her IDAT8˭]lU39meeY>"ڒVX0B4F|5HUR FilD4ȋh 16ƈ4AT%6ݶvggw|hwlPL'7s=3W`{?ƦH\om~8ያ#>1UeNϸT:CdVۻ_;rĖ"U[pm##J+PvutPv=ܹϥ:p+bkw'tO>P+Ft6N<@}A/.yYb5%3}}pG_6G$TUHNeRELhekԡ>;r?Ϫ I۩7/Jrk|ow_&ǎdۺeEIDAT8uYl;3H")(梍ok$k#J"5Z ע@c IF j5 R4V8XKe%ZHΌm&Ո/prϝ~cx ۶{@BLt\jIe,w`^!B fk19Hf҅s?lo}t{FOIQY8k=\W~zlᩓ9``00YFrs|E%{xܖL]V|<S1 wO6`[`j8K/@`S[SBX&ޟ^t5^Fufƶ*5 CsP3ǟgg&=< %)9 ,eۉnletj05lymX\٠"sǸ<^(QQ^§8X\OS76jTZBw`&]jc ok3uX QY.~G+/a'a8dM\5pzhi רxk'p TVDPmwҏ4 ]G,g3nV27xgXZ.S"ͤiQP(iar?GYG2@&=>N=ZmuQT"[riV,ы%\JgKBf~qW&'?+>_NQAw1z6Sf, 5rF\%WeQC: Lz|6?ò-;&+Y0+bI&UFFFvb늭Fbꚟ'Nfrr9vTF@_?Xf &IENDB`latexdraw-2.0.8+1.orig/res/list-add.png0000644000000000000000000000060211347255510014476 0ustar PNG  IHDRĴl;bKGD pHYs B(xtIME ,+IDAT81KA;OPl,J4! I [-,lr s!1 Xd`af=vVc>jf;q`iݠn0V?575)w)C*.O2"1o\P@Y&v xz~G3agΉ„l=wzS6_ɽUZ}ET-cG܆f%Tn7W5Gؕ_F/-[->`|^4le'IENDB`latexdraw-2.0.8+1.orig/res/AutoBorders.png0000644000000000000000000000151211347255510015227 0ustar PNG  IHDRĴl;bKGD pHYs  IDAT8OT[KTQ3iKJFPQ!EiF%=%=YE=SDP`E"RB[xit}tdT >^{uQZks R.ȑ@ߡA*e㱹042gRm!(TLHR1"3x JUu T {؞UrNq68.xRF2dPLr#=00PA_+)U/6+F8J`)I9W.UP+.HpCCpQCR:bVH\I<02@⠬nJA.'lI&/ANLH' 8)xLjP>:_v+&GbT-=?IL&, Ie c>xh{l3k[Š_˞&{p> Ql;c_v Ipm¼@?z;^W4ϼre &濝QT={~S1㽌[ۀF߲,p{Dr|;=Xҟ ӕ^ҹHQsp*]Al/O+m"8!h*"5Z++?JI}nRۋzby4jMtonFNV9DuOx'IENDB`latexdraw-2.0.8+1.orig/res/Copy.png0000644000000000000000000000132511347255510013712 0ustar PNG  IHDRĴl;bKGD pHYs  tIME 3 EZbIDAT8˕MOQsLt_vc+W&.](Q0&D!qƭ+C $@k]XX"2әNٴ9Tyv1CB4>[q-,O7N\33YQlWdft:r7$I03O n6FGnn "3a}BqlNqT5_p:,]au+۸M :> n}Z'0e\'8 !zUDp_7D/}F'0E }f'0C[zw:j&"]`F’z/t, IENDB`latexdraw-2.0.8+1.orig/res/wedge.png0000644000000000000000000000161011347255510014070 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8Mh[gc2դ& ~T֯'p! ":H F(W¯آVjCX9.LBV gq~{/13~gsN5ADTUt:klHxz0nϤyB !xi$v `_~oY,r?h[=U5cF?%Cwm}Lq\`po2$"(}۵;ujEC^CbC$y.;t޿Ֆ$YKpggg?Ha莝+Se?xLbݣ##0Z.@QdƖ) 0(g'EZ,\9v?͙ῇW(=3fG}rn@ӓe I$Iu=m{ \6FP @uu^ǾϋE!477woظ,dN=ow}cƟ竾~K,3Ϡ[-pءPܥKmllzU{{TDN M^`O͠QKIENDB`latexdraw-2.0.8+1.orig/res/chord.png0000644000000000000000000000171111347255510014076 0ustar PNG  IHDR sBIT|dtEXtSoftwarewww.inkscape.org<[IDAT8_LUƿsgn-5K4Vڭ ,R,Z}geg06DimSKyPMӠ6F4*VDp6Of)or3|3[Qi@\.'"0_lllS*>6&4M{`)o.neD"q9DƓ?e"jR^ܼ@?ؒdںCBK+^7_^F9L=155pDR dzZן߽ڬ$H$Š>r>دdM鉉*u]4GN|*@%!\C%@e Uӝ?U]}Ֆ u uGM|s@H@%@ZU{\tfezzzokkkFP[r|Ov%, \z̼kkkOz@f>$KO N; -$4M>܉̬aKWId9SsR^\Mpj0[\*U@-AelCgL/-! "Xb"X>`8t2.p&BP(4i6wz@]+Ô9wqrٜ>Z;'?xM[Y<GWWbq,J4o};Or/ qWV ]6r8V^8gr\@nl0,=^x{xQ=LW.===]V[7~wT($K.Vm̌>t6]jjœNv#4@P?'JXIENDB`latexdraw-2.0.8+1.orig/res/dialog-warning.png0000644000000000000000000000167211347255510015707 0ustar PNG  IHDRĴl;bKGD pHYs  tIME-GGIDAT8˥kTW?fȨ6C&ImR2B@lB P 4 u1С Ҵ(hbk3:b&djw>{/Zk:`tEዌiøwRcvu߀ j͛7UlT8&ʶn_DkȃRhH? nT*݂U7_IdtcQi ^I/T,Zv733$Mxa[F :9[n321 F,|1y##k,ADoyq`ߺ7W)~>{k H5%Mq`2I(8?oxf Xoi BE<ƠUxYy1e_$cPTih EWG'߽tӆn/ .XZ-Qk4R\~cׇt>DBC*| jqXAs˼(D$7=UO;r'01j*M/@c$0Ws~[.-ന#ߩ߬ړDxi6?ncdͺ(Mwol˒͜t pM.mUU#hpif."!:\3~sC6sZ g\ڪ ي)?jm^7iu{~2k]|L ۲PV\A.mUUa3Wsifn 2*P`MJֵƹ$6c8<%oNlĀ/H~5nM-&s3*ŭ쩦}mLipN{5S3@Cz o,&Z)la65ߧ(І:|1VQN|\Ki 9r*Hk3koit'y4Q w;X _:ֲ]kM6*ŞY`Б?gk%bym~(OSX8٫>/&/GmVƤv0d(ZvҔ/W2﬿'قj ԅ.aj@ꄲP >تGj ڴrꕂ+7KWy'MD&;܄|]$ϳ.8,uc(9d%`Rk˰3OqQ|"^ޒc-rhǫ햆lV>7#ϬX~"ƒ27hȬXʾ% ` b Sm_ r@ 'p}xMvMé*fìwGy3SK gp[RS-W\(ȡT|iCVf-gt5$0 LZU|мnpJ*Ϋe>cQ~ O\pFvZ?-7.6gCAPi8YbׂGXiϱC/"3eq:7zO+!cGia"'PǞ;<6wt3 9VtCAVU2>CHXbzWNbԻEMF8%kL{ ZLu 0  ӷf_vilYƕ_LrBB |r<,U ŐzܼY=6_eQFue#Uqu8I*7sb}ƦnY6,7!;Ȯ<rccYD&D26Sul⍩)n+8*”9e`E-Rhǿ\cR^K%V]mF\0_G0 \,*odDYW;wHeFdxgUq\J&s3胱sOZ Bh5-vq<ރ!q9v”*q6o/Tp4yբ”4RcIENDB`latexdraw-2.0.8+1.orig/res/arrowStyles/line.none.left.png0000644000000000000000000000043111347255510020151 0ustar PNG  IHDR7ص bKGD pHYs  IDATxر A<c3>l@3{8D0=wle&].N٤:өHȘIHqŹn.ܲ,^u7WȍKVn9E Z++%=Mٵ`C I҅ dq^rީoeIENDB`latexdraw-2.0.8+1.orig/res/arrowStyles/line.disk.in.right.png0000644000000000000000000000137411347255510020743 0ustar PNG  IHDR7ص bKGD pHYs  IDATxݘKQ~HΔFMr!X.\h3O(hBPh6hQ)ZDAA!H~٢r"w#8{ssU"[hU>/sg~=»G2Ilȣ#ҁr lU8\2[,5Ӫ &%D!LD&WdE4ѶUal!Sc~`-+eg2+rӷ1ð.8#TRJܗ WԘFsvMp &l7Lݱ_*,kTg4I8P$QTiרttlC _8ATW~.\,`,ޱeX I*c1`nb$] WwܓpNdބRn]4X-~y8ttEhMvqo O$LS Ԍ QεUU0fr! K;.˩tl&Ԛi Xx Rs'"\T)VO@a|_o<%>n<{-b1^v`iEzjL,V1Db5۲\4(. `s#^`t_!hU-f0X 4X_c5rx .F݋sRf @IENDB`latexdraw-2.0.8+1.orig/res/arrowStyles/line.arrow.left.png0000644000000000000000000000175611347255510020357 0ustar PNG  IHDR7%qbKGD pHYs  IDATxku?kӦkil ]ivc*c z7.N(e0`1榶vJ\F45o+vi%Y眇s~Ur|ՃG"X6,\=HBj gVstLGjB:@,N|ʍ뫜D5r(b8g789oY}Ӥq-.*]L2j>8Vt=r84l^ϫdOIu4F+;C$l.$Կ?ٶ>Xòa=AO>"׸ٽȈi 8ﶥ vދͩWU7s?6G(f(_ 2fa-n_^d$+_d `_-0Nr~>[e4chTk<шr7qP鞀,[ʅ{dh6GX)דG))^LVH7vHY(];Wj3ʹm,fs&wTii8!\9wgjʉ{>^mvsfߐZMjl:7& Ge`8eR)$t2i *w©&_٬|/Bf Unjd|o9\yM/ _ `!nyyapCrX 6fpg*khC6r:X ȕBZ fx嶄+YK4 fnbXfO bƻ6+9U<[P{$_AA:`O۸ҹ5TJSI{$ټań@gǹ; 'MT}Y?hnW*_KW7fIENDB`latexdraw-2.0.8+1.orig/res/arrowStyles/line.circle.end.right.png0000644000000000000000000000150711347255510021410 0ustar PNG  IHDR7ص bKGD pHYs  tIME +{aY5tEXtCommentCreated with The GIMP for the TeXDraw project|vIDATxݘkQwf2&"1.E1 -E*"`ҽeBp'\Bj#AtUw"TAV,DK\IJܤf&2{^BJI;..+o.:!ځoRJ)mÂqX(H&id%t//BAbV_]/j!7atzxItwx=D܄<4C! 1oEP=2 '_ ~bd+ Dbc:Q:;(;h fG0]鲑pCl]I0$"X*HP̴>l|B6L‚(Ex: +M]ҡkT"9m)E 9^!x]O~79ced?wn -WFʟMΫ o8]RЫ28OlUm|iD2u;OF+>VU [.+[eԑ3un)kJ\!_ikgNBmIU Ł$IENDB`latexdraw-2.0.8+1.orig/res/arrowStyles/line.arc.r.left.png0000644000000000000000000000216011347255510020220 0ustar PNG  IHDR7+bKGD pHYs  tIME95k5tEXtCommentCreated with The GIMP for the TeXDraw project|vIDATxݚoE?^V뤵B H (gJ TE@= 7D%z,7jVATرkl+puݱk8K73~;"Y5esUWW]^6 0]Itm*0:j;a7k;BP`LA|2M'g4l%!f p>H6孜a@={nBhQ48Y8*PWFC~\QH&)I)RʑDT@6jI3xttxldpsyW?SgBb2$㠚 rzYL:1'3G]3-nB%w7jz  , ׀s)*j;~C[%h6!>*OwDo7Z{r:H- g="TodUj$|ȹjʍLIXl-wܰGgiȕ{tn,-g8Jd$6ջ8N|h.s>]]^,bszԤ.NjL1~>y}~7"^Q$ NʼnʼnFR ZKct 7=v-~0\Qg#{7`ܹy3>[Ӷ xWzu]}Iİ ${~%gKr`r;=wT8KgUԚӸ&=~/g>.X=<نw.d?tj\tiQ6l 9j)M)Mٵ `, aU4$`Cӎ4ii1IxLA?`tD_?H} &hإ.̙pu pG(`FP_mXO_R޽oh=^DπBt,겼#_ܲ,ί#Q:Nl`N$yYRzܴ hߟKrl7i~0KJ|.ž|b1 PE-WΘ rv`rMg̲.Zٶ%t,X;`3^vVsD/KP"uHY#)~, ]5 ͮs$ǶQMmN>"6Z$ }? TC,7H".﷥[d±L2i>uQ'Ge-ݲ_ȯtOMV9=>po=OX۝R !w+` 3XqVJiȍp(s4-gzh nОx*q\^TR .g+#5W`&Ti*h¦"jKͳ;;'x"{>֭\r3t$9Mi86ozG3`~UqvQiЅ5g7ώX<%/2DB ǁ*ZIENDB`latexdraw-2.0.8+1.orig/res/arrowStyles/line.none.right.png0000644000000000000000000000043511347255510020340 0ustar PNG  IHDR7ص bKGD pHYs  IDATx= A F쎃,,lIXYki=6`x C0#23NZ4Zp!3w G`p 'e&n᪑z֖…7ojZq [+ߣwZ~& KW \z*y˝Z5CZ1\sݖxGfNjZp h2IENDB`latexdraw-2.0.8+1.orig/res/arrowStyles/line.disk.end.left.png0000644000000000000000000000130111347255510020706 0ustar PNG  IHDR7ص bKGD pHYs  tIME #:K5tEXtCommentCreated with The GIMP for the TeXDraw project|v IDATxݘkP?.mͅrJ4"Dt 7hCGGS[.~^ЂQ}.^)g/% C/=~B)ecc]B=s5?P9N{ƻ,=N`Sl A4 9U1W73O3mW8sC`=ժl{z0ߣ1RDWﰖ*YWVa`gE&58у4zyIÕ#=\p4_ؼտIS((DCrX׃=|@=o`'u,ÐaO #-}m=p >ղP8OX=y@k|>}'B-eo+`eHxE{VJa,:"{({Y_"{4-2fv13Ƿ-%@r7>mkO$8b/Ei'?Yg,IENDB`latexdraw-2.0.8+1.orig/res/arrowStyles/line.disk.in.left.png0000644000000000000000000000134511347255510020556 0ustar PNG  IHDR7ص bKGD pHYs  IDATxݘKTQ?ͼ7393VB&E`Apa.Zmj1`E-B\- QE%XJZ"B%K8Ώ"Gfw}U%2O|^(u'81H<(?Ftԭ~ H55Q&jok#-c3BG:cxXU",l/G# pc.:eʧ,=9ns+WD4V!\k>sh).xsűy_b`A3$47J|%9WRijNo4&s 75Hn4QeҴfԸ.MT"U`˘%𘌀{(R= ꔓ!'] . նT ĥTip/så:ҿa&y]p9/_юaظ&F0c *IDX*tyP|I7t8RɏF*֋֟NUThXUU]k.Ή_~۱=.L4p?a~*ulFwO88!+w'y{?=Ϭhh }Ƴ}[<5sÜOq]ST$kpOڃ7RICnRLKJQ2뮁{Z3n?bMxb.JHlSwϐFOpǎcx-9>^↑x}7[4Y<7cp"BatAaU9P*j6{i<)oVmߺZ}zRۜ '"d;jfԾ҉xؔHxuT""D4" [E<1؁i/.鷗pcP~ƴӘ8v`C_ju{_SUz0Kf;϶JpQ.o?y5?^z GʩI*cO,r+!1s[X ,/c1~+o0TIXmu汩qMt=X|nU$jgj2Z1X' p4lC`{~)XsF ݸux<X4eA`9?3xjWD0_Vs9'56PL՛ؿpI,(LljY$TKX.a$kƝEZQ&ǜ09>v@GUٌin+ É2InDH^_ E/UD0tih"ef~L0H CCȊqҜ[\vWjLjqi-.;䮈lRf#\s\(y;""NvDdp(S?Lsgqb̶Mc'h*Q@tr x*"ab7 #1c'mM 0BQ;enLyFEWDTҘ d\,<{A./ /T8cƘV> KC❏[S(~sA.!D# `,D6?|Ԇ}JǖM&Գi9a$asϩ}KXdYn-20?qnG IENDB`latexdraw-2.0.8+1.orig/res/arrowStyles/line.rarrow.right.png0000644000000000000000000000230311347255510020711 0ustar PNG  IHDR7%qbKGD pHYs  cIDATxOlu?7;v[b* t- B"4Hezڪ̷lv37oywG_%ܼw961Pfaǝ^NF,&&!3{KkI# b\Y'77tD M damO27 ?Ffy>鼦Mk,f6MKmNmo f!AX37'nO-3pn!AH|JWJEw1 e_J7Hٙ#ӥlk ir;o."[B|\OCЈiKB|h[\ 5yr W WF !-5Ar_K p^~  ^Hex>wΫ] ۠Ea'C{TE8e͹E;IENDB`latexdraw-2.0.8+1.orig/res/arrowStyles/line.disk.end.right.png0000644000000000000000000000127311347255510021101 0ustar PNG  IHDR7ص bKGD pHYs  tIME 855tEXtCommentCreated with The GIMP for the TeXDraw project|vIDATxݘOkAkKJ[[(6=R$PP@~BS\{*'7hC "!U!xh#MlxnvfC&L:aj?!Lk]W)eL}J˶N6SmNAׯ=byS;48bN38ýYe XK"'FY(s//1>+Dh\fbGAw\#!`E/-DIENDB`latexdraw-2.0.8+1.orig/res/arrowStyles/line.bracket.r.right.png0000644000000000000000000000122111347255510021246 0ustar PNG  IHDR7- bKGD pHYs  1IDATx횿nA{>@rĢq GH%(x? PB M8K':Yww?i$ݝ5Z|`>"Jwg֮8lixQ}fnn;Yhg)58 wQ FHq㊉qhyv;4yȳ׏Qw{*7ix<Ŕn?ۗ"+ ܐr6ÒpY[xp$W倖fp%? &1C*Pr;\6gQw?C<Ïc}}9+H{[Ё 8X[]\%)nuq-C^[]\MG[_n|(2suZm1u4$yڙb3Sp-í.Ơ.4ŵ?Cuqdxe™2:p(m|WYAguO)f993ϙzv &-7PND[L|>:SUԮ%z/s<}{UwPpwIENDB`latexdraw-2.0.8+1.orig/res/arrowStyles/line.circle.end.left.png0000644000000000000000000000145011347255510021222 0ustar PNG  IHDR7ص bKGD pHYs  tIME D`5tEXtCommentCreated with The GIMP for the TeXDraw project|vtIDATxݘ?hQ?]ri{IcڴfE"  :X0*GGq,:%5ݤR!B!b1s0 !i%&< w{?ݱ P0 ?񉗩}u 7R֢0/%D# MJvhTX _L;`Iܐz!yilsNAi$S29Ŗ&e󜒔֒ŏ Xn}ʽ@זm~V*eYgXv297N+Cp 2NezN.5-e}^JvG"^ON1Vpbpp͍+f"^Jtģv6WtgtZk\!y $_jiq6 c~EW׿!-/,۰Œ'%qS1P3c}Ljpi1kCuHK]Jsڬ< o:?v-..)@VJ6- N)@1 "aN-oa[?Nkksl~\m/"fJ6)R2VڋH[ N4q4dp?e/1R{57q= A5$96ǢrkPEqՓ!wב&Lŝ˥:nvmo(Q^G4}We5 ¥}շյTm5wLf}J?Hepq F_d\UՅq~ѯ{btRL(c*j~J6M4F9 O B0fH#U\dK<*NSy`8vvL'~K:3Z s LNX}:tV,*̙\gJJl.6 -=()]d=~PˍQnN`<[dKbCoZi8.ۍ΅ϟ / >l d!̊/K·dh0*N_./UEIENDB`latexdraw-2.0.8+1.orig/res/arrowStyles/line.barIn.left.png0000644000000000000000000000100211347255510020240 0ustar PNG  IHDR7%qbKGD pHYs  tIME -qF5tEXtCommentCreated with The GIMP for the TeXDraw project|vNIDATx홽JPZM:T\ɹ+o%TDkT${ rFT,r '}!SC/`kj?EU3Vsvk4I[MU>;Knp1•Aۓp%Lc>Uc;04Nc-G;RM8MsռsF&W(5[~YcDX26ϩQsAy.Uݻ{-Ϣp5g&*9--p̽R t9N<>J!tW'w F8!eMIENDB`latexdraw-2.0.8+1.orig/res/arrowStyles/line.rarrow.left.png0000644000000000000000000000227411347255510020535 0ustar PNG  IHDR7%qbKGD pHYs  \IDATxݙOLU?.qwK<4 JI4G/ԣ^4<44^`4k5b4&CK `!6^,X",݅no~R /GW庤ʖ2gU< W"@8]e8Mot$třV5:H; .]VC =q{` WǶ?ҘGetSSۻĕ6?_S,wv/&oBf[ G*e  domͼq%Y\4 h]DɹsBp@BAz4sVRDjoϦ H6٧sBgU[L%ySGW! ‰)]}!X(TB4&_&ba*ܚc K$ )!ppyگI@2KɝpOZnuN)E"FE3@~J_74&7 ~#۶\SJHS'oF.lS:eh|иihJ9pDbvҠLB@O}O)jV5A2BL\[Zzųqq YmBK\/=.;N m'j&2MB`@;[tV2 t ̀ LLl'7O? B$lHi\,xmb]O !/6om%m`XRecC{^J8n&PY),>wlno+$ų`Dȡ)xu0I`T a #%wM!'#vp㬞 MVz(]&*h~A[G=f ]J¹VYA+`fYc$lqű6]-~ՊGCZhB܁ﶴKiKRZj2wF^Mw$c!0kw&Hccy6DK$}M 1޵74W]4X=?&9s~P M5QP)1Uى ji+ܯ"x!dԘ04BU9~ǣ{%SUIENDB`latexdraw-2.0.8+1.orig/res/arrowStyles/line.roundIn.right.png0000644000000000000000000000071111347255510021014 0ustar PNG  IHDR7%qbKGD pHYs  iIDATx=N@r#p:: -L27 @?yI! 'lYYmb ]"C9'xJn …T| "r\RHj\>@v5>@󫉶S/O `?rdRsuHYX/)lU^R2p{0\8YM)-gښn˟)sb5$m#TSt9eA) lw%VRp`; ! I,S!ł;}<;`wƪx aePihͧ"`0'??Rm"J|q/+ [~aIENDB`latexdraw-2.0.8+1.orig/res/arrowStyles/line.bracket.right.png0000644000000000000000000000120411347255510021007 0ustar PNG  IHDR7- bKGD pHYs  tIME 35tEXtCommentCreated with The GIMP for the TeXDraw project|vIDATxA/A$V")"޸7"Np\\\\A94MQtұL柼dwvgw*A3*8Mr/0M{ƖJbL&s}>@Dlh-@1dcPmm\4 >[/Ak}oܚxGĨ**ڎIDNbߜ9Gr~|+ olF®W4ٯo'O/uIP4jHN *g-@Hk5N3^{=jk͍#9rIZC 4+uS&{3ss׬z3*{Sd=yB, K֮8[;Tes^s -2 c9%fy=&CJ|IAPg&ά<м-V+q38wi<^fI7r\'>,QsǫlIENDB`latexdraw-2.0.8+1.orig/res/arrowStyles/line.barEnd.right.png0000644000000000000000000000051411347255510020572 0ustar PNG  IHDR7%qbKGD pHYs  tIME soIDATx= @!xOOK/Rmr^A =haJa,VY3 kD형}gE'`d zNj[;[5σ=>NpZAqGqyᏆ&YkIqw.0nu~I m1&ZGqGqUMk*w\QA]y(+/nIENDB`latexdraw-2.0.8+1.orig/res/arrowStyles/line.arc.right.png0000644000000000000000000000211611347255510020144 0ustar PNG  IHDR7+bKGD pHYs  IDATxݙOhU?diiSZ"4-=4k뱂(zPC.ED<AHERd7yM7dٝI&|ޛ{ J)I PE6Õm@, tLm-i`ƅ4YN5/ Cxl Q27b1%GNjOqJ):ڹ$:V"aBYʫ"xygELGiG51>s14*ܿ隷txHȴW,VbFw?osu2ml]ɫ?V/:Kdg %ެ2.*Wq07W)* qR*sv O^{&NJBؤY\wP4|11Zp8Ltv+ky!.#nu:QWKt09 .e|IENDB`latexdraw-2.0.8+1.orig/res/ok.png0000644000000000000000000000242311347255510013411 0ustar PNG  IHDR bKGD pHYs  tIME6 n]4IDATxڍ9o\U]}m왱=^BرchAB ))Oh H` 2;:y]ާ:O:!p m)svJ2~T]vjn%.7Z&s* Rhe3L]!ۃl}jwo X(!dwjn6K55qE`' HfOט(Ĩ:5z~ޖ'!85S$3 eRDk=$92&+!,{q"ڊae;J8 <8ҧ2Jjgy*˒WҪ&!ƚ"5Puh 5:. $4]>{d}wmS=4Mv:WFtA\bR˸-t ɴz2EK(m΄P/UOI( Azqً(Jv՟u>h29/y+~"h&r uСmczuFaNrs˰_H>'IjZttO˳~Í eLC/89h$^H2wvܕgfƸחi>נh SFhP=xf~ hӌ(۴ZV׆IqζFU1:ȏtA(3rs',|`jhNB Lc2kO'hҔ䜝J1Mb܉5u 1CIENDB`latexdraw-2.0.8+1.orig/res/Cut.png0000644000000000000000000000223111347255510013530 0ustar PNG  IHDRĴl;bKGD pHYs  tIME 21A|&IDAT8˅]H\G3;wݬ&cc̮641%Ո$Җ>I_6AK@!!!?Si5%&icm4{g!+Ȳ s99 I_,4ͪ;@ϞjЩi?$ir22#4M}kiN7^x ڴo/HǽͲgPa۹/-sqw* iD#ix|j5nCa mW<>'33s`y8Bi-=]"%#YWm.O 7VZڻ҂Z484 N'xyy?=R9c=X,Z+F[K{끇ݗ w_tkꀔwb6'ٲ`y%233?)(,'hSZ{-mfAQ9!iGBtsN>go "!D1=3 f=H`(psx$P]sTeqI)Lӄa?|M;U: &@qq1BXzAc30IqnӴJHmsmޗ㿣5b/UtKQ̤퍊yQVV(P賆gge"W0- iʊcq>wu˕'}4pgX gaQL|+˕/lkR{Wx^$pۡ(Xaw7XPBt/}H^h}ji>1a%!Tv;(!':{JȼnXÒCczk䞠clL,,,r @,^xv-/PA] @`4q 3vy.@0χe)~ىէRPUd( `1@M!]մ*e%%Iyi$bVR]V3BD[9|b4z$;M@\J@ĺ ,՟IENDB`latexdraw-2.0.8+1.orig/.settings/0000755000000000000000000000000011347255510013416 5ustar latexdraw-2.0.8+1.orig/.settings/org.eclipse.ltk.core.refactoring.prefs0000644000000000000000000000021211347255510022706 0ustar #Mon Oct 17 18:40:52 CEST 2005 eclipse.preferences.version=1 org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false latexdraw-2.0.8+1.orig/.settings/org.eclipse.jdt.ui.prefs0000644000000000000000000000013311347255510020062 0ustar #Wed May 27 13:07:05 CEST 2009 eclipse.preferences.version=1 formatter_settings_version=11 latexdraw-2.0.8+1.orig/.settings/org.eclipse.jdt.core.prefs0000644000000000000000000001433711347255510020410 0ustar #Mon Jan 18 22:41:52 CET 2010 eclipse.preferences.version=1 org.eclipse.jdt.core.builder.cleanOutputFolder=clean org.eclipse.jdt.core.builder.duplicateResourceTask=warning org.eclipse.jdt.core.builder.invalidClasspath=abort org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch org.eclipse.jdt.core.circularClasspath=error org.eclipse.jdt.core.classpath.exclusionPatterns=enabled org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled 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.doc.comment.support=enabled org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 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.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=warning org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled org.eclipse.jdt.core.compiler.problem.fieldHiding=warning 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.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning 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.nullReference=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=warning org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeUncheckedExceptions=disabled 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.unusedParameter=warning 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.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.formatter.comment.clear_blank_lines=true org.eclipse.jdt.core.formatter.comment.format_comments=true org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error latexdraw-2.0.8+1.orig/.settings/org.eclipse.core.resources.prefs0000644000000000000000000000024111347255510021626 0ustar #Mon Jul 02 19:55:44 CEST 2007 eclipse.preferences.version=1 encoding//lang/en/LaTeXDrawFrame.properties=8859_1 encoding//lang/en/dialogFrames.properties=8859_1