You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
(23) |
Apr
(254) |
May
(252) |
Jun
(209) |
Jul
(198) |
Aug
(192) |
Sep
(207) |
Oct
(120) |
Nov
(179) |
Dec
(52) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(48) |
Feb
(69) |
Mar
(129) |
Apr
(250) |
May
(113) |
Jun
(177) |
Jul
(228) |
Aug
(155) |
Sep
(218) |
Oct
(185) |
Nov
(109) |
Dec
(88) |
2009 |
Jan
(83) |
Feb
(39) |
Mar
(70) |
Apr
(47) |
May
(48) |
Jun
(67) |
Jul
(61) |
Aug
(97) |
Sep
(221) |
Oct
(141) |
Nov
(70) |
Dec
(61) |
2010 |
Jan
(45) |
Feb
(76) |
Mar
(178) |
Apr
(106) |
May
(57) |
Jun
(32) |
Jul
(64) |
Aug
(98) |
Sep
(96) |
Oct
(19) |
Nov
(34) |
Dec
(117) |
2011 |
Jan
(55) |
Feb
(48) |
Mar
(64) |
Apr
(21) |
May
(39) |
Jun
(53) |
Jul
(99) |
Aug
(56) |
Sep
(39) |
Oct
(26) |
Nov
(19) |
Dec
(69) |
2012 |
Jan
(17) |
Feb
(40) |
Mar
(17) |
Apr
|
May
(2) |
Jun
(8) |
Jul
(2) |
Aug
(10) |
Sep
(10) |
Oct
(38) |
Nov
(48) |
Dec
(70) |
2013 |
Jan
(43) |
Feb
(47) |
Mar
(39) |
Apr
(37) |
May
(25) |
Jun
(6) |
Jul
(20) |
Aug
(49) |
Sep
(33) |
Oct
(34) |
Nov
(75) |
Dec
(6) |
2014 |
Jan
(32) |
Feb
(10) |
Mar
(17) |
Apr
|
May
|
Jun
(26) |
Jul
(5) |
Aug
|
Sep
(4) |
Oct
(23) |
Nov
(80) |
Dec
(48) |
2015 |
Jan
(80) |
Feb
(50) |
Mar
(58) |
Apr
(20) |
May
(11) |
Jun
(16) |
Jul
(24) |
Aug
(27) |
Sep
(56) |
Oct
(30) |
Nov
(16) |
Dec
(6) |
2016 |
Jan
(31) |
Feb
(14) |
Mar
(23) |
Apr
(17) |
May
(40) |
Jun
(12) |
Jul
(17) |
Aug
(9) |
Sep
(32) |
Oct
(36) |
Nov
(23) |
Dec
(9) |
2017 |
Jan
(37) |
Feb
(23) |
Mar
(65) |
Apr
(22) |
May
(6) |
Jun
(3) |
Jul
|
Aug
|
Sep
(3) |
Oct
(22) |
Nov
(63) |
Dec
(71) |
2018 |
Jan
(83) |
Feb
(21) |
Mar
(35) |
Apr
(44) |
May
(14) |
Jun
(12) |
Jul
(8) |
Aug
(18) |
Sep
(10) |
Oct
(145) |
Nov
(144) |
Dec
(76) |
2019 |
Jan
(18) |
Feb
(28) |
Mar
(5) |
Apr
(208) |
May
(291) |
Jun
(158) |
Jul
(27) |
Aug
(8) |
Sep
(10) |
Oct
(83) |
Nov
(41) |
Dec
(31) |
2020 |
Jan
(16) |
Feb
(46) |
Mar
(100) |
Apr
(78) |
May
(69) |
Jun
(71) |
Jul
(28) |
Aug
(131) |
Sep
(176) |
Oct
(89) |
Nov
(147) |
Dec
(19) |
2021 |
Jan
(19) |
Feb
(25) |
Mar
(91) |
Apr
(98) |
May
(14) |
Jun
(44) |
Jul
(8) |
Aug
(3) |
Sep
(38) |
Oct
(57) |
Nov
(97) |
Dec
(74) |
2022 |
Jan
(89) |
Feb
(47) |
Mar
(15) |
Apr
(50) |
May
(54) |
Jun
(56) |
Jul
(80) |
Aug
(12) |
Sep
(11) |
Oct
(60) |
Nov
(48) |
Dec
(4) |
2023 |
Jan
(75) |
Feb
(49) |
Mar
(84) |
Apr
(24) |
May
(13) |
Jun
(74) |
Jul
(32) |
Aug
(66) |
Sep
(50) |
Oct
(38) |
Nov
(105) |
Dec
(181) |
2024 |
Jan
(21) |
Feb
(49) |
Mar
(77) |
Apr
(84) |
May
(20) |
Jun
(71) |
Jul
(53) |
Aug
(33) |
Sep
(54) |
Oct
(124) |
Nov
(151) |
Dec
(73) |
2025 |
Jan
(61) |
Feb
(17) |
Mar
(136) |
Apr
(72) |
May
(200) |
Jun
(238) |
Jul
(91) |
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <ho...@us...> - 2007-08-28 22:47:45
|
Revision: 2762 http://skim-app.svn.sourceforge.net/skim-app/?rev=2762&view=rev Author: hofman Date: 2007-08-28 14:54:02 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Make sure we don't link to stale temporary annotations when reloading PDF. Modified Paths: -------------- trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-08-28 21:52:01 UTC (rev 2761) +++ trunk/SKMainWindowController.m 2007-08-28 21:54:02 UTC (rev 2762) @@ -754,6 +754,7 @@ [temporaryAnnotationTimer invalidate]; [temporaryAnnotationTimer release]; temporaryAnnotationTimer = nil; + CFSetRemoveAllValues(temporaryAnnotations); // make sure these will not be activated, or they can lead to a crash [pdfView removeHoverRects]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-28 21:34:39
|
Revision: 2760 http://skim-app.svn.sourceforge.net/skim-app/?rev=2760&view=rev Author: hofman Date: 2007-08-28 14:34:36 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Don't write empty notes from command line tool. Modified Paths: -------------- trunk/skimnotes.m Modified: trunk/skimnotes.m =================================================================== --- trunk/skimnotes.m 2007-08-28 20:25:21 UTC (rev 2759) +++ trunk/skimnotes.m 2007-08-28 21:34:36 UTC (rev 2760) @@ -129,10 +129,14 @@ } if (data) { if ([notesPath isEqualToString:@"-"]) { - [(NSFileHandle *)[NSFileHandle fileHandleWithStandardOutput] writeData:data]; + if ([data length]) + [(NSFileHandle *)[NSFileHandle fileHandleWithStandardOutput] writeData:data]; success = YES; } else { - success = [data writeToFile:notesPath atomically:YES]; + if ([data length] || ([fm fileExistsAtPath:notesPath isDirectory:&isDir] && isDir == NO)) + success = [data writeToFile:notesPath atomically:YES]; + else + success = YES; } } } else if (action == SKNActionSet && notesPath && ([notesPath isEqualToString:@"-"] || ([fm fileExistsAtPath:notesPath isDirectory:&isDir] && isDir == NO))) { @@ -144,7 +148,7 @@ data = [NSData dataWithContentsOfFile:notesPath]; if (data) { success = [fm removeExtendedAttribute:SKIM_NOTES_KEY atPath:pdfPath traverseLink:YES error:&error]; - if (success || [error code] == ENOATTR) + if ((success || [error code] == ENOATTR) && [data length]) success = [fm setExtendedAttributeNamed:SKIM_NOTES_KEY toValue:data atPath:pdfPath options:0 error:NULL]; } } else if (action == SKNActionRemove) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-28 20:25:24
|
Revision: 2759 http://skim-app.svn.sourceforge.net/skim-app/?rev=2759&view=rev Author: hofman Date: 2007-08-28 13:25:21 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Invert a check for directory. Modified Paths: -------------- trunk/Files_SKExtensions.m Modified: trunk/Files_SKExtensions.m =================================================================== --- trunk/Files_SKExtensions.m 2007-08-28 19:50:49 UTC (rev 2758) +++ trunk/Files_SKExtensions.m 2007-08-28 20:25:21 UTC (rev 2759) @@ -231,7 +231,7 @@ require_noerr(result, FSPathMakeRef); /* make sure container is a directory */ - require_action(isDirectory == false, ContainerNotDirectory, result = dirNFErr); + require_action(isDirectory == true, ContainerNotDirectory, result = dirNFErr); /* delete the container recursively */ result = FSDeleteContainer(&container); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-28 19:50:52
|
Revision: 2758 http://skim-app.svn.sourceforge.net/skim-app/?rev=2758&view=rev Author: hofman Date: 2007-08-28 12:50:49 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Add a remark about showing the contents of a bundle in the help. Modified Paths: -------------- trunk/Dutch.lproj/Skim Help/skim.texi trunk/English.lproj/Skim Help/skim.texi trunk/French.lproj/Skim Help/skim.texi trunk/Italian.lproj/Skim Help/skim.texi Modified: trunk/Dutch.lproj/Skim Help/skim.texi =================================================================== --- trunk/Dutch.lproj/Skim Help/skim.texi 2007-08-28 19:33:56 UTC (rev 2757) +++ trunk/Dutch.lproj/Skim Help/skim.texi 2007-08-28 19:50:49 UTC (rev 2758) @@ -1106,6 +1106,8 @@ @end enumerate @endbox +Een PDF bundel bevat het overanderde PDF-bestand en bestanden voor de notities. U kunt deze bestanden in de Finder zien door 'Toon pakketinhoud' van het contextuele menu te kiezen. + @heading Zie ook @menu * Als ik een PDF-bestand email verlies ik de notities en markeringen:: Modified: trunk/English.lproj/Skim Help/skim.texi =================================================================== --- trunk/English.lproj/Skim Help/skim.texi 2007-08-28 19:33:56 UTC (rev 2757) +++ trunk/English.lproj/Skim Help/skim.texi 2007-08-28 19:50:49 UTC (rev 2758) @@ -1100,6 +1100,8 @@ @end enumerate @endbox +A PDF bundle contains the unmodified PDF file and files containing the notes. You can see those file in the Finder using the 'Show package Contents' contextual menu item. + @heading See also @menu * Emailing a PDF file loses notes or highlights:: Modified: trunk/French.lproj/Skim Help/skim.texi =================================================================== --- trunk/French.lproj/Skim Help/skim.texi 2007-08-28 19:33:56 UTC (rev 2757) +++ trunk/French.lproj/Skim Help/skim.texi 2007-08-28 19:50:49 UTC (rev 2758) @@ -1100,6 +1100,8 @@ @end enumerate @endbox +A PDF bundle contains the unmodified PDF file and files containing the notes. You can see those file in the Finder using the 'Show package Contents' contextual menu item. + @heading See also @menu * Emailing a PDF file loses notes or highlights:: Modified: trunk/Italian.lproj/Skim Help/skim.texi =================================================================== --- trunk/Italian.lproj/Skim Help/skim.texi 2007-08-28 19:33:56 UTC (rev 2757) +++ trunk/Italian.lproj/Skim Help/skim.texi 2007-08-28 19:50:49 UTC (rev 2758) @@ -1100,6 +1100,8 @@ @end enumerate @endbox +A PDF bundle contains the unmodified PDF file and files containing the notes. You can see those file in the Finder using the 'Show package Contents' contextual menu item. + @heading See also @menu * Emailing a PDF file loses notes or highlights:: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-28 19:34:00
|
Revision: 2757 http://skim-app.svn.sourceforge.net/skim-app/?rev=2757&view=rev Author: hofman Date: 2007-08-28 12:33:56 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Add section about saving to a bundle to help. Modified Paths: -------------- trunk/Dutch.lproj/Skim Help/skim.texi trunk/English.lproj/Skim Help/skim.texi trunk/French.lproj/Skim Help/skim.texi trunk/Italian.lproj/Skim Help/skim.texi Modified: trunk/Dutch.lproj/Skim Help/skim.texi =================================================================== --- trunk/Dutch.lproj/Skim Help/skim.texi 2007-08-28 19:07:06 UTC (rev 2756) +++ trunk/Dutch.lproj/Skim Help/skim.texi 2007-08-28 19:33:56 UTC (rev 2757) @@ -868,7 +868,7 @@ @box{taskbox} @itemize -@item Om het venster te vergroten of verkleinen zodat het precies om de PDF past, kies Venster > Passend. +@item Om het venster te vergroten of verkleinen zodat het precies om de PDF past, kies Venster > Pas om PDF. @end itemize @endbox @@ -1044,6 +1044,8 @@ U kunt de notities en markeringen ook in een apart .sim-bestand bewaren. De ontvanger van de email kan de notities dan later aan het PDF-bestand toevoegen. +Als laatste kunt u ook de PDF en notities bewaren in een PDF bundel, dat de PDF en notities samenvoegt. + @box{taskbox} @heading Om de notities in een apart bestand te bewaren: @enumerate @@ -1060,6 +1062,16 @@ @item Maak zeker dat u het PDF-bestand bewaard heeft. @item Kies Archief > Bewaar gearchiveerd bestand@dots{}, kies a locatie om het archief te bewaren, en druk op de OK-knop. @end enumerate +@heading Om een schijfkopie van een PDF-document te maken: +@enumerate +@item Maak zeker dat u het PDF-bestand bewaard heeft. +@item Kies Archief > Bewaar schijfkopie@dots{}, kies a locatie om de schijfkopie te bewaren, en druk op de OK-knop. +@end enumerate +@heading Om een kopie van de PDF en notities in een bundel te bewaren: +@enumerate +@item Kies File > Exporteer@dots{}. +@item Selecteer "PDF bundel" van de Structuur popup, kies een locatie om de bundel te bewaren, en druk op de OK-knop. +@end enumerate @endbox Het is belangrijk dat het notitie-bestand geassocieerd is met het PDF-bestand. Daarom is het meestal het beste om dezelfde naam voor het PDF-bestand en het .skim-bestand te kiezen. Als dit het geval is, zal Skim automatisch de keuze aanbieden om de notities in de notitie-bestand te lezen wanneer u het PDF-bestand opent. @@ -1068,10 +1080,42 @@ @menu * Notities aan een PDF-document toevoegen:: * Gedeelten van een PDF-document markeren:: +* Notities en markeringen in een apart bestand bewaren:: +* Notities en markeringen uit een apart Skim notities-bestand toevoegen:: +* PDF en notities in een bundel bewaren:: @end menu @c ====================================================================================== +@topic PDF en notities in een bundel bewaren + +Notities en markeringen die aan een PDF-bestand zijn toegevoegd worden niet bewaard in de PDF-data, maar worden toegevoegd als 'uitgebreide attributen' (extended attributes). Deze kunnen soms verloren gaan als het bestand gecomprimeerd wordt of via email word verstuurd. + +U kunt de PDF and de notities ook bewaren in een bundle, met bestandsextensie pdfd. + +@box{taskbox} +@heading Om de PDF en notities in een bundel te bewaren: +@enumerate +@item Kies File > Bewaar als@dots{}. +@item Selecteer "PDF bundel" van de Structuur popup, kies een locatie om de bundel te bewaren, en druk op de OK-knop. +@end enumerate +@heading Om een kopie van de PDF en notities in een bundel te bewaren: +@enumerate +@item Kies File > Exporteer@dots{}. +@item Selecteer "PDF bundel" van de Structuur popup, kies een locatie om de bundel te bewaren, en druk op de OK-knop. +@end enumerate +@endbox + +@heading Zie ook +@menu +* Als ik een PDF-bestand email verlies ik de notities en markeringen:: +* PDF-bestanden zonder de notities en markeringen bewaren:: +* PDF-bestanden met de notities en markeringen inbegrepen bewaren:: +* Notities en markeringen in een apart bestand bewaren:: +@end menu + +@c ====================================================================================== + @topic Notities en markeringen in een apart bestand bewaren Notities en markeringen die aan een PDF-bestand zijn toegevoegd worden niet bewaard in de PDF-data, maar worden toegevoegd als 'uitgebreide attributen' (extended attributes). Deze kunnen soms verloren gaan als het bestand gecomprimeerd wordt of via email word verstuurd. @@ -1162,6 +1206,7 @@ @heading Zie ook @menu * PDF-bestanden zonder de notities en markeringen bewaren:: +* Ik kan notities en merkeringen niet in andere PDF-vertoningsprogrammas zien:: @end menu @c ====================================================================================== Modified: trunk/English.lproj/Skim Help/skim.texi =================================================================== --- trunk/English.lproj/Skim Help/skim.texi 2007-08-28 19:07:06 UTC (rev 2756) +++ trunk/English.lproj/Skim Help/skim.texi 2007-08-28 19:33:56 UTC (rev 2757) @@ -864,7 +864,7 @@ @box{taskbox} @itemize -@item To resize a window so that it fits around the PDF file, choose Window > Fit. +@item To resize a window so that it fits around the PDF file, choose Window > Fit to PDF. @end itemize @endbox @@ -1036,8 +1036,10 @@ There are several ways to preserve the notes. Some compression methods preserve extended attributes. Apple's Create Archive unfortunately does not preserve them. You should compress and expand to test whether they are saved. You can also create a disk image to wrap the PDF file. Compression using tar and gzip also preserves the notes. -You can also save the notes to a separate .skim file. The receiver of the email can later add the notes to the PDF. +You can also save the notes to a separate .skim file. The receiver of the email can later add the notes to the PDF. +And lastly, you can save the PDF and notes in a PDF bundle, that wraps the PDF and the notes together. + @box{taskbox} @heading To save the notes to a separate file: @enumerate @@ -1054,6 +1056,16 @@ @item Make sure you have saved the PDF file with the notes. @item Choose File > Save Archive @dots{}, choose a location to save the archive to, and press OK. @end enumerate +@heading To create a disk image of the PDF document: +@enumerate +@item Make sure you have saved the PDF file with the notes. +@item Choose File > Save Disk Image @dots{}, choose a location to save the disk image to, and press OK. +@end enumerate +@heading To save the PDF and notes to a bundle: +@enumerate +@item Choose File > Export@dots{}. +@item Select "PDF Bundle" from the File Format popup, choose a location to save the bundle to, and press OK. +@end enumerate @endbox It is important that the notes file is associated to the PDF file. Therefore it is best to choose the same file name for the .pdf file and the .skim file. In that case, Skim will automatically offer to add the notes from the notes file when you open the PDF file. @@ -1062,10 +1074,42 @@ @menu * Adding notes to a PDF document:: * Highlighting sections of a PDF document:: +* Saving notes and highlights to a separate file:: +* Adding notes and highlights from a separate Skim notes file:: +* Saving PDF and notes in a bundle:: @end menu @c ====================================================================================== +@topic Saving PDF and notes in a bundle + +Notes and highlights you add to a PDF document are not saved in the PDF data, but are added to the file as extended attributes. Those can sometimes be lost when archiving the PDF file or sending it over email. + +Alternatively, you can save the PDF and the notes wrapped in a bundle, with file extension pdfd. + +@box{taskbox} +@heading To save the PDF and notes as a bundle: +@enumerate +@item Choose File > Save As@dots{}. +@item Select "PDF Bundle" from the File Format popup, choose a location to save the PDF bundle, and press OK. +@end enumerate +@heading To save a copy of the PDF and notes as a bundle: +@enumerate +@item Choose File > Export@dots{}. +@item Select "PDF Bundle" from the File Format popup, choose a location to save the PDF bundle, and press OK. +@end enumerate +@endbox + +@heading See also +@menu +* Emailing a PDF file loses notes or highlights:: +* Saving PDF files without notes and highlights:: +* Saving PDF files with the notes and highlights included:: +* Saving notes and highlights to a separate file:: +@end menu + +@c ====================================================================================== + @topic Saving notes and highlights to a separate file Notes and highlights you add to a PDF document are not saved in the PDF data, but are added to the file as extended attributes. Those can sometimes be lost when archiving the PDF file or sending it over email. @@ -1156,6 +1200,7 @@ @heading See also @menu * Saving PDF files without notes and highlights:: +* I don't see notes and highlights in other PDF viewers:: @end menu @c ====================================================================================== Modified: trunk/French.lproj/Skim Help/skim.texi =================================================================== --- trunk/French.lproj/Skim Help/skim.texi 2007-08-28 19:07:06 UTC (rev 2756) +++ trunk/French.lproj/Skim Help/skim.texi 2007-08-28 19:33:56 UTC (rev 2757) @@ -864,7 +864,7 @@ @box{taskbox} @itemize -@item To resize a window so that it fits around the PDF file, choose Window > Fit. +@item To resize a window so that it fits around the PDF file, choose Window > Fit to PDF. @end itemize @endbox @@ -1036,8 +1036,10 @@ There are several ways to preserve the notes. Some compression methods preserve extended attributes. Apple's Create Archive unfortunately does not preserve them. You should compress and expand to test whether they are saved. You can also create a disk image to wrap the PDF file. Compression using tar and gzip also preserves the notes. -You can also save the notes to a separate .skim file. The receiver of the email can later add the notes to the PDF. +You can also save the notes to a separate .skim file. The receiver of the email can later add the notes to the PDF. +And lastly, you can save the PDF and notes in a PDF bundle, that wraps the PDF and the notes together. + @box{taskbox} @heading To save the notes to a separate file: @enumerate @@ -1054,6 +1056,16 @@ @item Make sure you have saved the PDF file with the notes. @item Choose File > Save Archive @dots{}, choose a location to save the archive to, and press OK. @end enumerate +@heading To create a disk image of the PDF document: +@enumerate +@item Make sure you have saved the PDF file with the notes. +@item Choose File > Save Disk Image @dots{}, choose a location to save the disk image to, and press OK. +@end enumerate +@heading To save the PDF and notes to a bundle: +@enumerate +@item Choose File > Export@dots{}. +@item Select "PDF Bundle" from the File Format popup, choose a location to save the bundle to, and press OK. +@end enumerate @endbox It is important that the notes file is associated to the PDF file. Therefore it is best to choose the same file name for the .pdf file and the .skim file. In that case, Skim will automatically offer to add the notes from the notes file when you open the PDF file. @@ -1062,10 +1074,42 @@ @menu * Adding notes to a PDF document:: * Highlighting sections of a PDF document:: +* Saving notes and highlights to a separate file:: +* Adding notes and highlights from a separate Skim notes file:: +* Saving PDF and notes in a bundle:: @end menu @c ====================================================================================== +@topic Saving PDF and notes in a bundle + +Notes and highlights you add to a PDF document are not saved in the PDF data, but are added to the file as extended attributes. Those can sometimes be lost when archiving the PDF file or sending it over email. + +Alternatively, you can save the PDF and the notes wrapped in a bundle, with file extension pdfd. + +@box{taskbox} +@heading To save the PDF and notes as a bundle: +@enumerate +@item Choose File > Save As@dots{}. +@item Select "PDF Bundle" from the File Format popup, choose a location to save the PDF bundle, and press OK. +@end enumerate +@heading To save a copy of the PDF and notes as a bundle: +@enumerate +@item Choose File > Export@dots{}. +@item Select "PDF Bundle" from the File Format popup, choose a location to save the PDF bundle, and press OK. +@end enumerate +@endbox + +@heading See also +@menu +* Emailing a PDF file loses notes or highlights:: +* Saving PDF files without notes and highlights:: +* Saving PDF files with the notes and highlights included:: +* Saving notes and highlights to a separate file:: +@end menu + +@c ====================================================================================== + @topic Saving notes and highlights to a separate file Notes and highlights you add to a PDF document are not saved in the PDF data, but are added to the file as extended attributes. Those can sometimes be lost when archiving the PDF file or sending it over email. @@ -1156,6 +1200,7 @@ @heading See also @menu * Saving PDF files without notes and highlights:: +* I don't see notes and highlights in other PDF viewers:: @end menu @c ====================================================================================== Modified: trunk/Italian.lproj/Skim Help/skim.texi =================================================================== --- trunk/Italian.lproj/Skim Help/skim.texi 2007-08-28 19:07:06 UTC (rev 2756) +++ trunk/Italian.lproj/Skim Help/skim.texi 2007-08-28 19:33:56 UTC (rev 2757) @@ -864,7 +864,7 @@ @box{taskbox} @itemize -@item To resize a window so that it fits around the PDF file, choose Window > Fit. +@item To resize a window so that it fits around the PDF file, choose Window > Fit to PDF. @end itemize @endbox @@ -1036,8 +1036,10 @@ There are several ways to preserve the notes. Some compression methods preserve extended attributes. Apple's Create Archive unfortunately does not preserve them. You should compress and expand to test whether they are saved. You can also create a disk image to wrap the PDF file. Compression using tar and gzip also preserves the notes. -You can also save the notes to a separate .skim file. The receiver of the email can later add the notes to the PDF. +You can also save the notes to a separate .skim file. The receiver of the email can later add the notes to the PDF. +And lastly, you can save the PDF and notes in a PDF bundle, that wraps the PDF and the notes together. + @box{taskbox} @heading To save the notes to a separate file: @enumerate @@ -1054,6 +1056,16 @@ @item Make sure you have saved the PDF file with the notes. @item Choose File > Save Archive @dots{}, choose a location to save the archive to, and press OK. @end enumerate +@heading To create a disk image of the PDF document: +@enumerate +@item Make sure you have saved the PDF file with the notes. +@item Choose File > Save Disk Image @dots{}, choose a location to save the disk image to, and press OK. +@end enumerate +@heading To save the PDF and notes to a bundle: +@enumerate +@item Choose File > Export@dots{}. +@item Select "PDF Bundle" from the File Format popup, choose a location to save the bundle to, and press OK. +@end enumerate @endbox It is important that the notes file is associated to the PDF file. Therefore it is best to choose the same file name for the .pdf file and the .skim file. In that case, Skim will automatically offer to add the notes from the notes file when you open the PDF file. @@ -1062,10 +1074,42 @@ @menu * Adding notes to a PDF document:: * Highlighting sections of a PDF document:: +* Saving notes and highlights to a separate file:: +* Adding notes and highlights from a separate Skim notes file:: +* Saving PDF and notes in a bundle:: @end menu @c ====================================================================================== +@topic Saving PDF and notes in a bundle + +Notes and highlights you add to a PDF document are not saved in the PDF data, but are added to the file as extended attributes. Those can sometimes be lost when archiving the PDF file or sending it over email. + +Alternatively, you can save the PDF and the notes wrapped in a bundle, with file extension pdfd. + +@box{taskbox} +@heading To save the PDF and notes as a bundle: +@enumerate +@item Choose File > Save As@dots{}. +@item Select "PDF Bundle" from the File Format popup, choose a location to save the PDF bundle, and press OK. +@end enumerate +@heading To save a copy of the PDF and notes as a bundle: +@enumerate +@item Choose File > Export@dots{}. +@item Select "PDF Bundle" from the File Format popup, choose a location to save the PDF bundle, and press OK. +@end enumerate +@endbox + +@heading See also +@menu +* Emailing a PDF file loses notes or highlights:: +* Saving PDF files without notes and highlights:: +* Saving PDF files with the notes and highlights included:: +* Saving notes and highlights to a separate file:: +@end menu + +@c ====================================================================================== + @topic Saving notes and highlights to a separate file Notes and highlights you add to a PDF document are not saved in the PDF data, but are added to the file as extended attributes. Those can sometimes be lost when archiving the PDF file or sending it over email. @@ -1156,6 +1200,7 @@ @heading See also @menu * Saving PDF files without notes and highlights:: +* I don't see notes and highlights in other PDF viewers:: @end menu @c ====================================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-28 19:07:13
|
Revision: 2756 http://skim-app.svn.sourceforge.net/skim-app/?rev=2756&view=rev Author: hofman Date: 2007-08-28 12:07:06 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Change Window > Fit menu title to be more explicit. Modified Paths: -------------- trunk/Dutch.lproj/MainMenu.nib/info.nib trunk/Dutch.lproj/MainMenu.nib/keyedobjects.nib trunk/English.lproj/MainMenu.nib/keyedobjects.nib trunk/French.lproj/MainMenu.nib/keyedobjects.nib trunk/Italian.lproj/MainMenu.nib/keyedobjects.nib Modified: trunk/Dutch.lproj/MainMenu.nib/info.nib =================================================================== --- trunk/Dutch.lproj/MainMenu.nib/info.nib 2007-08-28 18:32:50 UTC (rev 2755) +++ trunk/Dutch.lproj/MainMenu.nib/info.nib 2007-08-28 19:07:06 UTC (rev 2756) @@ -7,10 +7,14 @@ <key>IBEditorPositions</key> <dict> <key>29</key> - <string>140 614 542 44 0 0 1440 938 </string> + <string>140 614 635 44 0 0 1440 938 </string> </dict> <key>IBFramework Version</key> <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>29</integer> + </array> <key>IBSystem Version</key> <string>8R218</string> </dict> Modified: trunk/Dutch.lproj/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/English.lproj/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/French.lproj/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/Italian.lproj/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-28 18:32:53
|
Revision: 2755 http://skim-app.svn.sourceforge.net/skim-app/?rev=2755&view=rev Author: hofman Date: 2007-08-28 11:32:50 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Don't add Where From for pdfd file importer. Modified Paths: -------------- trunk/SkimImporter/GetMetadataForFile.m Modified: trunk/SkimImporter/GetMetadataForFile.m =================================================================== --- trunk/SkimImporter/GetMetadataForFile.m 2007-08-28 18:26:32 UTC (rev 2754) +++ trunk/SkimImporter/GetMetadataForFile.m 2007-08-28 18:32:50 UTC (rev 2755) @@ -57,11 +57,8 @@ if (UTTypeEqual(contentTypeUTI, CFSTR("net.sourceforge.skim-app.skimnotes"))) { notePath = (NSString *)pathToFile; sourcePath = [[(NSString *)pathToFile stringByDeletingPathExtension] stringByAppendingPathExtension:@"pdf"]; - if ([[NSFileManager defaultManager] fileExistsAtPath:sourcePath] == NO) - sourcePath = nil; } else if (UTTypeEqual(contentTypeUTI, CFSTR("net.sourceforge.skim-app.pdfd"))) { notePath = [(NSString *)pathToFile stringByAppendingPathComponent:@"data.skim"]; - sourcePath = (NSString *)pathToFile; } if (notePath && [[NSFileManager defaultManager] fileExistsAtPath:notePath]) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-28 18:26:35
|
Revision: 2754 http://skim-app.svn.sourceforge.net/skim-app/?rev=2754&view=rev Author: hofman Date: 2007-08-28 11:26:32 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Add pdfd type to schema.xml of importer. Modified Paths: -------------- trunk/SkimImporter/schema.xml Modified: trunk/SkimImporter/schema.xml =================================================================== --- trunk/SkimImporter/schema.xml 2007-08-28 18:18:03 UTC (rev 2753) +++ trunk/SkimImporter/schema.xml 2007-08-28 18:26:32 UTC (rev 2754) @@ -27,6 +27,19 @@ net_sourceforge_skim_app_notes </displayattrs> </type> + <type name="net.sourceforge.skim-app.pdfd"> + <note> + The keys that this metadata importer handles. + </note> + <allattrs> + net_sourceforge_skim_app_notes + </allattrs> + <displayattrs> + kMDItemContentModificationDate + kMDItemContentCreationDate + net_sourceforge_skim_app_notes + </displayattrs> + </type> </types> </schema> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-28 18:18:11
|
Revision: 2753 http://skim-app.svn.sourceforge.net/skim-app/?rev=2753&view=rev Author: hofman Date: 2007-08-28 11:18:03 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Collapse code for importer. Modified Paths: -------------- trunk/SkimImporter/GetMetadataForFile.m Modified: trunk/SkimImporter/GetMetadataForFile.m =================================================================== --- trunk/SkimImporter/GetMetadataForFile.m 2007-08-28 18:02:23 UTC (rev 2752) +++ trunk/SkimImporter/GetMetadataForFile.m 2007-08-28 18:18:03 UTC (rev 2753) @@ -51,56 +51,21 @@ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; Boolean success = FALSE; + NSString *notePath = nil; + NSString *sourcePath = nil; if (UTTypeEqual(contentTypeUTI, CFSTR("net.sourceforge.skim-app.skimnotes"))) { - NSData *data = [[NSData alloc] initWithContentsOfFile:(NSString *)pathToFile options:NSUncachedRead error:NULL]; - if (data) { - NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithData:data]; - [data release]; - - if (array) { - NSEnumerator *noteEnum = [array objectEnumerator]; - NSDictionary *note; - NSMutableString *textContent = [[NSMutableString alloc] init]; - NSMutableArray *notes = [[NSMutableArray alloc] init]; - while (note = [noteEnum nextObject]) { - NSString *contents = [note objectForKey:@"contents"]; - if (contents) { - if ([textContent length]) - [textContent appendString:@"\n\n"]; - [textContent appendString:contents]; - [notes addObject:contents]; - } - NSString *text = [[note objectForKey:@"text"] string]; - if (text) { - if ([textContent length]) - [textContent appendString:@"\n\n"]; - [textContent appendString:text]; - } - } - [(NSMutableDictionary *)attributes setObject:textContent forKey:(NSString *)kMDItemTextContent]; - [(NSMutableDictionary *)attributes setObject:notes forKey:@"net_sourceforge_skim_app_notes"]; - [textContent release]; - [notes release]; - } - } - - [(NSMutableDictionary *)attributes setObject:@"Skim" forKey:(NSString *)kMDItemCreator]; - - NSString *pdfFile = [[(NSString *)pathToFile stringByDeletingPathExtension] stringByAppendingPathExtension:@"pdf"]; - if ([[NSFileManager defaultManager] fileExistsAtPath:pdfFile]) - [(NSMutableDictionary *)attributes setObject:[NSArray arrayWithObjects:pdfFile, nil] forKey:(NSString *)kMDItemWhereFroms]; - - NSDictionary *fileAttributes = [[NSFileManager defaultManager] fileAttributesAtPath:(NSString *)pathToFile traverseLink:YES]; - NSDate *date; - if (date = [fileAttributes objectForKey:NSFileModificationDate]) - [(NSMutableDictionary *)attributes setObject:date forKey:(NSString *)kMDItemContentModificationDate]; - if (date = [fileAttributes objectForKey:NSFileCreationDate]) - [(NSMutableDictionary *)attributes setObject:date forKey:(NSString *)kMDItemContentCreationDate]; - - success = TRUE; + notePath = (NSString *)pathToFile; + sourcePath = [[(NSString *)pathToFile stringByDeletingPathExtension] stringByAppendingPathExtension:@"pdf"]; + if ([[NSFileManager defaultManager] fileExistsAtPath:sourcePath] == NO) + sourcePath = nil; } else if (UTTypeEqual(contentTypeUTI, CFSTR("net.sourceforge.skim-app.pdfd"))) { - NSData *data = [[NSData alloc] initWithContentsOfFile:[(NSString *)pathToFile stringByAppendingPathComponent:@"data.skim"] options:NSUncachedRead error:NULL]; + notePath = [(NSString *)pathToFile stringByAppendingPathComponent:@"data.skim"]; + sourcePath = (NSString *)pathToFile; + } + + if (notePath && [[NSFileManager defaultManager] fileExistsAtPath:notePath]) { + NSData *data = [[NSData alloc] initWithContentsOfFile:notePath options:NSUncachedRead error:NULL]; if (data) { NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithData:data]; [data release]; @@ -134,7 +99,8 @@ [(NSMutableDictionary *)attributes setObject:@"Skim" forKey:(NSString *)kMDItemCreator]; - [(NSMutableDictionary *)attributes setObject:[NSArray arrayWithObjects:(NSString *)pathToFile, nil] forKey:(NSString *)kMDItemWhereFroms]; + if (sourcePath && [[NSFileManager defaultManager] fileExistsAtPath:sourcePath]) + [(NSMutableDictionary *)attributes setObject:[NSArray arrayWithObjects:sourcePath, nil] forKey:(NSString *)kMDItemWhereFroms]; NSDictionary *fileAttributes = [[NSFileManager defaultManager] fileAttributesAtPath:(NSString *)pathToFile traverseLink:YES]; NSDate *date; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-28 18:02:26
|
Revision: 2752 http://skim-app.svn.sourceforge.net/skim-app/?rev=2752&view=rev Author: hofman Date: 2007-08-28 11:02:23 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Bump version number of importer. Modified Paths: -------------- trunk/SkimImporter/Dutch.lproj/InfoPlist.strings trunk/SkimImporter/English.lproj/InfoPlist.strings trunk/SkimImporter/French.lproj/InfoPlist.strings trunk/SkimImporter/Info.plist trunk/SkimImporter/Italian.lproj/InfoPlist.strings Modified: trunk/SkimImporter/Dutch.lproj/InfoPlist.strings =================================================================== (Binary files differ) Modified: trunk/SkimImporter/English.lproj/InfoPlist.strings =================================================================== (Binary files differ) Modified: trunk/SkimImporter/French.lproj/InfoPlist.strings =================================================================== (Binary files differ) Modified: trunk/SkimImporter/Info.plist =================================================================== --- trunk/SkimImporter/Info.plist 2007-08-28 17:51:51 UTC (rev 2751) +++ trunk/SkimImporter/Info.plist 2007-08-28 18:02:23 UTC (rev 2752) @@ -34,7 +34,7 @@ <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleVersion</key> - <string>0.3</string> + <string>0.4</string> <key>CFPlugInDynamicRegisterFunction</key> <string></string> <key>CFPlugInDynamicRegistration</key> Modified: trunk/SkimImporter/Italian.lproj/InfoPlist.strings =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-28 17:51:55
|
Revision: 2751 http://skim-app.svn.sourceforge.net/skim-app/?rev=2751&view=rev Author: hofman Date: 2007-08-28 10:51:51 -0700 (Tue, 28 Aug 2007) Log Message: ----------- The first argument of the command line tool is the action. Modified Paths: -------------- trunk/skimnotes.m Modified: trunk/skimnotes.m =================================================================== --- trunk/skimnotes.m 2007-08-28 17:39:11 UTC (rev 2750) +++ trunk/skimnotes.m 2007-08-28 17:51:51 UTC (rev 2751) @@ -52,7 +52,7 @@ } } - NSString *actionString = [args objectAtIndex:2]; + NSString *actionString = [args objectAtIndex:1]; if ([actionString isEqualToString:@"get"]) { action = SKNActionGet; } else if ([actionString isEqualToString:@"set"]) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-28 17:39:13
|
Revision: 2750 http://skim-app.svn.sourceforge.net/skim-app/?rev=2750&view=rev Author: hofman Date: 2007-08-28 10:39:11 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Don't cache data to read. Modified Paths: -------------- trunk/SKDocument.m Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-28 17:36:36 UTC (rev 2749) +++ trunk/SKDocument.m 2007-08-28 17:39:11 UTC (rev 2750) @@ -465,7 +465,7 @@ NSError *error = nil; if ([docType isEqualToString:SKPDFDocumentType]) { - if ((data = [[NSData alloc] initWithContentsOfURL:absoluteURL options:0 error:&error]) && + if ((data = [[NSData alloc] initWithContentsOfURL:absoluteURL options:NSUncachedRead error:&error]) && (pdfDoc = [[PDFDocument alloc] initWithURL:absoluteURL])) { if ([self readNotesFromExtendedAttributesAtURL:absoluteURL error:&error] == NO) { NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Unable to Read Notes", @"Message in alert dialog") @@ -525,14 +525,14 @@ } [fileWrapper release]; } else if ([docType isEqualToString:SKPostScriptDocumentType]) { - if (data = [NSData dataWithContentsOfURL:absoluteURL options:0 error:&error]) { + if (data = [NSData dataWithContentsOfURL:absoluteURL options:NSUncachedRead error:&error]) { SKPSProgressController *progressController = [[SKPSProgressController alloc] init]; if (data = [[progressController PDFDataWithPostScriptData:data] retain]) pdfDoc = [[PDFDocument alloc] initWithData:data]; [progressController autorelease]; } } else if ([docType isEqualToString:SKDVIDocumentType]) { - if (data = [NSData dataWithContentsOfURL:absoluteURL options:0 error:&error]) { + if (data = [NSData dataWithContentsOfURL:absoluteURL options:NSUncachedRead error:&error]) { SKDVIProgressController *progressController = [[SKDVIProgressController alloc] init]; if (data = [[progressController PDFDataWithDVIFile:[absoluteURL path]] retain]) pdfDoc = [[PDFDocument alloc] initWithData:data]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-28 17:36:42
|
Revision: 2749 http://skim-app.svn.sourceforge.net/skim-app/?rev=2749&view=rev Author: hofman Date: 2007-08-28 10:36:36 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Importer reads pdf bundle. Modified Paths: -------------- trunk/SkimImporter/GetMetadataForFile.m trunk/SkimImporter/Info.plist Modified: trunk/SkimImporter/GetMetadataForFile.m =================================================================== --- trunk/SkimImporter/GetMetadataForFile.m 2007-08-28 17:12:56 UTC (rev 2748) +++ trunk/SkimImporter/GetMetadataForFile.m 2007-08-28 17:36:36 UTC (rev 2749) @@ -99,6 +99,51 @@ [(NSMutableDictionary *)attributes setObject:date forKey:(NSString *)kMDItemContentCreationDate]; success = TRUE; + } else if (UTTypeEqual(contentTypeUTI, CFSTR("net.sourceforge.skim-app.pdfd"))) { + NSData *data = [[NSData alloc] initWithContentsOfFile:[(NSString *)pathToFile stringByAppendingPathComponent:@"data.skim"] options:NSUncachedRead error:NULL]; + if (data) { + NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithData:data]; + [data release]; + + if (array) { + NSEnumerator *noteEnum = [array objectEnumerator]; + NSDictionary *note; + NSMutableString *textContent = [[NSMutableString alloc] init]; + NSMutableArray *notes = [[NSMutableArray alloc] init]; + while (note = [noteEnum nextObject]) { + NSString *contents = [note objectForKey:@"contents"]; + if (contents) { + if ([textContent length]) + [textContent appendString:@"\n\n"]; + [textContent appendString:contents]; + [notes addObject:contents]; + } + NSString *text = [[note objectForKey:@"text"] string]; + if (text) { + if ([textContent length]) + [textContent appendString:@"\n\n"]; + [textContent appendString:text]; + } + } + [(NSMutableDictionary *)attributes setObject:textContent forKey:(NSString *)kMDItemTextContent]; + [(NSMutableDictionary *)attributes setObject:notes forKey:@"net_sourceforge_skim_app_notes"]; + [textContent release]; + [notes release]; + } + } + + [(NSMutableDictionary *)attributes setObject:@"Skim" forKey:(NSString *)kMDItemCreator]; + + [(NSMutableDictionary *)attributes setObject:[NSArray arrayWithObjects:(NSString *)pathToFile, nil] forKey:(NSString *)kMDItemWhereFroms]; + + NSDictionary *fileAttributes = [[NSFileManager defaultManager] fileAttributesAtPath:(NSString *)pathToFile traverseLink:YES]; + NSDate *date; + if (date = [fileAttributes objectForKey:NSFileModificationDate]) + [(NSMutableDictionary *)attributes setObject:date forKey:(NSString *)kMDItemContentModificationDate]; + if (date = [fileAttributes objectForKey:NSFileCreationDate]) + [(NSMutableDictionary *)attributes setObject:date forKey:(NSString *)kMDItemContentCreationDate]; + + success = TRUE; } else { NSLog(@"Importer asked to handle unknown UTI %@ at path", contentTypeUTI, pathToFile); } Modified: trunk/SkimImporter/Info.plist =================================================================== --- trunk/SkimImporter/Info.plist 2007-08-28 17:12:56 UTC (rev 2748) +++ trunk/SkimImporter/Info.plist 2007-08-28 17:36:36 UTC (rev 2749) @@ -11,6 +11,14 @@ <string>MDImporter</string> <key>LSItemContentTypes</key> <array> + <string>net.sourceforge.skim-app.pdfd</string> + </array> + </dict> + <dict> + <key>CFBundleTypeRole</key> + <string>MDImporter</string> + <key>LSItemContentTypes</key> + <array> <string>net.sourceforge.skim-app.skimnotes</string> </array> </dict> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-28 17:12:58
|
Revision: 2748 http://skim-app.svn.sourceforge.net/skim-app/?rev=2748&view=rev Author: hofman Date: 2007-08-28 10:12:56 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Fix exportable types. Return a standard error when writing fails and the error has not been set. make sure we save chosen export type only when exporting using the panel. Modified Paths: -------------- trunk/Info.plist trunk/SKDocument.h trunk/SKDocument.m Modified: trunk/Info.plist =================================================================== --- trunk/Info.plist 2007-08-28 16:25:19 UTC (rev 2747) +++ trunk/Info.plist 2007-08-28 17:12:56 UTC (rev 2748) @@ -37,7 +37,7 @@ <key>NSExportableAs</key> <array> <string>NSPDFPboardType</string> - <string>PDF Package</string> + <string>PDF Bundle</string> <string>PDF With Embedded Notes</string> <string>PDF Without Notes</string> <string>Skim Notes</string> @@ -73,6 +73,7 @@ <key>NSExportableAs</key> <array> <string>NSPDFPboardType</string> + <string>PDF Bundle</string> <string>PDF With Embedded Notes</string> <string>PDF Without Notes</string> <string>Skim Notes</string> Modified: trunk/SKDocument.h =================================================================== --- trunk/SKDocument.h 2007-08-28 16:25:19 UTC (rev 2747) +++ trunk/SKDocument.h 2007-08-28 17:12:56 UTC (rev 2748) @@ -81,7 +81,7 @@ BOOL autoUpdate; BOOL isSaving; BOOL fileChangedOnDisk; - NSSaveOperationType currentSaveOperation; + BOOL exportUsingPanel; // only used for network filesystems; fileUpdateTimer is not retained by the doc NSDate *lastModifiedDate; Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-28 16:25:19 UTC (rev 2747) +++ trunk/SKDocument.m 2007-08-28 17:12:56 UTC (rev 2748) @@ -174,7 +174,7 @@ } - (BOOL)prepareSavePanel:(NSSavePanel *)savePanel { - if (currentSaveOperation == NSSaveToOperation) { + if (exportUsingPanel) { NSPopUpButton *formatPopup = popUpButtonSubview([savePanel accessoryView]); NSString *lastExportedType = [[NSUserDefaults standardUserDefaults] stringForKey:@"SKLastExportedType"]; if ([[self pdfDocument] allowsPrinting] == NO) { @@ -195,7 +195,8 @@ - (void)runModalSavePanelForSaveOperation:(NSSaveOperationType)saveOperation delegate:(id)delegate didSaveSelector:(SEL)didSaveSelector contextInfo:(void *)contextInfo { // Override so we can determine if this is a save, saveAs or export operation, so we can prepare the correct accessory view - currentSaveOperation = saveOperation; + if (saveOperation == NSSaveToOperation) + exportUsingPanel = YES; [super runModalSavePanelForSaveOperation:saveOperation delegate:delegate didSaveSelector:didSaveSelector contextInfo:contextInfo]; } @@ -203,7 +204,7 @@ if (saveOperation == NSSaveOperation || saveOperation == NSSaveAsOperation) { [self stopCheckingFileUpdates]; isSaving = YES; - } else if (saveOperation == NSSaveToOperation) { + } else if (exportUsingPanel) { [[NSUserDefaults standardUserDefaults] setObject:typeName forKey:@"SKLastExportedType"]; } @@ -211,6 +212,7 @@ // we check for notes and may save a .skim as well: if ([typeName isEqualToString:SKPDFDocumentType]) { + NSFileManager *fm = [NSFileManager defaultManager]; if (success = [super saveToURL:absoluteURL ofType:typeName forSaveOperation:saveOperation error:outError]) { @@ -247,12 +249,12 @@ } } else if ([typeName isEqualToString:SKPDFBundleDocumentType]) { + NSFileManager *fm = [NSFileManager defaultManager]; NSString *path = [absoluteURL path]; BOOL isDir = NO; - BOOL fileExists = [fm fileExistsAtPath:path isDirectory:&isDir]; - if (fileExists == NO || isDir == NO) { + if ([fm fileExistsAtPath:path isDirectory:&isDir] == NO || isDir == NO) { success = [super saveToURL:absoluteURL ofType:typeName forSaveOperation:saveOperation error:outError]; } else { NSString *filename = [path lastPathComponent]; @@ -262,7 +264,7 @@ if (success = [self writeToURL:tmpURL ofType:typeName error:outError]) { - NSSet *knownExtensions = [NSSet setWithObjects:@"pdf", @"skim", @"txt", @"text", @"rtf", nil]; + NSSet *ourExtensions = [NSSet setWithObjects:@"pdf", @"skim", @"txt", @"text", @"rtf", nil]; NSEnumerator *fileEnum; NSString *file; NSMutableDictionary *attributes = [[fm fileAttributesAtPath:path traverseLink:YES] mutableCopy]; @@ -276,7 +278,7 @@ fileEnum = [[fm directoryContentsAtPath:path] objectEnumerator]; while (file = [fileEnum nextObject]) { - if ([knownExtensions containsObject:[[file pathExtension] lowercaseString]]) + if ([ourExtensions containsObject:[[file pathExtension] lowercaseString]]) [fm removeFileAtPath:[path stringByAppendingPathComponent:file] handler:nil]; } @@ -286,10 +288,18 @@ if (success) [NSTask launchedTaskWithLaunchPath:@"/usr/bin/touch" arguments:[NSArray arrayWithObjects:@"-fm", path, nil]]; + + if (saveOperation == NSSaveAsOperation) + [self setFileURL:absoluteURL]; } [fm removeFileAtPath:tmpDir handler:nil]; } + + } else { + + success = [super saveToURL:absoluteURL ofType:typeName forSaveOperation:saveOperation error:outError]; + } if (saveOperation == NSSaveOperation || saveOperation == NSSaveAsOperation) { @@ -304,6 +314,8 @@ isSaving = NO; } + exportUsingPanel = NO; + return success; } @@ -355,6 +367,10 @@ else if (outError != NULL) *outError = [NSError errorWithDomain:SKDocumentErrorDomain code:1 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Unable to write notes as text", @"Error description"), NSLocalizedDescriptionKey, nil]]; } + + if (didWrite == NO && outError != NULL && *outError == nil) + *outError = [NSError errorWithDomain:SKDocumentErrorDomain code:0 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Unable to write file", @"Error description"), NSLocalizedDescriptionKey, nil]]; + return didWrite; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-28 16:25:23
|
Revision: 2747 http://skim-app.svn.sourceforge.net/skim-app/?rev=2747&view=rev Author: hofman Date: 2007-08-28 09:25:19 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Read skim notes from PDF bundles. Modified Paths: -------------- SkimNotesAgent/SkimNotesAgent.m Modified: SkimNotesAgent/SkimNotesAgent.m =================================================================== --- SkimNotesAgent/SkimNotesAgent.m 2007-08-28 16:12:35 UTC (rev 2746) +++ SkimNotesAgent/SkimNotesAgent.m 2007-08-28 16:25:19 UTC (rev 2747) @@ -86,27 +86,58 @@ - (bycopy NSData *)SkimNotesAtPath:(in bycopy NSString *)aFile; { NSError *error; - NSData *data = [[NSFileManager defaultManager] extendedAttributeNamed:@"net_sourceforge_skim-app_notes" atPath:[aFile stringByStandardizingPath] traverseLink:YES error:&error]; - if (nil == data && [error code] != ENOATTR) - fprintf(stderr, "SkimNotesAgent pid %d: error getting Skim notes (%s)\n", getpid(), [[error description] UTF8String]); + NSData *data = nil; + NSString *extension = [[aFile pathExtension] lastPathComponent]; + + if ([extension caseInsensitiveCompare:@"pdfd"] == NSOrderedSame) { + data = [NSData dataWithContentsOfFile:[aFile stringByAppendingPathComponent:@"data.skim"] options:0 error:&error]; + if (nil == data) + fprintf(stderr, "SkimNotesAgent pid %d: error getting Skim notes\n", getpid(), [[error description] UTF8String]); + } else if ([extension caseInsensitiveCompare:@"skim"] == NSOrderedSame) { + data = [NSData dataWithContentsOfFile:aFile options:0 error:&error]; + if (nil == data) + fprintf(stderr, "SkimNotesAgent pid %d: error getting Skim notes\n", getpid(), [[error description] UTF8String]); + } else { + data = [[NSFileManager defaultManager] extendedAttributeNamed:@"net_sourceforge_skim-app_notes" atPath:[aFile stringByStandardizingPath] traverseLink:YES error:&error]; + if (nil == data && [error code] != ENOATTR) + fprintf(stderr, "SkimNotesAgent pid %d: error getting Skim notes (%s)\n", getpid(), [[error description] UTF8String]); + } return data; } - (bycopy NSData *)RTFNotesAtPath:(in bycopy NSString *)aFile; { NSError *error; - NSData *data = [[NSFileManager defaultManager] extendedAttributeNamed:@"net_sourceforge_skim-app_rtf_notes" atPath:[aFile stringByStandardizingPath] traverseLink:YES error:&error]; - if (nil == data && [error code] != ENOATTR) - fprintf(stderr, "SkimNotesAgent pid %d: error getting RTF notes (%s)\n", getpid(), [[error description] UTF8String]); + NSData *data = nil; + NSString *extension = [[aFile pathExtension] lastPathComponent]; + + if ([extension caseInsensitiveCompare:@"pdfd"] == NSOrderedSame) { + data = [NSData dataWithContentsOfFile:[aFile stringByAppendingPathComponent:@"data.rtf"] options:0 error:&error]; + if (nil == data) + fprintf(stderr, "SkimNotesAgent pid %d: error getting Skim notes\n", getpid(), [[error description] UTF8String]); + } else { + data = [[NSFileManager defaultManager] extendedAttributeNamed:@"net_sourceforge_skim-app_rtf_notes" atPath:[aFile stringByStandardizingPath] traverseLink:YES error:&error]; + if (nil == data && [error code] != ENOATTR) + fprintf(stderr, "SkimNotesAgent pid %d: error getting RTF notes (%s)\n", getpid(), [[error description] UTF8String]); + } return data; } - (bycopy NSString *)textNotesAtPath:(in bycopy NSString *)aFile; { NSError *error; - NSString *string = [[NSFileManager defaultManager] propertyListFromExtendedAttributeNamed:@"net_sourceforge_skim-app_text_notes" atPath:[aFile stringByStandardizingPath] traverseLink:YES error:&error]; - if (nil == string && [[[error userInfo] objectForKey:NSUnderlyingErrorKey] code] != ENOATTR) - fprintf(stderr, "SkimNotesAgent pid %d: error getting text notes (%s)\n", getpid(), [[error description] UTF8String]); + NSString *string = nil; + NSString *extension = [[aFile pathExtension] lastPathComponent]; + + if ([extension caseInsensitiveCompare:@"pdfd"] == NSOrderedSame) { + string = [NSString stringWithContentsOfFile:[aFile stringByAppendingPathComponent:@"data.txt"] encoding:NSUTF8StringEncoding error:&error]; + if (nil == string) + fprintf(stderr, "SkimNotesAgent pid %d: error getting Skim notes\n", getpid(), [[error description] UTF8String]); + } else { + string = [[NSFileManager defaultManager] propertyListFromExtendedAttributeNamed:@"net_sourceforge_skim-app_text_notes" atPath:[aFile stringByStandardizingPath] traverseLink:YES error:&error]; + if (nil == string && [[[error userInfo] objectForKey:NSUnderlyingErrorKey] code] != ENOATTR) + fprintf(stderr, "SkimNotesAgent pid %d: error getting text notes (%s)\n", getpid(), [[error description] UTF8String]); + } return string; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-28 16:12:47
|
Revision: 2746 http://skim-app.svn.sourceforge.net/skim-app/?rev=2746&view=rev Author: hofman Date: 2007-08-28 09:12:35 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Make sure existing PDF bundle is writable when saving. Modified Paths: -------------- trunk/SKDocument.m Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-28 15:34:11 UTC (rev 2745) +++ trunk/SKDocument.m 2007-08-28 16:12:35 UTC (rev 2746) @@ -255,8 +255,8 @@ if (fileExists == NO || isDir == NO) { success = [super saveToURL:absoluteURL ofType:typeName forSaveOperation:saveOperation error:outError]; } else { + NSString *filename = [path lastPathComponent]; NSString *tmpDir = SKUniqueDirectoryCreating(NSTemporaryDirectory(), YES); - NSString *filename = [path lastPathComponent]; NSString *tmpPath = [tmpDir stringByAppendingPathComponent:filename]; NSURL *tmpURL = [NSURL fileURLWithPath:tmpPath]; @@ -265,10 +265,15 @@ NSSet *knownExtensions = [NSSet setWithObjects:@"pdf", @"skim", @"txt", @"text", @"rtf", nil]; NSEnumerator *fileEnum; NSString *file; + NSMutableDictionary *attributes = [[fm fileAttributesAtPath:path traverseLink:YES] mutableCopy]; + unsigned long permissions = [[attributes objectForKey:NSFilePosixPermissions] unsignedLongValue]; + + [attributes setObject:[NSNumber numberWithUnsignedLong:permissions | 0200] forKey:NSFilePosixPermissions]; + if ([attributes fileIsImmutable]) + [attributes setObject:[NSNumber numberWithBool:NO] forKey:NSFileImmutable]; + [fm changeFileAttributes:attributes atPath:path]; + [attributes release]; - if ([[[fm fileAttributesAtPath:path traverseLink:YES] objectForKey:NSFileImmutable] boolValue]) - [fm changeFileAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO], NSFileImmutable, nil] atPath:path]; - fileEnum = [[fm directoryContentsAtPath:path] objectEnumerator]; while (file = [fileEnum nextObject]) { if ([knownExtensions containsObject:[[file pathExtension] lowercaseString]]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-28 15:44:59
|
Revision: 2745 http://skim-app.svn.sourceforge.net/skim-app/?rev=2745&view=rev Author: hofman Date: 2007-08-28 08:34:11 -0700 (Tue, 28 Aug 2007) Log Message: ----------- fix typos. Modified Paths: -------------- trunk/SKDocument.m Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-28 13:48:16 UTC (rev 2744) +++ trunk/SKDocument.m 2007-08-28 15:34:11 UTC (rev 2745) @@ -207,52 +207,94 @@ [[NSUserDefaults standardUserDefaults] setObject:typeName forKey:@"SKLastExportedType"]; } - BOOL success = [super saveToURL:absoluteURL ofType:typeName forSaveOperation:saveOperation error:outError]; + BOOL success = NO; + // we check for notes and may save a .skim as well: - if (success && [typeName isEqualToString:SKPDFDocumentType]) { + if ([typeName isEqualToString:SKPDFDocumentType]) { NSFileManager *fm = [NSFileManager defaultManager]; - [self saveNotesToExtendedAttributesAtURL:absoluteURL error:NULL]; - - if ([[NSUserDefaults standardUserDefaults] boolForKey:SKAutoSaveSkimNotesKey]) { - NSString *notesPath = [[absoluteURL path] stringByReplacingPathExtension:@"skim"]; - BOOL canMove = YES; - BOOL fileExists = [fm fileExistsAtPath:notesPath]; + if (success = [super saveToURL:absoluteURL ofType:typeName forSaveOperation:saveOperation error:outError]) { - if (fileExists && (saveOperation == NSSaveAsOperation || saveOperation == NSSaveToOperation)) { - NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"\"%@\" already exists. Do you want to replace it?", @"Message in alert dialog"), [notesPath lastPathComponent]] - defaultButton:NSLocalizedString(@"Save", @"Button title") - alternateButton:NSLocalizedString(@"Cancel", @"Button title") - otherButton:nil - informativeTextWithFormat:NSLocalizedString(@"A file or folder with the same name already exists in %@. Replacing it will overwrite its current contents.", @"Informative text in alert dialog"), [[notesPath stringByDeletingLastPathComponent] lastPathComponent]]; + [self saveNotesToExtendedAttributesAtURL:absoluteURL error:NULL]; + + if ([[NSUserDefaults standardUserDefaults] boolForKey:SKAutoSaveSkimNotesKey]) { + NSString *notesPath = [[absoluteURL path] stringByReplacingPathExtension:@"skim"]; + BOOL canMove = YES; + BOOL fileExists = [fm fileExistsAtPath:notesPath]; - canMove = NSAlertDefaultReturn == [alert runModal]; + if (fileExists && (saveOperation == NSSaveAsOperation || saveOperation == NSSaveToOperation)) { + NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"\"%@\" already exists. Do you want to replace it?", @"Message in alert dialog"), [notesPath lastPathComponent]] + defaultButton:NSLocalizedString(@"Save", @"Button title") + alternateButton:NSLocalizedString(@"Cancel", @"Button title") + otherButton:nil + informativeTextWithFormat:NSLocalizedString(@"A file or folder with the same name already exists in %@. Replacing it will overwrite its current contents.", @"Informative text in alert dialog"), [[notesPath stringByDeletingLastPathComponent] lastPathComponent]]; + + canMove = NSAlertDefaultReturn == [alert runModal]; + } + + if (canMove) { + NSString *tmpPath = [NSTemporaryDirectory() stringByAppendingPathComponent:[[NSProcessInfo processInfo] globallyUniqueString]]; + if ([self writeToURL:[NSURL fileURLWithPath:tmpPath] ofType:SKNotesDocumentType error:NULL]) { + if (fileExists) + canMove = [fm removeFileAtPath:notesPath handler:nil]; + if (canMove) + [fm movePath:tmpPath toPath:notesPath handler:nil]; + else + [fm removeFileAtPath:tmpPath handler:nil]; + } + } } + } + + } else if ([typeName isEqualToString:SKPDFBundleDocumentType]) { + NSFileManager *fm = [NSFileManager defaultManager]; + NSString *path = [absoluteURL path]; + BOOL isDir = NO; + BOOL fileExists = [fm fileExistsAtPath:path isDirectory:&isDir]; + + if (fileExists == NO || isDir == NO) { + success = [super saveToURL:absoluteURL ofType:typeName forSaveOperation:saveOperation error:outError]; + } else { + NSString *tmpDir = SKUniqueDirectoryCreating(NSTemporaryDirectory(), YES); + NSString *filename = [path lastPathComponent]; + NSString *tmpPath = [tmpDir stringByAppendingPathComponent:filename]; + NSURL *tmpURL = [NSURL fileURLWithPath:tmpPath]; - if (canMove) { - NSString *tmpPath = [NSTemporaryDirectory() stringByAppendingPathComponent:[[NSProcessInfo processInfo] globallyUniqueString]]; - if ([self writeToURL:[NSURL fileURLWithPath:tmpPath] ofType:SKNotesDocumentType error:NULL]) { - if (fileExists) - canMove = [fm removeFileAtPath:notesPath handler:nil]; - if (canMove) - [fm movePath:tmpPath toPath:notesPath handler:nil]; - else - [fm removeFileAtPath:tmpPath handler:nil]; + if (success = [self writeToURL:tmpURL ofType:typeName error:outError]) { + + NSSet *knownExtensions = [NSSet setWithObjects:@"pdf", @"skim", @"txt", @"text", @"rtf", nil]; + NSEnumerator *fileEnum; + NSString *file; + + if ([[[fm fileAttributesAtPath:path traverseLink:YES] objectForKey:NSFileImmutable] boolValue]) + [fm changeFileAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO], NSFileImmutable, nil] atPath:path]; + + fileEnum = [[fm directoryContentsAtPath:path] objectEnumerator]; + while (file = [fileEnum nextObject]) { + if ([knownExtensions containsObject:[[file pathExtension] lowercaseString]]) + [fm removeFileAtPath:[path stringByAppendingPathComponent:file] handler:nil]; } + + fileEnum = [[fm directoryContentsAtPath:tmpPath] objectEnumerator]; + while (success && (file = [fileEnum nextObject])) + success = [fm movePath:[tmpPath stringByAppendingPathComponent:file] toPath:[path stringByAppendingPathComponent:file] handler:nil]; + + if (success) + [NSTask launchedTaskWithLaunchPath:@"/usr/bin/touch" arguments:[NSArray arrayWithObjects:@"-fm", path, nil]]; } + + [fm removeFileAtPath:tmpDir handler:nil]; } - - if (saveOperation == NSSaveOperation || saveOperation == NSSaveAsOperation) { + } + + if (saveOperation == NSSaveOperation || saveOperation == NSSaveAsOperation) { + if (success) { [[self undoManager] removeAllActions]; [self updateChangeCount:NSChangeCleared]; fileChangedOnDisk = NO; [lastModifiedDate release]; lastModifiedDate = [[[[NSFileManager defaultManager] fileAttributesAtPath:[self fileName] traverseLink:YES] fileModificationDate] retain]; } - - } - - if (saveOperation == NSSaveOperation || saveOperation == NSSaveAsOperation) { [self checkFileUpdatesIfNeeded]; isSaving = NO; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-28 11:43:15
|
Revision: 2740 http://skim-app.svn.sourceforge.net/skim-app/?rev=2740&view=rev Author: hofman Date: 2007-08-28 04:43:08 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Add a document type for a package containing the pdf and the notes. File extension is pdfd. Saved and read as a fileWrapper. Modified Paths: -------------- trunk/Dutch.lproj/InfoPlist.strings trunk/English.lproj/InfoPlist.strings trunk/French.lproj/InfoPlist.strings trunk/Info.plist trunk/Italian.lproj/InfoPlist.strings trunk/SKDocument.h trunk/SKDocument.m trunk/SKDocumentController.h trunk/SKDocumentController.m trunk/Skim.xcodeproj/project.pbxproj Added Paths: ----------- trunk/Images/PDFDDocument.icns Modified: trunk/Dutch.lproj/InfoPlist.strings =================================================================== (Binary files differ) Modified: trunk/English.lproj/InfoPlist.strings =================================================================== (Binary files differ) Modified: trunk/French.lproj/InfoPlist.strings =================================================================== (Binary files differ) Added: trunk/Images/PDFDDocument.icns =================================================================== (Binary files differ) Property changes on: trunk/Images/PDFDDocument.icns ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/Info.plist =================================================================== --- trunk/Info.plist 2007-08-28 09:24:37 UTC (rev 2739) +++ trunk/Info.plist 2007-08-28 11:43:08 UTC (rev 2740) @@ -37,6 +37,7 @@ <key>NSExportableAs</key> <array> <string>NSPDFPboardType</string> + <string>PDF Package</string> <string>PDF With Embedded Notes</string> <string>PDF Without Notes</string> <string>Skim Notes</string> @@ -47,6 +48,43 @@ <dict> <key>CFBundleTypeExtensions</key> <array> + <string>pdfd</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>PDFDDocument</string> + <key>CFBundleTypeName</key> + <string>PDF Bundle</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>PDFD</string> + </array> + <key>CFBundleTypeRole</key> + <string>Editor</string> + <key>LSIsAppleDefaultForType</key> + <true/> + <key>LSItemContentTypes</key> + <array> + <string>net.sourceforge.skim-app.pdfd</string> + </array> + <key>LSTypeIsPackage</key> + <true/> + <key>NSDocumentClass</key> + <string>SKDocument</string> + <key>NSExportableAs</key> + <array> + <string>NSPDFPboardType</string> + <string>PDF With Embedded Notes</string> + <string>PDF Without Notes</string> + <string>Skim Notes</string> + <string>Notes as RTF</string> + <string>Notes as Text</string> + </array> + <key>NSPersistentStoreTypeKey</key> + <string>Binary</string> + </dict> + <dict> + <key>CFBundleTypeExtensions</key> + <array> <string>skim</string> </array> <key>CFBundleTypeIconFile</key> @@ -55,6 +93,8 @@ <string>Skim Notes</string> <key>CFBundleTypeRole</key> <string>Editor</string> + <key>LSIsAppleDefaultForType</key> + <true/> <key>LSItemContentTypes</key> <array> <string>net.sourceforge.skim-app.skimnotes</string> @@ -325,6 +365,43 @@ <string>MainMenu</string> <key>NSPrincipalClass</key> <string>SKApplication</string> + <key>NSServices</key> + <array> + <dict> + <key>NSMenuItem</key> + <dict> + <key>default</key> + <string>Skim/Open PDF at URL</string> + </dict> + <key>NSMessage</key> + <string>openDocumentFromURLOnPboard</string> + <key>NSPortName</key> + <string>Skim</string> + <key>NSSendTypes</key> + <array> + <string>NSURLPboardType</string> + <string>NSStringPboardType</string> + <string>CorePasteboardFlavorType 0x75726C20</string> + </array> + </dict> + <dict> + <key>NSMenuItem</key> + <dict> + <key>default</key> + <string>Skim/Open Selected PDF</string> + </dict> + <key>NSMessage</key> + <string>openDocumentFromDataOnPboard</string> + <key>NSPortName</key> + <string>Skim</string> + <key>NSSendTypes</key> + <array> + <string>NSPDFPboardType</string> + <string>NSPostScriptPboardType</string> + <string>NSTIFFPboardType</string> + </array> + </dict> + </array> <key>OSAScriptingDefinition</key> <string>Skim.sdef</string> <key>SUFeedURL</key> @@ -334,6 +411,26 @@ <dict> <key>UTTypeConformsTo</key> <array> + <string>com.apple.package</string> + <string>public.composite-content </string> + </array> + <key>UTTypeDescription</key> + <string>PDF Bundle</string> + <key>UTTypeIconFile</key> + <string>PDFDDocument</string> + <key>UTTypeIdentifier</key> + <string>net.sourceforge.skim-app.pdfd</string> + <key>UTTypeTagSpecification</key> + <dict> + <key>public.filename-extension</key> + <array> + <string>pdfd</string> + </array> + </dict> + </dict> + <dict> + <key>UTTypeConformsTo</key> + <array> <string>public.data</string> </array> <key>UTTypeDescription</key> @@ -351,43 +448,5 @@ </dict> </dict> </array> - <key>NSServices</key> - <array> - <dict> - <key>NSMenuItem</key> - <dict> - <key>default</key> - <string>Skim/Open PDF at URL</string> - </dict> - <key>NSMessage</key> - <string>openDocumentFromURLOnPboard</string> - <key>NSPortName</key> - <string>Skim</string> - <key>NSSendTypes</key> - <array> - <string>NSURLPboardType</string> - <string>NSStringPboardType</string> - <string>CorePasteboardFlavorType 0x75726C20</string> - </array> - </dict> - <dict> - <key>NSMenuItem</key> - <dict> - <key>default</key> - <string>Skim/Open Selected PDF</string> - </dict> - <key>NSMessage</key> - <string>openDocumentFromDataOnPboard</string> - <key>NSPortName</key> - <string>Skim</string> - <key>NSSendTypes</key> - <array> - <string>NSPDFPboardType</string> - <string>NSPostScriptPboardType</string> - <string>NSTIFFPboardType</string> - </array> - </dict> - </array> - </dict> </plist> Modified: trunk/Italian.lproj/InfoPlist.strings =================================================================== (Binary files differ) Modified: trunk/SKDocument.h =================================================================== --- trunk/SKDocument.h 2007-08-28 09:24:37 UTC (rev 2739) +++ trunk/SKDocument.h 2007-08-28 11:43:08 UTC (rev 2740) @@ -81,6 +81,7 @@ BOOL autoUpdate; BOOL isSaving; BOOL fileChangedOnDisk; + NSSaveOperationType currentSaveOperation; // only used for network filesystems; fileUpdateTimer is not retained by the doc NSDate *lastModifiedDate; Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-28 09:24:37 UTC (rev 2739) +++ trunk/SKDocument.m 2007-08-28 11:43:08 UTC (rev 2740) @@ -62,8 +62,13 @@ #import "Files_SKExtensions.h" // maximum length of xattr value recommended by Apple -#define MAX_XATTR_LENGTH 2048 +#define MAX_XATTR_LENGTH 2048 +#define WRAPPER_PDF_FILENAME @"data.pdf" +#define WRAPPER_SKIM_FILENAME @"data.skim" +#define WRAPPER_TXT_FILENAME @"data.txt" +#define WRAPPER_RTF_FILENAME @"data.rtf" + NSString *SKDocumentErrorDomain = @"SKDocumentErrorDomain"; NSString *SKDocumentWillSaveNotification = @"SKDocumentWillSaveNotification"; @@ -169,23 +174,31 @@ } - (BOOL)prepareSavePanel:(NSSavePanel *)savePanel { - NSPopUpButton *formatPopup = popUpButtonSubview([savePanel accessoryView]); - NSString *lastExportedType = [[NSUserDefaults standardUserDefaults] stringForKey:@"SKLastExportedType"]; - if ([[self pdfDocument] allowsPrinting] == NO) { - int index = [formatPopup indexOfItemWithRepresentedObject:SKEmbeddedPDFDocumentType]; - if (index != -1) - [formatPopup removeItemAtIndex:index]; - } - if (formatPopup && lastExportedType) { - int index = [formatPopup indexOfItemWithRepresentedObject:lastExportedType]; - if (index != -1 && index != [formatPopup indexOfSelectedItem]) { - [formatPopup selectItemAtIndex:index]; - [formatPopup sendAction:[formatPopup action] to:[formatPopup target]]; + if (currentSaveOperation == NSSaveToOperation) { + NSPopUpButton *formatPopup = popUpButtonSubview([savePanel accessoryView]); + NSString *lastExportedType = [[NSUserDefaults standardUserDefaults] stringForKey:@"SKLastExportedType"]; + if ([[self pdfDocument] allowsPrinting] == NO) { + int index = [formatPopup indexOfItemWithRepresentedObject:SKEmbeddedPDFDocumentType]; + if (index != -1) + [formatPopup removeItemAtIndex:index]; } + if (formatPopup && lastExportedType) { + int index = [formatPopup indexOfItemWithRepresentedObject:lastExportedType]; + if (index != -1 && index != [formatPopup indexOfSelectedItem]) { + [formatPopup selectItemAtIndex:index]; + [formatPopup sendAction:[formatPopup action] to:[formatPopup target]]; + } + } } return YES; } +- (void)runModalSavePanelForSaveOperation:(NSSaveOperationType)saveOperation delegate:(id)delegate didSaveSelector:(SEL)didSaveSelector contextInfo:(void *)contextInfo { + // Override so we can determine if this is a save, saveAs or export operation, so we can prepare the correct accessory view + currentSaveOperation = saveOperation; + [super runModalSavePanelForSaveOperation:saveOperation delegate:delegate didSaveSelector:didSaveSelector contextInfo:contextInfo]; +} + - (BOOL)saveToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName forSaveOperation:(NSSaveOperationType)saveOperation error:(NSError **)outError{ if (saveOperation == NSSaveOperation || saveOperation == NSSaveAsOperation) { [self stopCheckingFileUpdates]; @@ -254,6 +267,20 @@ // notes are only saved as a dry-run to test if we can write, they are not copied to the final destination. didWrite = [pdfData writeToURL:absoluteURL options:NSAtomicWrite error:outError] && [self saveNotesToExtendedAttributesAtURL:absoluteURL error:outError]; + } else if ([typeName isEqualToString:SKPDFBundleDocumentType]) { + NSData *notesData = [[self notes] count] ? [NSKeyedArchiver archivedDataWithRootObject:[[self notes] valueForKey:@"dictionaryValue"]] : nil; + NSData *notesTextData = [[self notesString] dataUsingEncoding:NSUTF8StringEncoding]; + NSData *notesRTFData = [self notesRTFData]; + NSFileWrapper *fileWrapper = [[NSFileWrapper alloc] initDirectoryWithFileWrappers:[NSDictionary dictionary]]; + [fileWrapper addRegularFileWithContents:pdfData preferredFilename:WRAPPER_PDF_FILENAME]; + if (notesData) + [fileWrapper addRegularFileWithContents:notesData preferredFilename:WRAPPER_SKIM_FILENAME]; + if (notesTextData) + [fileWrapper addRegularFileWithContents:notesTextData preferredFilename:WRAPPER_TXT_FILENAME]; + if (notesRTFData) + [fileWrapper addRegularFileWithContents:notesRTFData preferredFilename:WRAPPER_RTF_FILENAME]; + didWrite = [fileWrapper writeToFile:[absoluteURL path] atomically:YES updateFilenames:NO]; + [fileWrapper release]; } else if ([typeName isEqualToString:SKEmbeddedPDFDocumentType]) { [[self mainWindowController] removeTemporaryAnnotations]; didWrite = [[[self mainWindowController] pdfDocument] writeToURL:absoluteURL]; @@ -305,7 +332,7 @@ NSMutableDictionary *dict = [[[super fileAttributesToWriteToURL:absoluteURL ofType:typeName forSaveOperation:saveOperation originalContentsURL:absoluteOriginalContentsURL error:outError] mutableCopy] autorelease]; // only set the creator code for our native types - if ([typeName isEqualToString:SKPDFDocumentType] || [typeName isEqualToString:SKEmbeddedPDFDocumentType] || [typeName isEqualToString:SKBarePDFDocumentType] || [typeName isEqualToString:SKNotesDocumentType]) + if ([typeName isEqualToString:SKPDFDocumentType] || [typeName isEqualToString:SKPDFBundleDocumentType] || [typeName isEqualToString:SKEmbeddedPDFDocumentType] || [typeName isEqualToString:SKBarePDFDocumentType] || [typeName isEqualToString:SKNotesDocumentType]) [dict setObject:[NSNumber numberWithUnsignedLong:'SKIM'] forKey:NSFileHFSCreatorCode]; if ([[[absoluteURL path] pathExtension] isEqualToString:@"pdf"] || ([typeName isEqualToString:SKPDFDocumentType] || [typeName isEqualToString:SKEmbeddedPDFDocumentType] || [typeName isEqualToString:SKBarePDFDocumentType])) @@ -411,6 +438,29 @@ } } } + } else if ([docType isEqualToString:SKPDFBundleDocumentType]) { + NSFileWrapper *fileWrapper = [[NSFileWrapper alloc] initWithPath:[absoluteURL path]]; + NSDictionary *fileWrappers = [fileWrapper fileWrappers]; + NSData *notesData = nil; + NSEnumerator *nameEnum = [fileWrappers keyEnumerator]; + NSString *name; + + while (name = [nameEnum nextObject]) { + NSFileWrapper *fw = [fileWrappers objectForKey:name]; + if ([fw isRegularFile] == NO) + continue; + NSString *extension = [[fw filename] pathExtension]; + if ([name caseInsensitiveCompare:WRAPPER_PDF_FILENAME] == NSOrderedSame || (data == nil && [extension caseInsensitiveCompare:@"pdf"] == NSOrderedSame)) { + if (data = [[fw regularFileContents] retain]) + pdfDoc = [[PDFDocument alloc] initWithData:data]; + } else if ([name caseInsensitiveCompare:WRAPPER_SKIM_FILENAME] == NSOrderedSame || (notesData == nil && [extension caseInsensitiveCompare:@"skim"] == NSOrderedSame)) { + notesData = [fw regularFileContents]; + NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithData:notesData]; + if (array) + [self setNoteDicts:array]; + } + } + [fileWrapper release]; } else if ([docType isEqualToString:SKPostScriptDocumentType]) { if (data = [NSData dataWithContentsOfURL:absoluteURL options:0 error:&error]) { SKPSProgressController *progressController = [[SKPSProgressController alloc] init]; Modified: trunk/SKDocumentController.h =================================================================== --- trunk/SKDocumentController.h 2007-08-28 09:24:37 UTC (rev 2739) +++ trunk/SKDocumentController.h 2007-08-28 11:43:08 UTC (rev 2740) @@ -39,6 +39,7 @@ #import <Cocoa/Cocoa.h> extern NSString *SKPDFDocumentType; +extern NSString *SKPDFBundleDocumentType; extern NSString *SKEmbeddedPDFDocumentType; extern NSString *SKBarePDFDocumentType; extern NSString *SKNotesDocumentType; Modified: trunk/SKDocumentController.m =================================================================== --- trunk/SKDocumentController.m 2007-08-28 09:24:37 UTC (rev 2739) +++ trunk/SKDocumentController.m 2007-08-28 11:43:08 UTC (rev 2740) @@ -45,6 +45,7 @@ // See CFBundleTypeName in Info.plist NSString *SKPDFDocumentType = nil; /* set to NSPDFPboardType, not @"NSPDFPboardType" */ +NSString *SKPDFBundleDocumentType = @"PDF Bundle"; NSString *SKEmbeddedPDFDocumentType = @"PDF With Embedded Notes"; NSString *SKBarePDFDocumentType = @"PDF Without Notes"; NSString *SKNotesDocumentType = @"Skim Notes"; Modified: trunk/Skim.xcodeproj/project.pbxproj =================================================================== --- trunk/Skim.xcodeproj/project.pbxproj 2007-08-28 09:24:37 UTC (rev 2739) +++ trunk/Skim.xcodeproj/project.pbxproj 2007-08-28 11:43:08 UTC (rev 2740) @@ -140,6 +140,7 @@ CE7469180B7F40B700CBF969 /* Skim.icns in Resources */ = {isa = PBXBuildFile; fileRef = CE7469170B7F40B600CBF969 /* Skim.icns */; }; CE7C20500C259A5D0059E08C /* NSColor_SKExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = CE7C204E0C259A5D0059E08C /* NSColor_SKExtensions.m */; }; CE7C5D190BD8086C0011315D /* ToolbarLineNote.tiff in Resources */ = {isa = PBXBuildFile; fileRef = CE7C5D180BD8086C0011315D /* ToolbarLineNote.tiff */; }; + CE898F060C843A8B008A0856 /* PDFDDocument.icns in Resources */ = {isa = PBXBuildFile; fileRef = CE898F050C843A8B008A0856 /* PDFDDocument.icns */; }; CE8B46E90C29CA00005CE7F1 /* SKLineInspector.m in Sources */ = {isa = PBXBuildFile; fileRef = CE8B46E70C29CA00005CE7F1 /* SKLineInspector.m */; }; CE8B46F00C29CA3D005CE7F1 /* LineInspector.nib in Resources */ = {isa = PBXBuildFile; fileRef = CE8B46EA0C29CA3D005CE7F1 /* LineInspector.nib */; }; CE9A87930C0C9E9A004F1F97 /* ProgressSheet.nib in Resources */ = {isa = PBXBuildFile; fileRef = CE9A878D0C0C9E9A004F1F97 /* ProgressSheet.nib */; }; @@ -507,6 +508,7 @@ CE7C204E0C259A5D0059E08C /* NSColor_SKExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSColor_SKExtensions.m; sourceTree = "<group>"; }; CE7C5D180BD8086C0011315D /* ToolbarLineNote.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = ToolbarLineNote.tiff; path = Images/ToolbarLineNote.tiff; sourceTree = "<group>"; }; CE87EF690BA9FF5A0027BBDD /* skimhelp.css */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 30; name = skimhelp.css; path = "English.lproj/Skim Help/sty/skimhelp.css"; sourceTree = "<group>"; }; + CE898F050C843A8B008A0856 /* PDFDDocument.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = PDFDDocument.icns; path = Images/PDFDDocument.icns; sourceTree = "<group>"; }; CE8B46E60C29CA00005CE7F1 /* SKLineInspector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SKLineInspector.h; sourceTree = "<group>"; }; CE8B46E70C29CA00005CE7F1 /* SKLineInspector.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = SKLineInspector.m; sourceTree = "<group>"; }; CE8B46EB0C29CA3D005CE7F1 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/LineInspector.nib; sourceTree = "<group>"; }; @@ -1013,6 +1015,7 @@ children = ( CE7469170B7F40B600CBF969 /* Skim.icns */, CE07158A0B8A3D6300733CC8 /* PDFDocument.icns */, + CE898F050C843A8B008A0856 /* PDFDDocument.icns */, CE4373B30BB5440E00A56987 /* PSDocument.icns */, CE4D88D70C3AE52F002C20CB /* DVIDocument.icns */, CEAA56D20C6DEE83006BD633 /* Cancel.tiff */, @@ -1272,6 +1275,7 @@ CEAA56D50C6DEE83006BD633 /* Delete.tiff in Resources */, CEAA68EB0C71242F006BD633 /* Resume.tiff in Resources */, CEF84C630C78A89A00A3AD51 /* SmallPreferences.tiff in Resources */, + CE898F060C843A8B008A0856 /* PDFDDocument.icns in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-28 09:25:25
|
Revision: 2739 http://skim-app.svn.sourceforge.net/skim-app/?rev=2739&view=rev Author: hofman Date: 2007-08-28 02:24:37 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Fix skimnotes command line tool: unarchive text, which is saved as an archived plist rather than string data. Modified Paths: -------------- trunk/skimnotes.m Modified: trunk/skimnotes.m =================================================================== --- trunk/skimnotes.m 2007-08-27 20:21:25 UTC (rev 2738) +++ trunk/skimnotes.m 2007-08-28 09:24:37 UTC (rev 2739) @@ -65,8 +65,9 @@ data = [NSData data]; } else if ([[notesPath pathExtension] caseInsensitiveCompare:@"txt"] == NSOrderedSame || [[notesPath pathExtension] caseInsensitiveCompare:@"text"] == NSOrderedSame) { NSError *error = nil; - data = [fm extendedAttributeNamed:SKIM_TEXT_NOTES_KEY atPath:pdfPath traverseLink:YES error:&error]; - if (data == nil && [error code] == ENOATTR) + NSString *string = [fm propertyListFromExtendedAttributeNamed:SKIM_TEXT_NOTES_KEY atPath:pdfPath traverseLink:YES error:&error]; + data = [string dataUsingEncoding:NSUTF8StringEncoding]; + if (string == nil && [error code] == ENOATTR) data = [NSData data]; } else { NSError *error = nil; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-27 20:21:31
|
Revision: 2738 http://skim-app.svn.sourceforge.net/skim-app/?rev=2738&view=rev Author: hofman Date: 2007-08-27 13:21:25 -0700 (Mon, 27 Aug 2007) Log Message: ----------- Use float math functions for float arguments. Modified Paths: -------------- trunk/NSBezierPath_BDSKExtensions.m trunk/SKMainWindowController.m trunk/SKPDFView.m Modified: trunk/NSBezierPath_BDSKExtensions.m =================================================================== --- trunk/NSBezierPath_BDSKExtensions.m 2007-08-27 20:17:28 UTC (rev 2737) +++ trunk/NSBezierPath_BDSKExtensions.m 2007-08-27 20:21:25 UTC (rev 2738) @@ -60,7 +60,7 @@ + (NSBezierPath*)bezierPathWithRoundRectInRect:(NSRect)rect radius:(float)radius { // Make sure radius doesn't exceed a maximum size to avoid artifacts: - radius = MIN(radius, 0.5f * MIN(NSHeight(rect), NSWidth(rect))); + radius = fminf(radius, 0.5f * fminf(NSHeight(rect), NSWidth(rect))); // Make sure silly values simply lead to un-rounded corners: if( radius <= 0 ) Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-08-27 20:17:28 UTC (rev 2737) +++ trunk/SKMainWindowController.m 2007-08-27 20:21:25 UTC (rev 2738) @@ -3480,23 +3480,23 @@ if ([tv isEqual:thumbnailTableView]) { NSSize thumbSize = [[[thumbnails objectAtIndex:row] image] size]; NSSize cellSize = NSMakeSize([[[tv tableColumns] objectAtIndex:0] width], - MIN(thumbSize.height, roundedThumbnailSize)); + fminf(thumbSize.height, roundedThumbnailSize)); if (thumbSize.height < 1.0) return 1.0; else if (thumbSize.width / thumbSize.height < cellSize.width / cellSize.height) return cellSize.height; else - return MAX(1.0, MIN(cellSize.width, thumbSize.width) * thumbSize.height / thumbSize.width); + return fmaxf(1.0, fminf(cellSize.width, thumbSize.width) * thumbSize.height / thumbSize.width); } else if ([tv isEqual:snapshotTableView]) { NSSize thumbSize = [[[[snapshotArrayController arrangedObjects] objectAtIndex:row] thumbnail] size]; NSSize cellSize = NSMakeSize([[[tv tableColumns] objectAtIndex:0] width], - MIN(thumbSize.height, roundedSnapshotThumbnailSize)); + fminf(thumbSize.height, roundedSnapshotThumbnailSize)); if (thumbSize.height < 1.0) return 1.0; else if (thumbSize.width / thumbSize.height < cellSize.width / cellSize.height) return cellSize.height; else - return MAX(32.0, MIN(cellSize.width, thumbSize.width) * thumbSize.height / thumbSize.width); + return fmaxf(32.0, fminf(cellSize.width, thumbSize.width) * thumbSize.height / thumbSize.width); } return 17.0; } Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2007-08-27 20:17:28 UTC (rev 2737) +++ trunk/SKPDFView.m 2007-08-27 20:21:25 UTC (rev 2738) @@ -1346,7 +1346,7 @@ - (void)magnifyWheel:(NSEvent *)theEvent { float dy = [theEvent deltaY]; - dy = dy > 0 ? MIN(0.2, dy) : MAX(-0.2, dy); + dy = dy > 0 ? fminf(0.2, dy) : fmaxf(-0.2, dy); [self setScaleFactor:[self scaleFactor] + 0.5 * dy]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-27 20:17:30
|
Revision: 2737 http://skim-app.svn.sourceforge.net/skim-app/?rev=2737&view=rev Author: hofman Date: 2007-08-27 13:17:28 -0700 (Mon, 27 Aug 2007) Log Message: ----------- Use float math functions for float arguments. Modified Paths: -------------- trunk/NSGeometry_SKExtensions.h trunk/NSGeometry_SKExtensions.m trunk/SKColorSwatch.m trunk/SKLineInspector.m trunk/SKLineWell.m trunk/SKMainWindowController.m trunk/SKNoteOutlineView.m trunk/SKPDFAnnotationNote.m trunk/SKPDFHoverWindow.m trunk/SKPDFSynchronizer.m trunk/SKPDFView.m trunk/SKSplitView.m trunk/SKStatusBar.m trunk/SKThumbnailTableView.m Modified: trunk/NSGeometry_SKExtensions.h =================================================================== --- trunk/NSGeometry_SKExtensions.h 2007-08-27 19:57:17 UTC (rev 2736) +++ trunk/NSGeometry_SKExtensions.h 2007-08-27 20:17:28 UTC (rev 2737) @@ -77,26 +77,26 @@ static inline NSRect SKRectFromPoints(NSPoint aPoint, NSPoint bPoint) { NSRect rect; - rect.origin.x = fmin(aPoint.x, bPoint.x); - rect.origin.y = fmin(aPoint.y, bPoint.y); - rect.size.width = fmax(aPoint.x, bPoint.x) - NSMinX(rect); - rect.size.height = fmax(aPoint.y, bPoint.y) - NSMinY(rect); + rect.origin.x = fminf(aPoint.x, bPoint.x); + rect.origin.y = fminf(aPoint.y, bPoint.y); + rect.size.width = fmaxf(aPoint.x, bPoint.x) - NSMinX(rect); + rect.size.height = fmaxf(aPoint.y, bPoint.y) - NSMinY(rect); return rect; } static inline NSRect SKIntegralRectFromPoints(NSPoint aPoint, NSPoint bPoint) { NSRect rect; - rect.origin.x = floorf(fmin(aPoint.x, bPoint.x)); - rect.origin.y = floorf(fmin(aPoint.y, bPoint.y)); - rect.size.width = ceilf(fmax(aPoint.x, bPoint.x) - NSMinX(rect)); - rect.size.height = ceilf(fmax(aPoint.y, bPoint.y) - NSMinY(rect)); + rect.origin.x = floorf(fminf(aPoint.x, bPoint.x)); + rect.origin.y = floorf(fminf(aPoint.y, bPoint.y)); + rect.size.width = ceilf(fmaxf(aPoint.x, bPoint.x) - NSMinX(rect)); + rect.size.height = ceilf(fmaxf(aPoint.y, bPoint.y) - NSMinY(rect)); return rect; } static inline NSRect SKRectFromCenterAndPoint(NSPoint center, NSPoint point) { NSRect rect; - rect.size.width = 2.0 * fabs(center.x - point.x); - rect.size.height = 2.0 * fabs(center.y - point.y); + rect.size.width = 2.0 * fabsf(center.x - point.x); + rect.size.height = 2.0 * fabsf(center.y - point.y); rect.origin.x = center.x - 0.5 * NSWidth(rect); rect.origin.y = center.y - 0.5 * NSHeight(rect); return rect; Modified: trunk/NSGeometry_SKExtensions.m =================================================================== --- trunk/NSGeometry_SKExtensions.m 2007-08-27 19:57:17 UTC (rev 2736) +++ trunk/NSGeometry_SKExtensions.m 2007-08-27 20:17:28 UTC (rev 2737) @@ -72,9 +72,9 @@ } NSRect SKIntersectionRect(NSRect rect, NSRect boundary) { - float minX = fmin(fmax(NSMinX(rect), NSMinX(boundary)), NSMaxX(boundary)); - float maxX = fmax(fmin(NSMaxX(rect), NSMaxX(boundary)), NSMinX(boundary)); - float minY = fmin(fmax(NSMinY(rect), NSMinY(boundary)), NSMaxY(boundary)); - float maxY = fmax(fmin(NSMaxY(rect), NSMaxY(boundary)), NSMinY(boundary)); + float minX = fminf(fmaxf(NSMinX(rect), NSMinX(boundary)), NSMaxX(boundary)); + float maxX = fmaxf(fminf(NSMaxX(rect), NSMaxX(boundary)), NSMinX(boundary)); + float minY = fminf(fmaxf(NSMinY(rect), NSMinY(boundary)), NSMaxY(boundary)); + float maxY = fmaxf(fminf(NSMaxY(rect), NSMaxY(boundary)), NSMinY(boundary)); return NSMakeRect(minX, minY, maxX - minX, maxY - minY); } Modified: trunk/SKColorSwatch.m =================================================================== --- trunk/SKColorSwatch.m 2007-08-27 19:57:17 UTC (rev 2736) +++ trunk/SKColorSwatch.m 2007-08-27 20:17:28 UTC (rev 2737) @@ -117,7 +117,7 @@ - (void)sizeToFit { NSRect frame = [self frame]; int count = [colors count]; - frame.size.width = fmin(NSWidth(frame), count * (NSHeight(frame) - 3.0) + 3.0); + frame.size.width = fminf(NSWidth(frame), count * (NSHeight(frame) - 3.0) + 3.0); [self setFrame:frame]; } @@ -125,7 +125,7 @@ NSRect bounds = [self bounds]; int count = [colors count]; - bounds.size.width = fmin(NSWidth(bounds), count * (NSHeight(bounds) - 3.0) + 3.0); + bounds.size.width = fminf(NSWidth(bounds), count * (NSHeight(bounds) - 3.0) + 3.0); NSRectEdge sides[4] = {NSMaxYEdge, NSMaxXEdge, NSMinXEdge, NSMinYEdge}; float grays[4] = {0.5, 0.75, 0.75, 0.75}; Modified: trunk/SKLineInspector.m =================================================================== --- trunk/SKLineInspector.m 2007-08-27 19:57:17 UTC (rev 2736) +++ trunk/SKLineInspector.m 2007-08-27 20:17:28 UTC (rev 2737) @@ -420,7 +420,7 @@ } - (void)setLineWidth:(float)width { - if (fabs(lineWidth - width) > 0.00001) { + if (fabsf(lineWidth - width) > 0.00001) { lineWidth = width; [self sendActionToTarget:@selector(changeLineWidth:)]; [[NSNotificationCenter defaultCenter] postNotificationName:SKLineInspectorLineWidthDidChangeNotification object:self]; Modified: trunk/SKLineWell.m =================================================================== --- trunk/SKLineWell.m 2007-08-27 19:57:17 UTC (rev 2736) +++ trunk/SKLineWell.m 2007-08-27 20:17:28 UTC (rev 2737) @@ -558,7 +558,7 @@ } - (void)setLineWidth:(float)width { - if (fabs(lineWidth - width) > 0.00001) { + if (fabsf(lineWidth - width) > 0.00001) { lineWidth = width; [self updateValue:[NSNumber numberWithFloat:lineWidth] forKey:@"lineWidth"]; } Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-08-27 19:57:17 UTC (rev 2736) +++ trunk/SKMainWindowController.m 2007-08-27 20:17:28 UTC (rev 2737) @@ -809,7 +809,7 @@ NSString *label = [[document pageAtIndex:i] label]; [pageLabels addObject:label ? label : @""]; [cell setStringValue:label]; - labelWidth = fmax(labelWidth, [cell cellSize].width); + labelWidth = fmaxf(labelWidth, [cell cellSize].width); } [self didChangeValueForKey:@"pageLabels"]; @@ -1029,7 +1029,7 @@ [thumbnail setImage:image]; newSize = [image size]; - if (fabs(newSize.width - oldSize.width) > 1.0 || fabs(newSize.height - oldSize.height) > 1.0) { + if (fabsf(newSize.width - oldSize.width) > 1.0 || fabsf(newSize.height - oldSize.height) > 1.0) { [thumbnailTableView performSelector:@selector(noteHeightOfRowsWithIndexesChanged:) withObject:[NSIndexSet indexSetWithIndex:theIndex] afterDelay:0.0]; } } @@ -1510,8 +1510,8 @@ } } } - float w = fmax(NSWidth(rect[0]), NSWidth(rect[1])); - float h = fmax(NSHeight(rect[0]), NSHeight(rect[1])); + float w = fmaxf(NSWidth(rect[0]), NSWidth(rect[1])); + float h = fmaxf(NSHeight(rect[0]), NSHeight(rect[1])); for (j = 0; j < 2; j++) rect[j] = NSMakeRect(floorf(NSMidX(rect[j]) - 0.5 * w), floorf(NSMidY(rect[j]) - 0.5 * h), w, h); rectArray = [NSArray arrayWithObjects:[NSValue valueWithRect:rect[0]], [NSValue valueWithRect:rect[1]], nil]; @@ -1584,8 +1584,8 @@ for (i = 0; i < iMax; i++) { NSRect bbox = [[pdfDoc pageAtIndex:i] foregroundBox]; - size.width = fmax(size.width, NSWidth(bbox)); - size.height = fmax(size.height, NSHeight(bbox)); + size.width = fmaxf(size.width, NSWidth(bbox)); + size.height = fmaxf(size.height, NSHeight(bbox)); [progressBar incrementBy:1.0]; [progressBar displayIfNeeded]; if (i && i % 10 == 0) @@ -1765,7 +1765,7 @@ - (void)transitionSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { if (returnCode == NSOKButton) { [pdfView setTransitionStyle:[[transitionStylePopUpButton selectedItem] tag]]; - [pdfView setTransitionDuration:fmax([transitionDurationField floatValue], 0.0)]; + [pdfView setTransitionDuration:fmaxf([transitionDurationField floatValue], 0.0)]; [pdfView setTransitionShouldRestrict:(BOOL)[[transitionExtentMatrix selectedCell] tag]]; } } @@ -3757,7 +3757,7 @@ [image lockFocus]; NSRect imgRect = NSZeroRect; imgRect.size = [image size]; - float width = 0.8 * fmin(NSWidth(imgRect), NSHeight(imgRect)); + float width = 0.8 * fminf(NSWidth(imgRect), NSHeight(imgRect)); imgRect = NSInsetRect(imgRect, 0.5 * (NSWidth(imgRect) - width), 0.5 * (NSHeight(imgRect) - width)); [[NSImage imageNamed:@"NSApplicationIcon"] drawInRect:imgRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:0.5]; [image unlockFocus]; @@ -3779,7 +3779,7 @@ float defaultSize = roundedThumbnailSize; float thumbnailSize = (defaultSize < 32.1) ? 32.0 : (defaultSize < 64.1) ? 64.0 : (defaultSize < 128.1) ? 128.0 : 256.0; - if (fabs(thumbnailSize - thumbnailCacheSize) > 0.1) { + if (fabsf(thumbnailSize - thumbnailCacheSize) > 0.1) { thumbnailCacheSize = thumbnailSize; if ([self countOfThumbnails]) @@ -3882,7 +3882,7 @@ float defaultSize = roundedSnapshotThumbnailSize; float snapshotSize = (defaultSize < 32.1) ? 32.0 : (defaultSize < 64.1) ? 64.0 : (defaultSize < 128.1) ? 128.0 : 256.0; - if (fabs(snapshotSize - snapshotCacheSize) > 0.1) { + if (fabsf(snapshotSize - snapshotCacheSize) > 0.1) { snapshotCacheSize = snapshotSize; if (snapshotTimer) { @@ -3923,7 +3923,7 @@ [dirtySnapshots removeObject:controller]; newSize = [image size]; - if (fabs(newSize.width - oldSize.width) > 1.0 || fabs(newSize.height - oldSize.height) > 1.0) { + if (fabsf(newSize.width - oldSize.width) > 1.0 || fabsf(newSize.height - oldSize.height) > 1.0) { unsigned index = [[snapshotArrayController arrangedObjects] indexOfObject:controller]; [snapshotTableView noteHeightOfRowsWithIndexesChanged:[NSIndexSet indexSetWithIndex:index]]; } @@ -4535,7 +4535,7 @@ } else if ([identifier isEqualToString:SKDocumentToolbarZoomToFitItemIdentifier]) { return [pdfView autoScales] == NO; } else if ([identifier isEqualToString:SKDocumentToolbarZoomActualItemIdentifier]) { - return fabs([pdfView scaleFactor] - 1.0) > 0.01; + return fabsf([pdfView scaleFactor] - 1.0) > 0.01; } else if ([identifier isEqualToString:SKDocumentToolbarCropItemIdentifier]) { return YES; } else if ([identifier isEqualToString:SKDocumentToolbarFullScreenItemIdentifier]) { @@ -4618,7 +4618,7 @@ } else if (action == @selector(doZoomOut:)) { return [self isPresentation] == NO && [pdfView canZoomOut]; } else if (action == @selector(doZoomToActualSize:)) { - return fabs([pdfView scaleFactor] - 1.0 ) > 0.01; + return fabsf([pdfView scaleFactor] - 1.0 ) > 0.01; } else if (action == @selector(doZoomToPhysicalSize:)) { return [self isPresentation] == NO; } else if (action == @selector(doZoomToSelection:)) { Modified: trunk/SKNoteOutlineView.m =================================================================== --- trunk/SKNoteOutlineView.m 2007-08-27 19:57:17 UTC (rev 2736) +++ trunk/SKNoteOutlineView.m 2007-08-27 20:17:28 UTC (rev 2737) @@ -68,7 +68,7 @@ case NSLeftMouseDragged: { NSPoint currentPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil]; - float currentHeight = fmax([self rowHeight], startHeight + currentPoint.y - startPoint.y); + float currentHeight = fmaxf([self rowHeight], startHeight + currentPoint.y - startPoint.y); [[self delegate] outlineView:self setHeightOfRow:currentHeight byItem:item]; [self noteHeightOfRowsWithIndexesChanged:[NSIndexSet indexSetWithIndex:row]]; Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2007-08-27 19:57:17 UTC (rev 2736) +++ trunk/SKPDFAnnotationNote.m 2007-08-27 20:17:28 UTC (rev 2737) @@ -815,10 +815,10 @@ } static BOOL adjacentCharacterBounds(NSRect rect1, NSRect rect2) { - float w = fmax(NSWidth(rect2), NSWidth(rect1)); - float h = fmax(NSHeight(rect2), NSHeight(rect1)); + float w = fmaxf(NSWidth(rect2), NSWidth(rect1)); + float h = fmaxf(NSHeight(rect2), NSHeight(rect1)); // first check the vertical position; allow sub/superscripts - if (fabs(NSMinY(rect1) - NSMinY(rect2)) > 0.2 * h && fabs(NSMaxY(rect1) - NSMaxY(rect2)) > 0.2 * h) + if (fabsf(NSMinY(rect1) - NSMinY(rect2)) > 0.2 * h && fabsf(NSMaxY(rect1) - NSMaxY(rect2)) > 0.2 * h) return NO; // compare horizontal position // rect1 before rect2 @@ -1430,8 +1430,8 @@ } else { point = SKSubstractPoints(point, bounds.origin); - return (fabs(point.x - startPoint.x) < 3.5 && fabs(point.y - startPoint.y) < 3.5) || - (fabs(point.x - endPoint.x) < 3.5 && fabs(point.y - endPoint.y) < 3.5); + return (fabsf(point.x - startPoint.x) < 3.5 && fabsf(point.y - startPoint.y) < 3.5) || + (fabsf(point.x - endPoint.x) < 3.5 && fabsf(point.y - endPoint.y) < 3.5); } } Modified: trunk/SKPDFHoverWindow.m =================================================================== --- trunk/SKPDFHoverWindow.m 2007-08-27 19:57:17 UTC (rev 2736) +++ trunk/SKPDFHoverWindow.m 2007-08-27 20:17:28 UTC (rev 2737) @@ -202,8 +202,8 @@ PDFSelection *selection = [page selectionForRect:bounds]; if ([selection string]) { NSRect selBounds = [selection boundsForPage:page]; - float top = ceilf(fmax(NSMaxY(selBounds), NSMinX(selBounds) + NSHeight(sourceRect))); - float left = floorf(fmin(NSMinX(selBounds), NSMaxX(bounds) - NSWidth(sourceRect))); + float top = ceilf(fmaxf(NSMaxY(selBounds), NSMinX(selBounds) + NSHeight(sourceRect))); + float left = floorf(fminf(NSMinX(selBounds), NSMaxX(bounds) - NSWidth(sourceRect))); if (top < NSMaxY(sourceRect)) sourceRect.origin.y = top - NSHeight(sourceRect); if (left > NSMinX(sourceRect)) @@ -270,7 +270,7 @@ NSRect textRect = [text boundingRectWithSize:NSInsetRect(contentRect, TEXT_MARGIN_X, TEXT_MARGIN_Y).size options:NSStringDrawingUsesLineFragmentOrigin]; - textRect.size.height = fmin(NSHeight(textRect), NSHeight(contentRect) - 2.0 * TEXT_MARGIN_Y); + textRect.size.height = fminf(NSHeight(textRect), NSHeight(contentRect) - 2.0 * TEXT_MARGIN_Y); textRect.origin = NSMakePoint(TEXT_MARGIN_X, TEXT_MARGIN_Y); image = [[NSImage alloc] initWithSize:NSInsetRect(NSIntegralRect(textRect), -TEXT_MARGIN_X, -TEXT_MARGIN_X).size]; Modified: trunk/SKPDFSynchronizer.m =================================================================== --- trunk/SKPDFSynchronizer.m 2007-08-27 19:57:17 UTC (rev 2736) +++ trunk/SKPDFSynchronizer.m 2007-08-27 20:17:28 UTC (rev 2737) @@ -456,7 +456,7 @@ afterRecord = record; break; } else { - [atRecords setObject:record forKey:[NSNumber numberWithFloat:fabs(x - point.x)]]; + [atRecords setObject:record forKey:[NSNumber numberWithFloat:fabsf(x - point.x)]]; } } Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2007-08-27 19:57:17 UTC (rev 2736) +++ trunk/SKPDFView.m 2007-08-27 20:17:28 UTC (rev 2737) @@ -2859,14 +2859,14 @@ if ([theEvent modifierFlags] & NSShiftKeyMask) { NSPoint *fixedPoint = draggingStartPoint ? &endPoint : &startPoint; NSPoint diffPoint = SKSubstractPoints(*draggedPoint, *fixedPoint); - float dx = fabs(diffPoint.x), dy = fabs(diffPoint.y); + float dx = fabsf(diffPoint.x), dy = fabsf(diffPoint.y); if (dx < 0.4 * dy) { diffPoint.x = 0.0; } else if (dy < 0.4 * dx) { diffPoint.y = 0.0; } else { - dx = fmin(dx, dy); + dx = fminf(dx, dy); diffPoint.x = diffPoint.x < 0.0 ? -dx : dx; diffPoint.y = diffPoint.y < 0.0 ? -dx : dx; } @@ -3650,7 +3650,7 @@ static CGMutablePathRef SKCGCreatePathWithRoundRectInRect(CGRect rect, float radius) { // Make sure radius doesn't exceed a maximum size to avoid artifacts: - radius = fmin(radius, 0.5f * fmin(rect.size.width, rect.size.height)); + radius = fminf(radius, 0.5f * fminf(rect.size.width, rect.size.height)); CGMutablePathRef path = CGPathCreateMutable(); Modified: trunk/SKSplitView.m =================================================================== --- trunk/SKSplitView.m 2007-08-27 19:57:17 UTC (rev 2736) +++ trunk/SKSplitView.m 2007-08-27 20:17:28 UTC (rev 2737) @@ -100,7 +100,7 @@ [NSBezierPath setDefaultLineWidth:1.0]; if ([self isVertical]) { - handleSize = fmin(handleSize, 2.0 * floorf(0.5 * NSHeight(aRect))); + handleSize = fminf(handleSize, 2.0 * floorf(0.5 * NSHeight(aRect))); startPoint = NSMakePoint(NSMinX(aRect) + 1.5, NSMidY(aRect) - 0.5 * handleSize); endPoint = NSMakePoint(startPoint.x, startPoint.y + handleSize); [darkColor set]; @@ -116,7 +116,7 @@ endPoint.x += 2.0; [NSBezierPath strokeLineFromPoint:startPoint toPoint:endPoint]; } else { - handleSize = fmin(handleSize, 2.0 * floorf(0.5 * NSWidth(aRect))); + handleSize = fminf(handleSize, 2.0 * floorf(0.5 * NSWidth(aRect))); startPoint = NSMakePoint(NSMidX(aRect) - 0.5 * handleSize, NSMinY(aRect) + 1.5); endPoint = NSMakePoint(startPoint.x + handleSize, startPoint.y); [darkColor set]; Modified: trunk/SKStatusBar.m =================================================================== --- trunk/SKStatusBar.m 2007-08-27 19:57:17 UTC (rev 2736) +++ trunk/SKStatusBar.m 2007-08-27 20:17:28 UTC (rev 2737) @@ -100,7 +100,7 @@ if (textRect.size.width < 0.0) textRect.size.width = 0.0; - float height = fmax([leftCell cellSize].height, [rightCell cellSize].height); + float height = fmaxf([leftCell cellSize].height, [rightCell cellSize].height); textRect.origin.y += 0.5f * (NSHeight(textRect) - height); textRect.origin.y = [self isFlipped] ? ceilf(NSMinY(textRect)) : floorf(NSMinY(textRect)); textRect.size.height = height; Modified: trunk/SKThumbnailTableView.m =================================================================== --- trunk/SKThumbnailTableView.m 2007-08-27 19:57:17 UTC (rev 2736) +++ trunk/SKThumbnailTableView.m 2007-08-27 20:17:28 UTC (rev 2737) @@ -177,7 +177,7 @@ - (NSSize)cellSize { NSSize size = [super cellSize]; - size.width = fmax(size.width, 12.0); + size.width = fmaxf(size.width, 12.0); return size; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-27 19:57:21
|
Revision: 2736 http://skim-app.svn.sourceforge.net/skim-app/?rev=2736&view=rev Author: hofman Date: 2007-08-27 12:57:17 -0700 (Mon, 27 Aug 2007) Log Message: ----------- Make lines for applescript always contained in the application. Simplification, and the container is not relevant anyway. Modified Paths: -------------- trunk/SKApplicationController.m trunk/SKDocument.m trunk/SKLine.h trunk/SKLine.m Modified: trunk/SKApplicationController.m =================================================================== --- trunk/SKApplicationController.m 2007-08-27 19:36:07 UTC (rev 2735) +++ trunk/SKApplicationController.m 2007-08-27 19:57:17 UTC (rev 2736) @@ -533,7 +533,7 @@ } - (SKLine *)objectInLinesAtIndex:(unsigned int)index { - return [[[SKLine alloc] initWithContainer:nil line:index] autorelease]; + return [[[SKLine alloc] initWithLine:index] autorelease]; } @end Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-27 19:36:07 UTC (rev 2735) +++ trunk/SKDocument.m 2007-08-27 19:57:17 UTC (rev 2736) @@ -1198,7 +1198,7 @@ } - (SKLine *)objectInLinesAtIndex:(unsigned int)index { - return [[[SKLine alloc] initWithContainer:self line:index] autorelease]; + return [[[SKLine alloc] initWithLine:index] autorelease]; } - (PDFPage *)currentPage { Modified: trunk/SKLine.h =================================================================== --- trunk/SKLine.h 2007-08-27 19:36:07 UTC (rev 2735) +++ trunk/SKLine.h 2007-08-27 19:57:17 UTC (rev 2736) @@ -40,9 +40,8 @@ @interface SKLine : NSObject { - id container; int line; } -- (id)initWithContainer:(id)aContainer line:(int)aLine; +- (id)initWithLine:(int)aLine; - (int)line; @end Modified: trunk/SKLine.m =================================================================== --- trunk/SKLine.m 2007-08-27 19:36:07 UTC (rev 2735) +++ trunk/SKLine.m 2007-08-27 19:57:17 UTC (rev 2736) @@ -41,18 +41,16 @@ @implementation SKLine -- (id)initWithContainer:(id)aContainer line:(int)aLine { +- (id)initWithLine:(int)aLine { if (self = [super init]) { - container = aContainer; line = aLine; } return self; } - (NSScriptObjectSpecifier *)objectSpecifier { - NSScriptObjectSpecifier *containerRef = [container objectSpecifier]; - NSScriptClassDescription *containerClassDescription = container ? [containerRef keyClassDescription] : (NSScriptClassDescription *)[NSClassDescription classDescriptionForClass:[NSApp class]]; - return [[[NSIndexSpecifier allocWithZone:[self zone]] initWithContainerClassDescription:containerClassDescription containerSpecifier:containerRef key:@"lines" index:line] autorelease]; + NSScriptClassDescription *containerClassDescription = (NSScriptClassDescription *)[NSClassDescription classDescriptionForClass:[NSApp class]]; + return [[[NSIndexSpecifier allocWithZone:[self zone]] initWithContainerClassDescription:containerClassDescription containerSpecifier:nil key:@"lines" index:line] autorelease]; } - (int)line { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-27 19:36:09
|
Revision: 2735 http://skim-app.svn.sourceforge.net/skim-app/?rev=2735&view=rev Author: hofman Date: 2007-08-27 12:36:07 -0700 (Mon, 27 Aug 2007) Log Message: ----------- Fix type. Fix function name. Modified Paths: -------------- trunk/NSGeometry_SKExtensions.h trunk/SKPDFView.m Modified: trunk/NSGeometry_SKExtensions.h =================================================================== --- trunk/NSGeometry_SKExtensions.h 2007-08-27 19:29:56 UTC (rev 2734) +++ trunk/NSGeometry_SKExtensions.h 2007-08-27 19:36:07 UTC (rev 2735) @@ -71,7 +71,7 @@ return NSMakePoint(NSMidX(rect), NSMidY(rect)); } -static inline NSPoint SKMakeSquareSize(float width) { +static inline NSSize SKMakeSquareSize(float width) { return NSMakeSize(width, width); } Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2007-08-27 19:29:56 UTC (rev 2734) +++ trunk/SKPDFView.m 2007-08-27 19:36:07 UTC (rev 2735) @@ -1728,7 +1728,7 @@ center = SKIntegralPoint([self convertPoint: center toPage: page]); if ([page rotation] % 180 == 90) defaultSize = NSMakeSize(defaultSize.height, defaultSize.width); - bounds = SKRectfromCenterAndSize(center, defaultSize); + bounds = SKRectFromCenterAndSize(center, defaultSize); // Make sure it fits in the page bounds = SKConstrainRect(bounds, [page boundsForBox:[self displayBox]]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-27 19:30:04
|
Revision: 2734 http://skim-app.svn.sourceforge.net/skim-app/?rev=2734&view=rev Author: hofman Date: 2007-08-27 12:29:56 -0700 (Mon, 27 Aug 2007) Log Message: ----------- use some more geometry convenience methods. Modified Paths: -------------- trunk/NSGeometry_SKExtensions.h trunk/SKPDFView.m Modified: trunk/NSGeometry_SKExtensions.h =================================================================== --- trunk/NSGeometry_SKExtensions.h 2007-08-27 18:42:57 UTC (rev 2733) +++ trunk/NSGeometry_SKExtensions.h 2007-08-27 19:29:56 UTC (rev 2734) @@ -71,6 +71,10 @@ return NSMakePoint(NSMidX(rect), NSMidY(rect)); } +static inline NSPoint SKMakeSquareSize(float width) { + return NSMakeSize(width, width); +} + static inline NSRect SKRectFromPoints(NSPoint aPoint, NSPoint bPoint) { NSRect rect; rect.origin.x = fmin(aPoint.x, bPoint.x); Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2007-08-27 18:42:57 UTC (rev 2733) +++ trunk/SKPDFView.m 2007-08-27 19:29:56 UTC (rev 2734) @@ -823,7 +823,7 @@ // Convert to "page space". center = SKIntegralPoint([self convertPoint: center toPage: page]); - NSSize defaultSize = isAlternate ? NSMakeSize(16.0, 16.0) : ([page rotation] % 180 == 90) ? NSMakeSize(64.0, 128.0) : NSMakeSize(128.0, 64.0); + NSSize defaultSize = isAlternate ? SKMakeSquareSize(16.0) : ([page rotation] % 180 == 90) ? NSMakeSize(64.0, 128.0) : NSMakeSize(128.0, 64.0); NSRect bounds = SKRectFromCenterAndSize(center, defaultSize); bounds = SKConstrainRect(bounds, [page boundsForBox:[self displayBox]]); @@ -1678,7 +1678,7 @@ if (annotationType == SKCircleNote || annotationType == SKSquareNote) bounds = NSInsetRect(bounds, -5.0, -5.0); } else { - NSSize defaultSize = (annotationType == SKAnchoredNote) ? NSMakeSize(16.0, 16.0) : ([page rotation] % 180 == 90) ? NSMakeSize(64.0, 128.0) : NSMakeSize(128.0, 64.0); + NSSize defaultSize = (annotationType == SKAnchoredNote) ? SKMakeSquareSize(16.0) : ([page rotation] % 180 == 90) ? NSMakeSize(64.0, 128.0) : NSMakeSize(128.0, 64.0); point = [self convertPoint:point toPage:page]; bounds = NSMakeRect(point.x - 0.5 * defaultSize.width, point.y - 0.5 * defaultSize.height, defaultSize.width, defaultSize.height); @@ -1710,7 +1710,7 @@ NSBeep(); return; } else { - NSSize defaultSize = (annotationType == SKAnchoredNote) ? NSMakeSize(16.0, 16.0) : NSMakeSize(128.0, 64.0); + NSSize defaultSize = (annotationType == SKAnchoredNote) ? SKMakeSquareSize(16.0) : NSMakeSize(128.0, 64.0); // First try the current mouse position NSPoint center = [self convertPoint:[[self window] mouseLocationOutsideOfEventStream] fromView:nil]; @@ -1728,7 +1728,7 @@ center = SKIntegralPoint([self convertPoint: center toPage: page]); if ([page rotation] % 180 == 90) defaultSize = NSMakeSize(defaultSize.height, defaultSize.width); - bounds = NSMakeRect(center.x - 0.5 * defaultSize.width, center.y - 0.5 * defaultSize.height, defaultSize.width, defaultSize.height); + bounds = SKRectfromCenterAndSize(center, defaultSize); // Make sure it fits in the page bounds = SKConstrainRect(bounds, [page boundsForBox:[self displayBox]]); @@ -2046,7 +2046,7 @@ if (pageIndex < [[self document] pageCount]) { PDFPage *page = [[self document] pageAtIndex:pageIndex]; PDFSelection *sel = [page selectionForLineAtPoint:point]; - NSRect rect = sel ? [sel boundsForPage:page] : NSMakeRect(point.x - 5.0, point.y - 5.0, 10.0, 10.0); + NSRect rect = sel ? [sel boundsForPage:page] : SKRectFromCenterAndSize(point, SKMakeSquareSize(10.0)); if (sel) [self setCurrentSelection:sel]; @@ -2207,7 +2207,7 @@ @implementation SKPDFView (Private) - (NSRect)resizeThumbForRect:(NSRect)rect rotation:(int)rotation { - NSSize size = NSMakeSize(8.0, 8.0); + NSSize size = SKMakeSquareSize(8.0); NSRect thumb = rect; thumb.size = size; @@ -2232,7 +2232,7 @@ } - (NSRect)resizeThumbForRect:(NSRect)rect point:(NSPoint)point { - NSSize size = NSMakeSize(8.0, 8.0); + NSSize size = SKMakeSquareSize(8.0); NSRect thumb = SKRectFromCenterAndSize(SKAddPoints(rect.origin, point), size); thumb.origin.x = point.x > 0.5 * NSWidth(rect) ? floorf(NSMinX(thumb)) : ceilf(NSMinX(thumb)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-27 18:43:04
|
Revision: 2733 http://skim-app.svn.sourceforge.net/skim-app/?rev=2733&view=rev Author: hofman Date: 2007-08-27 11:42:57 -0700 (Mon, 27 Aug 2007) Log Message: ----------- Restrict line angles to multiples of 45 degrees when moving the end points with the shift key held down. Modified Paths: -------------- trunk/SKPDFView.m Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2007-08-27 17:03:37 UTC (rev 2732) +++ trunk/SKPDFView.m 2007-08-27 18:42:57 UTC (rev 2733) @@ -2856,6 +2856,23 @@ newBounds.origin.y = floorf(0.5 * (startPoint.y + endPoint.y) - 4.0); } + if ([theEvent modifierFlags] & NSShiftKeyMask) { + NSPoint *fixedPoint = draggingStartPoint ? &endPoint : &startPoint; + NSPoint diffPoint = SKSubstractPoints(*draggedPoint, *fixedPoint); + float dx = fabs(diffPoint.x), dy = fabs(diffPoint.y); + + if (dx < 0.4 * dy) { + diffPoint.x = 0.0; + } else if (dy < 0.4 * dx) { + diffPoint.y = 0.0; + } else { + dx = fmin(dx, dy); + diffPoint.x = diffPoint.x < 0.0 ? -dx : dx; + diffPoint.y = diffPoint.y < 0.0 ? -dx : dx; + } + *draggedPoint = SKAddPoints(*fixedPoint, diffPoint); + } + startPoint = SKSubstractPoints(startPoint, newBounds.origin); endPoint = SKSubstractPoints(endPoint, newBounds.origin); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |