lists.geany.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
List overview
Commits
December 2007
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
commits@lists.geany.org
3 participants
57 discussions
Start a n
N
ew thread
SF.net SVN: geany: [2089] trunk
by eht16@users.sourceforge.net
04 Dec '07
04 Dec '07
Revision: 2089
http://geany.svn.sourceforge.net/geany/?rev=2089&view=rev
Author: eht16 Date: 2007-12-04 07:44:45 -0800 (Tue, 04 Dec 2007) Log Message: ----------- Set svn:keywords and svn:eol-style for all files. Modified Paths: -------------- trunk/geany.nsi trunk/plugins/export.c trunk/scintilla/License.txt trunk/tagmanager/latex.c trunk/tagmanager/lregex.c trunk/tagmanager/ruby.c trunk/tagmanager/vhdl.c Property Changed: ---------------- trunk/README.I18N trunk/data/filetype_extensions.conf trunk/data/filetypes.cs trunk/data/filetypes.d trunk/data/filetypes.diff trunk/data/filetypes.ferite trunk/data/filetypes.fortran trunk/data/filetypes.freebasic trunk/data/filetypes.haskell trunk/data/filetypes.haxe trunk/data/filetypes.html trunk/data/filetypes.javascript trunk/data/filetypes.lua trunk/data/filetypes.ruby trunk/data/filetypes.tcl trunk/data/filetypes.vhdl trunk/data/global.tags trunk/data/html_entities.tags trunk/data/latex.tags trunk/data/pascal.tags trunk/data/php.tags trunk/data/snippets.conf trunk/doc/geany.1.in trunk/doc/geany.html trunk/geany.desktop.in.in trunk/geany.nsi trunk/plugins/export.c trunk/plugins/makefile.win32 trunk/po/LINGUAS trunk/po/intl_stats.sh trunk/scintilla/CharacterSet.h trunk/scintilla/Decoration.cxx trunk/scintilla/Decoration.h trunk/scintilla/LexBasic.cxx trunk/scintilla/LexD.cxx trunk/scintilla/LexFortran.cxx trunk/scintilla/LexHaskell.cxx trunk/scintilla/LexLua.cxx trunk/scintilla/LexRuby.cxx trunk/scintilla/LexTCL.cxx trunk/scintilla/LexVHDL.cxx trunk/scintilla/License.txt trunk/scintilla/Partitioning.h trunk/scintilla/PositionCache.cxx trunk/scintilla/PositionCache.h trunk/scintilla/RunStyles.cxx trunk/scintilla/RunStyles.h trunk/scintilla/SplitVector.h trunk/src/keybindings.c trunk/src/keybindings.h trunk/src/navqueue.c trunk/src/navqueue.h trunk/src/printing.c trunk/src/printing.h trunk/src/project.c trunk/src/project.h trunk/src/socket.c trunk/src/socket.h trunk/src/tools.c trunk/src/tools.h trunk/tagmanager/basic.c trunk/tagmanager/css.c trunk/tagmanager/diff.c trunk/tagmanager/fortran.c trunk/tagmanager/haxe.c trunk/tagmanager/include/regex.h trunk/tagmanager/js.c trunk/tagmanager/latex.c trunk/tagmanager/lregex.c trunk/tagmanager/lua.c trunk/tagmanager/ruby.c trunk/tagmanager/tcl.c trunk/tagmanager/vhdl.c Property changes on: trunk/README.I18N ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/filetype_extensions.conf ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/filetypes.cs ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/filetypes.d ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/filetypes.diff ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/filetypes.ferite ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/filetypes.fortran ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/filetypes.freebasic ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/filetypes.haskell ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/filetypes.haxe ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/filetypes.html ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/filetypes.javascript ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/filetypes.lua ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/filetypes.ruby ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/filetypes.tcl ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/filetypes.vhdl ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/global.tags ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/html_entities.tags ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/latex.tags ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/pascal.tags ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/php.tags ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/data/snippets.conf ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/doc/geany.1.in ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/doc/geany.html ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/geany.desktop.in.in ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Modified: trunk/geany.nsi =================================================================== --- trunk/geany.nsi 2007-12-04 15:28:17 UTC (rev 2088) +++ trunk/geany.nsi 2007-12-04 15:44:45 UTC (rev 2089) @@ -1,333 +1,333 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Installer script for Geany (Windows Installer) ; -; Script generated by the HM NIS Edit Script Wizard. : -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - - -;;;;;;;;;;;;;;;;;;; -; helper defines ; -;;;;;;;;;;;;;;;;;;; -!define PRODUCT_NAME "Geany" -!define PRODUCT_VERSION "0.13" -!define PRODUCT_VERSION_ID "0.13.0.0" -!define PRODUCT_PUBLISHER "Enrico Tröger" -!define PRODUCT_WEB_SITE "
http://geany.uvena.de
" -!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Geany.exe" -!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" -!define PRODUCT_UNINST_ROOT_KEY "HKLM" -!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir" - -!define RESOURCEDIR "geany-${PRODUCT_VERSION}" - -; only used when embedding GTK+ installer -!define GTK_INSTALLER "gtk+-2.10.6-1-setup.exe" - -SetCompressor /SOLID lzma -XPStyle on -Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" -!ifdef INCLUDE_GTK -OutFile "geany-${PRODUCT_VERSION}_setup.exe" -!else -OutFile "geany-${PRODUCT_VERSION}_nogtk_setup.exe" -!endif -InstallDir "$PROGRAMFILES\Geany" -InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" -ShowInstDetails hide -ShowUnInstDetails hide - -;;;;;;;;;;;;;;;;;;;;; -; Version resource ; -;;;;;;;;;;;;;;;;;;;;; -VIProductVersion "${PRODUCT_VERSION_ID}" -VIAddVersionKey "ProductName" "${PRODUCT_NAME}" -VIAddVersionKey "FileVersion" "${PRODUCT_VERSION}" -VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}" -VIAddVersionKey "LegalCopyright" "Copyright 2005-2007 by Enrico Tröger" -VIAddVersionKey "FileDescription" "${PRODUCT_NAME} Installer" - -;;;;;;;;;;;;;;;; -; Init code ; -;;;;;;;;;;;;;;;; -Function .onInit - ; prevent running multiple instances of the installer - System::Call 'kernel32::CreateMutexA(i 0, i 0, t "geany_installer") i .r1 ?e' - Pop $R0 - StrCmp $R0 0 +3 - MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running." - Abort - - ; warn about a new install over an existing installation - ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" - StrCmp $R0 "" done - - MessageBox MB_YESNO|MB_ICONEXCLAMATION \ - "Geany has already been installed. $\nDo you want to remove the previous version before installing $(^Name) ?" \ - IDNO done - - ;Run the uninstaller - ClearErrors - ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file - - done: -FunctionEnd - - -;;;;;;;;;;;;;;;; -; MUI Settings ; -;;;;;;;;;;;;;;;; -!include "MUI.nsh" - -!define MUI_ABORTWARNING -!define MUI_ICON "pixmaps\geany.ico" -!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall-full.ico" - -; Welcome page -!insertmacro MUI_PAGE_WELCOME -; License page -;!define MUI_LICENSEPAGE_RADIOBUTTONS -!insertmacro MUI_PAGE_LICENSE "${RESOURCEDIR}\Copying.txt" -; Components page -!insertmacro MUI_PAGE_COMPONENTS -; Directory page -!define MUI_PAGE_CUSTOMFUNCTION_LEAVE OnDirLeave -!insertmacro MUI_PAGE_DIRECTORY -; Start menu page -var ICONS_GROUP -!define MUI_STARTMENUPAGE_NODISABLE -!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Geany" -!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}" -!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}" -!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}" -!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP -; Instfiles page -!insertmacro MUI_PAGE_INSTFILES -; Finish page -!define MUI_FINISHPAGE_RUN "$INSTDIR\Geany.exe" -!insertmacro MUI_PAGE_FINISH -; Uninstaller pages -!insertmacro MUI_UNPAGE_INSTFILES -; Language files -!insertmacro MUI_LANGUAGE "English" -; Reserve files -!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS -; MUI end ------ - - -;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Sections and InstTypes ; -;;;;;;;;;;;;;;;;;;;;;;;;;;; -InstType "Full" -InstType "Minimal" - -Section "!Program Files" SEC01 - SectionIn RO 1 2 - SetOutPath "$INSTDIR" - SetOverwrite ifnewer - File "${RESOURCEDIR}\Geany.exe" - File "${RESOURCEDIR}\*.txt" - - SetOutPath "$INSTDIR\data" - File "${RESOURCEDIR}\data\GPL-2" - File "${RESOURCEDIR}\data\file*" - - SetOutPath "$INSTDIR\share" - File /r "${RESOURCEDIR}\share\*" - - SetOutPath "$INSTDIR" - !insertmacro MUI_STARTMENU_WRITE_BEGIN Application - CreateDirectory "$SMPROGRAMS\$ICONS_GROUP" - CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Geany.lnk" "$INSTDIR\Geany.exe" - CreateShortCut "$DESKTOP\Geany.lnk" "$INSTDIR\Geany.exe" - CreateShortCut "$QUICKLAUNCH\Geany.lnk" "$INSTDIR\Geany.exe" - !insertmacro MUI_STARTMENU_WRITE_END -SectionEnd - -Section "Plugins" SEC02 - SectionIn 1 - SetOverwrite ifnewer - SetOutPath "$INSTDIR" - File /r "${RESOURCEDIR}\plugins" -SectionEnd - -Section "Language Files" SEC03 - SectionIn 1 - SetOutPath "$INSTDIR" - File /r "${RESOURCEDIR}\lib" -SectionEnd - -Section "Documentation" SEC04 - SectionIn 1 - SetOverwrite ifnewer - SetOutPath "$INSTDIR" - File /r "${RESOURCEDIR}\doc" - -; Shortcuts - !insertmacro MUI_STARTMENU_WRITE_BEGIN Application - WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" "$INSTDIR\doc\index.html" - CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Documentation.lnk" "$INSTDIR\Documentation.url" - !insertmacro MUI_STARTMENU_WRITE_END -SectionEnd - -Section "Autocompletion Tags" SEC05 - SectionIn 1 - SetOutPath "$INSTDIR\data" - SetOverwrite ifnewer - File "${RESOURCEDIR}\data\php.tags" - File "${RESOURCEDIR}\data\pascal.tags" - File "${RESOURCEDIR}\data\latex.tags" - File "${RESOURCEDIR}\data\html_entities.tags" - File "${RESOURCEDIR}\data\global.tags" -SectionEnd - -; Include GTK runtime library but only if desired from command line -!ifdef INCLUDE_GTK -Section "GTK 2.10 Runtime Environment" SEC06 - SectionIn 1 - SetOutPath "$INSTDIR" - SetOverwrite ifnewer - File "gtk\*" - SetOutPath "$INSTDIR\etc" - File /r "gtk\etc\*" - SetOutPath "$INSTDIR\lib" - File /r "gtk\lib\*" - SetOutPath "$INSTDIR\share" - File /r "gtk\share\*" -/* code to embed GTK+ installer executable - File ${GTK_INSTALLER} - ExecWait ${GTK_INSTALLER} -*/ -SectionEnd -!endif - -Section "Context menus" SEC07 - SectionIn 1 - WriteRegStr HKCR "*\shell\OpenWithGeany" "" "Open with Geany" - WriteRegStr HKCR "*\shell\OpenWithGeany\command" "" '$INSTDIR\geany.exe "%1"' -SectionEnd - -Section -AdditionalIcons - SetOutPath $INSTDIR - !insertmacro MUI_STARTMENU_WRITE_BEGIN Application - WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" - CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" - CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe" - !insertmacro MUI_STARTMENU_WRITE_END -SectionEnd - -Section -Post - WriteUninstaller "$INSTDIR\uninst.exe" - WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\Geany.exe" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Geany.exe" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "${PRODUCT_WEB_SITE}" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" -SectionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;; -; Section descriptions ; -;;;;;;;;;;;;;;;;;;;;;;;;; -!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN - !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "Required program files. You cannot skip these files." - !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} "Available plugins like 'Class Builder' and 'Insert Special Characters'." - !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} "Various translations of Geany's interface." - !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} "Manual in Text and HTML format." - !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} "Symbol lists necessary for auto completion of symbols." -!ifdef INCLUDE_GTK - !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} "You need this files to run Geany. If you have already installed a GTK Runtime Environment (2.6 or higher), you can skip it." -!endif - !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} "Add context menu item 'Open With Geany'" -!insertmacro MUI_FUNCTION_DESCRIPTION_END - - - -;;;;;;;;;;;;;;;;;;;;; -; helper functions ; -;;;;;;;;;;;;;;;;;;;;; -Function un.onUninstSuccess - HideWindow - MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." -FunctionEnd - -Function un.onInit - MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2 - Abort -FunctionEnd - -Function OnDirLeave - ClearErrors - SetOutPath "$INSTDIR" ; what about IfError creating $INSTDIR? - GetTempFileName $1 "$INSTDIR" ; creates tmp file (or fails) - FileOpen $0 "$1" "w" ; error to open? - FileWriteByte $0 "0" - IfErrors notPossible possible - -notPossible: - RMDir "$INSTDIR" ; removes folder if empty - MessageBox MB_OK "The given directory is not writeable. Please choose another one!" - Abort -possible: - FileClose $0 - Delete "$1" -FunctionEnd - -Section Uninstall - !insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP - Delete "$INSTDIR\${PRODUCT_NAME}.url" - Delete "$INSTDIR\Documentation.url" - Delete "$INSTDIR\uninst.exe" - Delete "$INSTDIR\News.txt" - Delete "$INSTDIR\ReadMe.txt" - Delete "$INSTDIR\Thanks.txt" - Delete "$INSTDIR\ToDo.txt" - Delete "$INSTDIR\Authors.txt" - Delete "$INSTDIR\ChangeLog.txt" - Delete "$INSTDIR\Copying.txt" - Delete "$INSTDIR\Geany.exe" - ; GTK files - Delete "$INSTDIR\charset.dll" - Delete "$INSTDIR\gspawn-win32-helper.exe" - Delete "$INSTDIR\gspawn-win32-helper-console.exe" - Delete "$INSTDIR\iconv.dll" - Delete "$INSTDIR\intl.dll" - Delete "$INSTDIR\libgthread-2.0-0.dll" - Delete "$INSTDIR\libgtk-win32-2.0-0.dll" - Delete "$INSTDIR\libpangocairo-1.0-0.dll" - Delete "$INSTDIR\libpangowin32-1.0-0.dll" - Delete "$INSTDIR\libgobject-2.0-0.dll" - Delete "$INSTDIR\libpango-1.0-0.dll" - Delete "$INSTDIR\libpangoft2-1.0-0.dll" - Delete "$INSTDIR\libpng13.dll" - Delete "$INSTDIR\libatk-1.0-0.dll" - Delete "$INSTDIR\libcairo-2.dll" - Delete "$INSTDIR\libgdk_pixbuf-2.0-0.dll" - Delete "$INSTDIR\libgdk-win32-2.0-0.dll" - Delete "$INSTDIR\libglib-2.0-0.dll" - Delete "$INSTDIR\libgmodule-2.0-0.dll" - Delete "$INSTDIR\zlib1.dll" - - Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" - Delete "$SMPROGRAMS\$ICONS_GROUP\Website.lnk" - Delete "$QUICKLAUNCH\Geany.lnk" - Delete "$DESKTOP\Geany.lnk" - Delete "$SMPROGRAMS\$ICONS_GROUP\Geany.lnk" - Delete "$SMPROGRAMS\$ICONS_GROUP\Documentation.lnk" - - RMDir "$SMPROGRAMS\$ICONS_GROUP" - RMDir /r "$INSTDIR\doc" - RMDir /r "$INSTDIR\plugins" - RMDir /r "$INSTDIR\data" - RMDir /r "$INSTDIR\etc" - RMDir /r "$INSTDIR\lib" - RMDir /r "$INSTDIR\share" - RMDir "$INSTDIR" - - DeleteRegKey HKCR "*\shell\OpenWithGeany" - - DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" - DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" - SetAutoClose true -SectionEnd - +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Installer script for Geany (Windows Installer) ; +; Script generated by the HM NIS Edit Script Wizard. : +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +;;;;;;;;;;;;;;;;;;; +; helper defines ; +;;;;;;;;;;;;;;;;;;; +!define PRODUCT_NAME "Geany" +!define PRODUCT_VERSION "0.13" +!define PRODUCT_VERSION_ID "0.13.0.0" +!define PRODUCT_PUBLISHER "Enrico Tröger" +!define PRODUCT_WEB_SITE "
http://geany.uvena.de
" +!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Geany.exe" +!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" +!define PRODUCT_UNINST_ROOT_KEY "HKLM" +!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir" + +!define RESOURCEDIR "geany-${PRODUCT_VERSION}" + +; only used when embedding GTK+ installer +!define GTK_INSTALLER "gtk+-2.10.6-1-setup.exe" + +SetCompressor /SOLID lzma +XPStyle on +Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" +!ifdef INCLUDE_GTK +OutFile "geany-${PRODUCT_VERSION}_setup.exe" +!else +OutFile "geany-${PRODUCT_VERSION}_nogtk_setup.exe" +!endif +InstallDir "$PROGRAMFILES\Geany" +InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" +ShowInstDetails hide +ShowUnInstDetails hide + +;;;;;;;;;;;;;;;;;;;;; +; Version resource ; +;;;;;;;;;;;;;;;;;;;;; +VIProductVersion "${PRODUCT_VERSION_ID}" +VIAddVersionKey "ProductName" "${PRODUCT_NAME}" +VIAddVersionKey "FileVersion" "${PRODUCT_VERSION}" +VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}" +VIAddVersionKey "LegalCopyright" "Copyright 2005-2007 by Enrico Tröger" +VIAddVersionKey "FileDescription" "${PRODUCT_NAME} Installer" + +;;;;;;;;;;;;;;;; +; Init code ; +;;;;;;;;;;;;;;;; +Function .onInit + ; prevent running multiple instances of the installer + System::Call 'kernel32::CreateMutexA(i 0, i 0, t "geany_installer") i .r1 ?e' + Pop $R0 + StrCmp $R0 0 +3 + MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running." + Abort + + ; warn about a new install over an existing installation + ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" + StrCmp $R0 "" done + + MessageBox MB_YESNO|MB_ICONEXCLAMATION \ + "Geany has already been installed. $\nDo you want to remove the previous version before installing $(^Name) ?" \ + IDNO done + + ;Run the uninstaller + ClearErrors + ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file + + done: +FunctionEnd + + +;;;;;;;;;;;;;;;; +; MUI Settings ; +;;;;;;;;;;;;;;;; +!include "MUI.nsh" + +!define MUI_ABORTWARNING +!define MUI_ICON "pixmaps\geany.ico" +!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall-full.ico" + +; Welcome page +!insertmacro MUI_PAGE_WELCOME +; License page +;!define MUI_LICENSEPAGE_RADIOBUTTONS +!insertmacro MUI_PAGE_LICENSE "${RESOURCEDIR}\Copying.txt" +; Components page +!insertmacro MUI_PAGE_COMPONENTS +; Directory page +!define MUI_PAGE_CUSTOMFUNCTION_LEAVE OnDirLeave +!insertmacro MUI_PAGE_DIRECTORY +; Start menu page +var ICONS_GROUP +!define MUI_STARTMENUPAGE_NODISABLE +!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Geany" +!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}" +!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}" +!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}" +!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP +; Instfiles page +!insertmacro MUI_PAGE_INSTFILES +; Finish page +!define MUI_FINISHPAGE_RUN "$INSTDIR\Geany.exe" +!insertmacro MUI_PAGE_FINISH +; Uninstaller pages +!insertmacro MUI_UNPAGE_INSTFILES +; Language files +!insertmacro MUI_LANGUAGE "English" +; Reserve files +!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS +; MUI end ------ + + +;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Sections and InstTypes ; +;;;;;;;;;;;;;;;;;;;;;;;;;;; +InstType "Full" +InstType "Minimal" + +Section "!Program Files" SEC01 + SectionIn RO 1 2 + SetOutPath "$INSTDIR" + SetOverwrite ifnewer + File "${RESOURCEDIR}\Geany.exe" + File "${RESOURCEDIR}\*.txt" + + SetOutPath "$INSTDIR\data" + File "${RESOURCEDIR}\data\GPL-2" + File "${RESOURCEDIR}\data\file*" + + SetOutPath "$INSTDIR\share" + File /r "${RESOURCEDIR}\share\*" + + SetOutPath "$INSTDIR" + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application + CreateDirectory "$SMPROGRAMS\$ICONS_GROUP" + CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Geany.lnk" "$INSTDIR\Geany.exe" + CreateShortCut "$DESKTOP\Geany.lnk" "$INSTDIR\Geany.exe" + CreateShortCut "$QUICKLAUNCH\Geany.lnk" "$INSTDIR\Geany.exe" + !insertmacro MUI_STARTMENU_WRITE_END +SectionEnd + +Section "Plugins" SEC02 + SectionIn 1 + SetOverwrite ifnewer + SetOutPath "$INSTDIR" + File /r "${RESOURCEDIR}\plugins" +SectionEnd + +Section "Language Files" SEC03 + SectionIn 1 + SetOutPath "$INSTDIR" + File /r "${RESOURCEDIR}\lib" +SectionEnd + +Section "Documentation" SEC04 + SectionIn 1 + SetOverwrite ifnewer + SetOutPath "$INSTDIR" + File /r "${RESOURCEDIR}\doc" + +; Shortcuts + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application + WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" "$INSTDIR\doc\index.html" + CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Documentation.lnk" "$INSTDIR\Documentation.url" + !insertmacro MUI_STARTMENU_WRITE_END +SectionEnd + +Section "Autocompletion Tags" SEC05 + SectionIn 1 + SetOutPath "$INSTDIR\data" + SetOverwrite ifnewer + File "${RESOURCEDIR}\data\php.tags" + File "${RESOURCEDIR}\data\pascal.tags" + File "${RESOURCEDIR}\data\latex.tags" + File "${RESOURCEDIR}\data\html_entities.tags" + File "${RESOURCEDIR}\data\global.tags" +SectionEnd + +; Include GTK runtime library but only if desired from command line +!ifdef INCLUDE_GTK +Section "GTK 2.10 Runtime Environment" SEC06 + SectionIn 1 + SetOutPath "$INSTDIR" + SetOverwrite ifnewer + File "gtk\*" + SetOutPath "$INSTDIR\etc" + File /r "gtk\etc\*" + SetOutPath "$INSTDIR\lib" + File /r "gtk\lib\*" + SetOutPath "$INSTDIR\share" + File /r "gtk\share\*" +/* code to embed GTK+ installer executable + File ${GTK_INSTALLER} + ExecWait ${GTK_INSTALLER} +*/ +SectionEnd +!endif + +Section "Context menus" SEC07 + SectionIn 1 + WriteRegStr HKCR "*\shell\OpenWithGeany" "" "Open with Geany" + WriteRegStr HKCR "*\shell\OpenWithGeany\command" "" '$INSTDIR\geany.exe "%1"' +SectionEnd + +Section -AdditionalIcons + SetOutPath $INSTDIR + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application + WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" + CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" + CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe" + !insertmacro MUI_STARTMENU_WRITE_END +SectionEnd + +Section -Post + WriteUninstaller "$INSTDIR\uninst.exe" + WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\Geany.exe" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Geany.exe" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "${PRODUCT_WEB_SITE}" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" +SectionEnd + +;;;;;;;;;;;;;;;;;;;;;;;;; +; Section descriptions ; +;;;;;;;;;;;;;;;;;;;;;;;;; +!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "Required program files. You cannot skip these files." + !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} "Available plugins like 'Class Builder' and 'Insert Special Characters'." + !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} "Various translations of Geany's interface." + !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} "Manual in Text and HTML format." + !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} "Symbol lists necessary for auto completion of symbols." +!ifdef INCLUDE_GTK + !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} "You need this files to run Geany. If you have already installed a GTK Runtime Environment (2.6 or higher), you can skip it." +!endif + !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} "Add context menu item 'Open With Geany'" +!insertmacro MUI_FUNCTION_DESCRIPTION_END + + + +;;;;;;;;;;;;;;;;;;;;; +; helper functions ; +;;;;;;;;;;;;;;;;;;;;; +Function un.onUninstSuccess + HideWindow + MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." +FunctionEnd + +Function un.onInit + MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2 + Abort +FunctionEnd + +Function OnDirLeave + ClearErrors + SetOutPath "$INSTDIR" ; what about IfError creating $INSTDIR? + GetTempFileName $1 "$INSTDIR" ; creates tmp file (or fails) + FileOpen $0 "$1" "w" ; error to open? + FileWriteByte $0 "0" + IfErrors notPossible possible + +notPossible: + RMDir "$INSTDIR" ; removes folder if empty + MessageBox MB_OK "The given directory is not writeable. Please choose another one!" + Abort +possible: + FileClose $0 + Delete "$1" +FunctionEnd + +Section Uninstall + !insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP + Delete "$INSTDIR\${PRODUCT_NAME}.url" + Delete "$INSTDIR\Documentation.url" + Delete "$INSTDIR\uninst.exe" + Delete "$INSTDIR\News.txt" + Delete "$INSTDIR\ReadMe.txt" + Delete "$INSTDIR\Thanks.txt" + Delete "$INSTDIR\ToDo.txt" + Delete "$INSTDIR\Authors.txt" + Delete "$INSTDIR\ChangeLog.txt" + Delete "$INSTDIR\Copying.txt" + Delete "$INSTDIR\Geany.exe" + ; GTK files + Delete "$INSTDIR\charset.dll" + Delete "$INSTDIR\gspawn-win32-helper.exe" + Delete "$INSTDIR\gspawn-win32-helper-console.exe" + Delete "$INSTDIR\iconv.dll" + Delete "$INSTDIR\intl.dll" + Delete "$INSTDIR\libgthread-2.0-0.dll" + Delete "$INSTDIR\libgtk-win32-2.0-0.dll" + Delete "$INSTDIR\libpangocairo-1.0-0.dll" + Delete "$INSTDIR\libpangowin32-1.0-0.dll" + Delete "$INSTDIR\libgobject-2.0-0.dll" + Delete "$INSTDIR\libpango-1.0-0.dll" + Delete "$INSTDIR\libpangoft2-1.0-0.dll" + Delete "$INSTDIR\libpng13.dll" + Delete "$INSTDIR\libatk-1.0-0.dll" + Delete "$INSTDIR\libcairo-2.dll" + Delete "$INSTDIR\libgdk_pixbuf-2.0-0.dll" + Delete "$INSTDIR\libgdk-win32-2.0-0.dll" + Delete "$INSTDIR\libglib-2.0-0.dll" + Delete "$INSTDIR\libgmodule-2.0-0.dll" + Delete "$INSTDIR\zlib1.dll" + + Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" + Delete "$SMPROGRAMS\$ICONS_GROUP\Website.lnk" + Delete "$QUICKLAUNCH\Geany.lnk" + Delete "$DESKTOP\Geany.lnk" + Delete "$SMPROGRAMS\$ICONS_GROUP\Geany.lnk" + Delete "$SMPROGRAMS\$ICONS_GROUP\Documentation.lnk" + + RMDir "$SMPROGRAMS\$ICONS_GROUP" + RMDir /r "$INSTDIR\doc" + RMDir /r "$INSTDIR\plugins" + RMDir /r "$INSTDIR\data" + RMDir /r "$INSTDIR\etc" + RMDir /r "$INSTDIR\lib" + RMDir /r "$INSTDIR\share" + RMDir "$INSTDIR" + + DeleteRegKey HKCR "*\shell\OpenWithGeany" + + DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" + DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" + SetAutoClose true +SectionEnd + Property changes on: trunk/geany.nsi ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Modified: trunk/plugins/export.c =================================================================== --- trunk/plugins/export.c 2007-12-04 15:28:17 UTC (rev 2088) +++ trunk/plugins/export.c 2007-12-04 15:44:45 UTC (rev 2089) @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * - * $Id: demoplugin.c 1749 2007-07-27 10:37:22Z ntrel $ + * $Id$ */ /* Export plugin. */ Property changes on: trunk/plugins/export.c ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/plugins/makefile.win32 ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/po/LINGUAS ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/po/intl_stats.sh ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/scintilla/CharacterSet.h ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/scintilla/Decoration.cxx ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/scintilla/Decoration.h ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/scintilla/LexBasic.cxx ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/scintilla/LexD.cxx ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/scintilla/LexFortran.cxx ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/scintilla/LexHaskell.cxx ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/scintilla/LexLua.cxx ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/scintilla/LexRuby.cxx ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/scintilla/LexTCL.cxx ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/scintilla/LexVHDL.cxx ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Modified: trunk/scintilla/License.txt =================================================================== --- trunk/scintilla/License.txt 2007-12-04 15:28:17 UTC (rev 2088) +++ trunk/scintilla/License.txt 2007-12-04 15:44:45 UTC (rev 2089) @@ -1,20 +1,20 @@ -License for Scintilla and SciTE - -Copyright 1998-2003 by Neil Hodgson <neilh(a)scintilla.org> - -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation. - -NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE +License for Scintilla and SciTE + +Copyright 1998-2003 by Neil Hodgson <neilh(a)scintilla.org> + +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation. + +NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file Property changes on: trunk/scintilla/License.txt ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/scintilla/Partitioning.h ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/scintilla/PositionCache.cxx ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/scintilla/PositionCache.h ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/scintilla/RunStyles.cxx ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/scintilla/RunStyles.h ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/scintilla/SplitVector.h ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/src/keybindings.c ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/keybindings.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/navqueue.c ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/navqueue.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/printing.c ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/printing.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/project.c ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/project.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/socket.c ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/socket.h ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/src/tools.c ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/tools.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/tagmanager/basic.c ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/tagmanager/css.c ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/tagmanager/diff.c ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/tagmanager/fortran.c ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/tagmanager/haxe.c ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/tagmanager/include/regex.h ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/tagmanager/js.c ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Modified: trunk/tagmanager/latex.c =================================================================== --- trunk/tagmanager/latex.c 2007-12-04 15:28:17 UTC (rev 2088) +++ trunk/tagmanager/latex.c 2007-12-04 15:44:45 UTC (rev 2089) @@ -1,5 +1,5 @@ /* - * $Id: tex.c 283 2006-04-27 22:52:09Z eht16 $ + * $Id$ * * Copyright (c) 2000-2001, Jérôme Plût * Copyright (c) 2006, Enrico Tröger Property changes on: trunk/tagmanager/latex.c ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Modified: trunk/tagmanager/lregex.c =================================================================== --- trunk/tagmanager/lregex.c 2007-12-04 15:28:17 UTC (rev 2088) +++ trunk/tagmanager/lregex.c 2007-12-04 15:44:45 UTC (rev 2089) @@ -1,5 +1,5 @@ /* -* $Id: lregex.c 576 2007-06-30 04:16:23Z elliotth $ +* $Id$ * * Copyright (c) 2000-2003, Darren Hiebert * Property changes on: trunk/tagmanager/lregex.c ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/tagmanager/lua.c ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Modified: trunk/tagmanager/ruby.c =================================================================== --- trunk/tagmanager/ruby.c 2007-12-04 15:28:17 UTC (rev 2088) +++ trunk/tagmanager/ruby.c 2007-12-04 15:44:45 UTC (rev 2089) @@ -1,5 +1,5 @@ /* -* $Id: ruby.c 571 2007-06-24 23:32:14Z elliotth $ +* $Id$ * * Copyright (c) 2000-2001, Thaddeus Covert <sahuagin(a)mediaone.net> * Copyright (c) 2002 Matthias Veit <matthias_veit(a)yahoo.de> Property changes on: trunk/tagmanager/ruby.c ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Property changes on: trunk/tagmanager/tcl.c ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Modified: trunk/tagmanager/vhdl.c =================================================================== --- trunk/tagmanager/vhdl.c 2007-12-04 15:28:17 UTC (rev 2088) +++ trunk/tagmanager/vhdl.c 2007-12-04 15:44:45 UTC (rev 2089) @@ -1,297 +1,297 @@ -/* -* $Id: vhdl.c,v 1.0 2005/11/05 -* -* Copyright (c) 2005, Klaus Dannecker -* -* This source code is released for free distribution under the terms of the -* GNU General Public License. -* -* This module contains functions for generating tags for the Vhdl HDL -* (Hardware Description Language). -* -*/ - -/* - * INCLUDE FILES - */ -#include "general.h" /* must always come first */ - -#include <string.h> -#include <setjmp.h> - -#include "keyword.h" -#include "parse.h" -#include "read.h" -#include "vstring.h" - -/* - * DATA DECLARATIONS - */ -typedef enum eException { ExceptionNone, ExceptionEOF } exception_t; - -typedef enum { - K_UNDEFINED = -1, - K_CONSTANT, - K_TYPE, - K_VARIABLE, - K_ATRIBUTE, - K_SIGNAL, - K_FUNCTION, - K_PROCEDURE, - K_COMPONENT, - K_PACKAGE, - K_PROCESS, - K_ENTITY, - K_ARCHITECTURE, - K_PORT -} vhdlKind; - -typedef struct { - const char *keyword; - vhdlKind kind; -} keywordAssoc; - -/* - * DATA DEFINITIONS - */ -static int Ungetc; -static int Lang_vhdl; -static jmp_buf Exception; -static vString* Name=NULL; -static vString* Lastname=NULL; -static vString* Keyword=NULL; -static vString* TagName=NULL; - -static kindOption VhdlKinds [] = { - { TRUE, 'c', "constant", "constants" }, - { TRUE, 't', "type", "types" }, - { TRUE, 'v', "variable", "variables" }, - { TRUE, 'a', "atribute", "atributes" }, - { TRUE, 's', "signal", "signals" }, - { TRUE, 'f', "function", "functions" }, - { TRUE, 'p', "procedure", "procedure" }, - { TRUE, 'k', "component", "components" }, - { TRUE, 'l', "package", "packages" }, - { TRUE, 'm', "process", "process" }, - { TRUE, 'n', "entity", "entity" }, - { TRUE, 'o', "architecture", "architecture" }, - { TRUE, 'u', "port", "ports" } -}; - -static keywordAssoc VhdlKeywordTable [] = { - { "variable", K_VARIABLE }, - { "constant", K_CONSTANT }, - { "variable", K_VARIABLE }, - { "type", K_TYPE }, - { "subtype", K_TYPE }, - { "signal", K_SIGNAL }, - { "function", K_FUNCTION }, - { "procedure", K_PROCEDURE }, - { "component", K_COMPONENT }, - { "package", K_PACKAGE }, - { "process", K_PROCESS }, - { "entity", K_ENTITY }, - { "architecture", K_ARCHITECTURE }, - { "inout", K_PORT }, - { "in", K_PORT }, - { "out", K_PORT } -}; - - -/* - * FUNCTION DEFINITIONS - */ - -static void initialize (const langType language) -{ - size_t i; - const size_t count = sizeof (VhdlKeywordTable) / - sizeof (VhdlKeywordTable [0]); - Lang_vhdl = language; - for (i = 0 ; i < count ; ++i) - { - const keywordAssoc* const p = &VhdlKeywordTable [i]; - addKeyword (p->keyword, language, (int) p->kind); - } -} - -static void vUngetc (int c) -{ - Assert (Ungetc == '\0'); - Ungetc = c; -} - -static int vGetc (void) -{ - int c; - if (Ungetc == '\0') - c = fileGetc (); - else - { - c = Ungetc; - Ungetc = '\0'; - } - if (c == '-') - { - int c2 = fileGetc (); - if (c2 == EOF) - longjmp (Exception, (int) ExceptionEOF); - else if (c2 == '-') /* strip comment until end-of-line */ - { - do - c = fileGetc (); - while (c != '\n' && c != EOF); - } - else - Ungetc = c2; - } - if (c == EOF) - longjmp (Exception, (int) ExceptionEOF); - return c; -} - -static boolean isIdentifierCharacter (const int c) -{ - return (boolean)(isalnum (c) || c == '_' || c == '`'); -} - -static int skipWhite (int c) -{ - while (c==' ') - c = vGetc (); - return c; -} - -static boolean readIdentifier (vString *const name, int c) -{ - vStringClear (name); - if (isIdentifierCharacter (c)) - { - while (isIdentifierCharacter (c)) - { - vStringPut (name, c); - c = vGetc (); - } - vUngetc (c); - vStringTerminate (name); - } - return (boolean)(name->length > 0); -} - -static void tagNameList (const vhdlKind kind, int c) -{ - Assert (isIdentifierCharacter (c)); - if (isIdentifierCharacter (c)) - { - readIdentifier (TagName, c); - makeSimpleTag (TagName, VhdlKinds, kind); - vUngetc (c); - } -} - -static void findTag (vString *const name) -{ - int c = '\0'; - vhdlKind kind; - vStringCopyToLower (Keyword, name); - kind = (vhdlKind)lookupKeyword (vStringValue (Keyword), Lang_vhdl); - if (kind == K_UNDEFINED) - { - c = skipWhite (vGetc ()); - vStringCopyS(Lastname,vStringValue(name)); - if (c == ':') - { - c = skipWhite (vGetc ()); - if (isIdentifierCharacter (c)) - { - readIdentifier (name, c); - vStringCopyToLower (Keyword, name); - lookupKeyword (vStringValue (Keyword), Lang_vhdl); - kind = (vhdlKind)lookupKeyword (vStringValue (Keyword), Lang_vhdl); - if (kind == K_PROCESS || kind == K_PORT) - { - makeSimpleTag (Lastname, VhdlKinds, kind); - } - } - } else { - vUngetc (c); - } - } - else - { - if (kind == K_SIGNAL) { - while (c!=':') { - c = skipWhite (vGetc ()); - if (c==',') - c = vGetc (); - if (isIdentifierCharacter (c)) - tagNameList (kind, c); - else - break; - c = vGetc (); - } - } - else if (kind == K_PROCESS) { - vStringCopyS(TagName,"unnamed"); - makeSimpleTag (TagName, VhdlKinds, kind); - } else { - c = skipWhite (vGetc ()); - if (c=='\"') - c = vGetc (); - if (isIdentifierCharacter (c)) - tagNameList (kind, c); - } - } -} - -static void findVhdlTags (void) -{ - volatile boolean newStatement = TRUE; - volatile int c = '\0'; - exception_t exception = (exception_t) setjmp (Exception); - Name = vStringNew (); - Lastname = vStringNew (); - Keyword = vStringNew (); - TagName = vStringNew (); - - if (exception == ExceptionNone) while (c != EOF) - { - c = vGetc (); - switch (c) - { - case ';': - case '\n': - newStatement = TRUE; - break; - - case ' ': - case '\t': - break; - - default: - if (newStatement && readIdentifier (Name, c)) { - findTag (Name); - } - newStatement = FALSE; - break; - } - } - vStringDelete (Name); - vStringDelete (Lastname); - vStringDelete (Keyword); - vStringDelete (TagName); -} - -extern parserDefinition* VhdlParser (void) -{ - static const char *const extensions [] = { "vhdl", "vhd", NULL }; - parserDefinition* def = parserNew ("Vhdl"); - def->kinds = VhdlKinds; - def->kindCount = KIND_COUNT (VhdlKinds); - def->extensions = extensions; - def->parser = findVhdlTags; - def->initialize = initialize; - return def; -} - -/* vi:set tabstop=8 shiftwidth=4: */ +/* +* $Id: vhdl.c,v 1.0 2005/11/05 +* +* Copyright (c) 2005, Klaus Dannecker +* +* This source code is released for free distribution under the terms of the +* GNU General Public License. +* +* This module contains functions for generating tags for the Vhdl HDL +* (Hardware Description Language). +* +*/ + +/* + * INCLUDE FILES + */ +#include "general.h" /* must always come first */ + +#include <string.h> +#include <setjmp.h> + +#include "keyword.h" +#include "parse.h" +#include "read.h" +#include "vstring.h" + +/* + * DATA DECLARATIONS + */ +typedef enum eException { ExceptionNone, ExceptionEOF } exception_t; + +typedef enum { + K_UNDEFINED = -1, + K_CONSTANT, + K_TYPE, + K_VARIABLE, + K_ATRIBUTE, + K_SIGNAL, + K_FUNCTION, + K_PROCEDURE, + K_COMPONENT, + K_PACKAGE, + K_PROCESS, + K_ENTITY, + K_ARCHITECTURE, + K_PORT +} vhdlKind; + +typedef struct { + const char *keyword; + vhdlKind kind; +} keywordAssoc; + +/* + * DATA DEFINITIONS + */ +static int Ungetc; +static int Lang_vhdl; +static jmp_buf Exception; +static vString* Name=NULL; +static vString* Lastname=NULL; +static vString* Keyword=NULL; +static vString* TagName=NULL; + +static kindOption VhdlKinds [] = { + { TRUE, 'c', "constant", "constants" }, + { TRUE, 't', "type", "types" }, + { TRUE, 'v', "variable", "variables" }, + { TRUE, 'a', "atribute", "atributes" }, + { TRUE, 's', "signal", "signals" }, + { TRUE, 'f', "function", "functions" }, + { TRUE, 'p', "procedure", "procedure" }, + { TRUE, 'k', "component", "components" }, + { TRUE, 'l', "package", "packages" }, + { TRUE, 'm', "process", "process" }, + { TRUE, 'n', "entity", "entity" }, + { TRUE, 'o', "architecture", "architecture" }, + { TRUE, 'u', "port", "ports" } +}; + +static keywordAssoc VhdlKeywordTable [] = { + { "variable", K_VARIABLE }, + { "constant", K_CONSTANT }, + { "variable", K_VARIABLE }, + { "type", K_TYPE }, + { "subtype", K_TYPE }, + { "signal", K_SIGNAL }, + { "function", K_FUNCTION }, + { "procedure", K_PROCEDURE }, + { "component", K_COMPONENT }, + { "package", K_PACKAGE }, + { "process", K_PROCESS }, + { "entity", K_ENTITY }, + { "architecture", K_ARCHITECTURE }, + { "inout", K_PORT }, + { "in", K_PORT }, + { "out", K_PORT } +}; + + +/* + * FUNCTION DEFINITIONS + */ + +static void initialize (const langType language) +{ + size_t i; + const size_t count = sizeof (VhdlKeywordTable) / + sizeof (VhdlKeywordTable [0]); + Lang_vhdl = language; + for (i = 0 ; i < count ; ++i) + { + const keywordAssoc* const p = &VhdlKeywordTable [i]; + addKeyword (p->keyword, language, (int) p->kind); + } +} + +static void vUngetc (int c) +{ + Assert (Ungetc == '\0'); + Ungetc = c; +} + +static int vGetc (void) +{ + int c; + if (Ungetc == '\0') + c = fileGetc (); + else + { + c = Ungetc; + Ungetc = '\0'; + } + if (c == '-') + { + int c2 = fileGetc (); + if (c2 == EOF) + longjmp (Exception, (int) ExceptionEOF); + else if (c2 == '-') /* strip comment until end-of-line */ + { + do + c = fileGetc (); + while (c != '\n' && c != EOF); + } + else + Ungetc = c2; + } + if (c == EOF) + longjmp (Exception, (int) ExceptionEOF); + return c; +} + +static boolean isIdentifierCharacter (const int c) +{ + return (boolean)(isalnum (c) || c == '_' || c == '`'); +} + +static int skipWhite (int c) +{ + while (c==' ') + c = vGetc (); + return c; +} + +static boolean readIdentifier (vString *const name, int c) +{ + vStringClear (name); + if (isIdentifierCharacter (c)) + { + while (isIdentifierCharacter (c)) + { + vStringPut (name, c); + c = vGetc (); + } + vUngetc (c); + vStringTerminate (name); + } + return (boolean)(name->length > 0); +} + +static void tagNameList (const vhdlKind kind, int c) +{ + Assert (isIdentifierCharacter (c)); + if (isIdentifierCharacter (c)) + { + readIdentifier (TagName, c); + makeSimpleTag (TagName, VhdlKinds, kind); + vUngetc (c); + } +} + +static void findTag (vString *const name) +{ + int c = '\0'; + vhdlKind kind; + vStringCopyToLower (Keyword, name); + kind = (vhdlKind)lookupKeyword (vStringValue (Keyword), Lang_vhdl); + if (kind == K_UNDEFINED) + { + c = skipWhite (vGetc ()); + vStringCopyS(Lastname,vStringValue(name)); + if (c == ':') + { + c = skipWhite (vGetc ()); + if (isIdentifierCharacter (c)) + { + readIdentifier (name, c); + vStringCopyToLower (Keyword, name); + lookupKeyword (vStringValue (Keyword), Lang_vhdl); + kind = (vhdlKind)lookupKeyword (vStringValue (Keyword), Lang_vhdl); + if (kind == K_PROCESS || kind == K_PORT) + { + makeSimpleTag (Lastname, VhdlKinds, kind); + } + } + } else { + vUngetc (c); + } + } + else + { + if (kind == K_SIGNAL) { + while (c!=':') { + c = skipWhite (vGetc ()); + if (c==',') + c = vGetc (); + if (isIdentifierCharacter (c)) + tagNameList (kind, c); + else + break; + c = vGetc (); + } + } + else if (kind == K_PROCESS) { + vStringCopyS(TagName,"unnamed"); + makeSimpleTag (TagName, VhdlKinds, kind); + } else { + c = skipWhite (vGetc ()); + if (c=='\"') + c = vGetc (); + if (isIdentifierCharacter (c)) + tagNameList (kind, c); + } + } +} + +static void findVhdlTags (void) +{ + volatile boolean newStatement = TRUE; + volatile int c = '\0'; + exception_t exception = (exception_t) setjmp (Exception); + Name = vStringNew (); + Lastname = vStringNew (); + Keyword = vStringNew (); + TagName = vStringNew (); + + if (exception == ExceptionNone) while (c != EOF) + { + c = vGetc (); + switch (c) + { + case ';': + case '\n': + newStatement = TRUE; + break; + + case ' ': + case '\t': + break; + + default: + if (newStatement && readIdentifier (Name, c)) { + findTag (Name); + } + newStatement = FALSE; + break; + } + } + vStringDelete (Name); + vStringDelete (Lastname); + vStringDelete (Keyword); + vStringDelete (TagName); +} + +extern parserDefinition* VhdlParser (void) +{ + static const char *const extensions [] = { "vhdl", "vhd", NULL }; + parserDefinition* def = parserNew ("Vhdl"); + def->kinds = VhdlKinds; + def->kindCount = KIND_COUNT (VhdlKinds); + def->extensions = extensions; + def->parser = findVhdlTags; + def->initialize = initialize; + return def; +} + +/* vi:set tabstop=8 shiftwidth=4: */ Property changes on: trunk/tagmanager/vhdl.c ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: geany: [2088] trunk
by eht16@users.sourceforge.net
04 Dec '07
04 Dec '07
Revision: 2088
http://geany.svn.sourceforge.net/geany/?rev=2088&view=rev
Author: eht16 Date: 2007-12-04 07:28:17 -0800 (Tue, 04 Dec 2007) Log Message: ----------- Let right-clicks select an item. Don't load unused symbols from library. Grab focus after right-clicked in the VTE widget. Modified Paths: -------------- trunk/ChangeLog trunk/plugins/filebrowser.c trunk/src/vte.c trunk/src/vte.h Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-12-04 13:25:41 UTC (rev 2087) +++ trunk/ChangeLog 2007-12-04 15:28:17 UTC (rev 2088) @@ -5,6 +5,10 @@ Fix display of double backslash in path entry on Windows. Add basic path entry auto completion. Print error message when external command fails to execute. + Let right-clicks select an item. + * src/vte.c, src/vte.h: + Don't load unused symbols from library. + Grab focus after right-clicked in the VTE widget. 2007-12-02 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> Modified: trunk/plugins/filebrowser.c =================================================================== --- trunk/plugins/filebrowser.c 2007-12-04 13:25:41 UTC (rev 2087) +++ trunk/plugins/filebrowser.c 2007-12-04 15:28:17 UTC (rev 2088) @@ -486,7 +486,7 @@ gtk_menu_popup(GTK_MENU(popup_menu), NULL, NULL, NULL, NULL, event->button, event->time); - return TRUE; + return FALSE; } return FALSE; } Modified: trunk/src/vte.c =================================================================== --- trunk/src/vte.c 2007-12-04 13:25:41 UTC (rev 2087) +++ trunk/src/vte.c 2007-12-04 15:28:17 UTC (rev 2088) @@ -206,7 +206,6 @@ gtk_widget_set_size_request(GTK_WIDGET(vte), 10, 10); vf->vte_terminal_set_size(VTE_TERMINAL(vte), 30, 1); - //vf->vte_terminal_set_encoding(VTE_TERMINAL(vte), "UTF-8"); vf->vte_terminal_set_mouse_autohide(VTE_TERMINAL(vte), TRUE); vf->vte_terminal_set_word_chars(VTE_TERMINAL(vte), VTE_WORDCHARS); @@ -323,6 +322,7 @@ popup_menu_created = TRUE; } + gtk_widget_grab_focus(vc->vte); gtk_menu_popup(GTK_MENU(vc->menu), NULL, NULL, NULL, NULL, event->button, event->time); } @@ -337,9 +337,7 @@ g_module_symbol(mod, "vte_terminal_fork_command", (void*)&vf->vte_terminal_fork_command); g_module_symbol(mod, "vte_terminal_set_word_chars", (void*)&vf->vte_terminal_set_word_chars); g_module_symbol(mod, "vte_terminal_set_mouse_autohide", (void*)&vf->vte_terminal_set_mouse_autohide); - g_module_symbol(mod, "vte_terminal_set_encoding", (void*)&vf->vte_terminal_set_encoding); g_module_symbol(mod, "vte_terminal_reset", (void*)&vf->vte_terminal_reset); - g_module_symbol(mod, "vte_terminal_set_cursor_blinks", (void*)&vf->vte_terminal_set_cursor_blinks); g_module_symbol(mod, "vte_terminal_get_type", (void*)&vf->vte_terminal_get_type); g_module_symbol(mod, "vte_terminal_set_scroll_on_output", (void*)&vf->vte_terminal_set_scroll_on_output); g_module_symbol(mod, "vte_terminal_set_scroll_on_keystroke", (void*)&vf->vte_terminal_set_scroll_on_keystroke); Modified: trunk/src/vte.h =================================================================== --- trunk/src/vte.h 2007-12-04 13:25:41 UTC (rev 2087) +++ trunk/src/vte.h 2007-12-04 15:28:17 UTC (rev 2088) @@ -117,8 +117,6 @@ void (*vte_terminal_set_word_chars) (VteTerminal *terminal, const char *spec); void (*vte_terminal_set_mouse_autohide) (VteTerminal *terminal, gboolean setting); void (*vte_terminal_reset) (VteTerminal *terminal, gboolean full, gboolean clear_history); - void (*vte_terminal_set_encoding) (VteTerminal *terminal, const char *codeset); - void (*vte_terminal_set_cursor_blinks) (VteTerminal *terminal, gboolean blink); GtkType (*vte_terminal_get_type) (void); void (*vte_terminal_set_scroll_on_output) (VteTerminal *terminal, gboolean scroll); void (*vte_terminal_set_scroll_on_keystroke) (VteTerminal *terminal, gboolean scroll); This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: geany: [2087] trunk
by eht16@users.sourceforge.net
04 Dec '07
04 Dec '07
Revision: 2087
http://geany.svn.sourceforge.net/geany/?rev=2087&view=rev
Author: eht16 Date: 2007-12-04 05:25:41 -0800 (Tue, 04 Dec 2007) Log Message: ----------- Add ".." path entry to every directory. Fix display of double backslash in path entry on Windows. Add basic path entry auto completion. Print error message when external command fails to execute. Modified Paths: -------------- trunk/ChangeLog trunk/plugins/filebrowser.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-12-02 11:58:17 UTC (rev 2086) +++ trunk/ChangeLog 2007-12-04 13:25:41 UTC (rev 2087) @@ -1,3 +1,12 @@ +2007-12-04 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + + * plugins/filebrowser.c: + Add ".." path entry to every directory. + Fix display of double backslash in path entry on Windows. + Add basic path entry auto completion. + Print error message when external command fails to execute. + + 2007-12-02 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> * plugins/filebrowser.c, plugins/pluginmacros.h, src/callbacks.c, Modified: trunk/plugins/filebrowser.c =================================================================== --- trunk/plugins/filebrowser.c 2007-12-02 11:58:17 UTC (rev 2086) +++ trunk/plugins/filebrowser.c 2007-12-04 13:25:41 UTC (rev 2087) @@ -49,6 +49,13 @@ _("The Geany developer team")) +// number of characters to skip the root of an absolute path("c:" or "d:" on Windows) +#ifdef G_OS_WIN32 +# define ROOT_OFFSET 2 +#else +# define ROOT_OFFSET 0 +#endif + enum { FILEVIEW_COLUMN_ICON = 0, @@ -59,10 +66,11 @@ static gboolean show_hidden_files = FALSE; static gboolean hide_object_files = TRUE; -static GtkWidget *file_view_vbox; -static GtkWidget *file_view; -static GtkListStore *file_store; -static GtkTreeIter *last_dir_iter = NULL; +static GtkWidget *file_view_vbox; +static GtkWidget *file_view; +static GtkListStore *file_store; +static GtkTreeIter *last_dir_iter = NULL; +static GtkEntryCompletion *entry_completion = NULL; static GtkWidget *path_entry; static gchar *current_dir = NULL; // in locale-encoding @@ -139,6 +147,22 @@ } +// adds ".." to the start of the file list +static void add_top_level_entry() +{ + GtkTreeIter iter; + + if (utils->str_equal(current_dir + ROOT_OFFSET, G_DIR_SEPARATOR_S)) + return; + + gtk_list_store_prepend(file_store, &iter); + last_dir_iter = gtk_tree_iter_copy(&iter); + + gtk_list_store_set(file_store, &iter, + FILEVIEW_COLUMN_ICON, GTK_STOCK_DIRECTORY, FILEVIEW_COLUMN_NAME, "..", -1); +} + + static void clear() { gtk_list_store_clear(file_store); @@ -169,10 +193,12 @@ list = utils->get_file_list(current_dir, NULL, NULL); if (list != NULL) { + add_top_level_entry(); g_slist_foreach(list, (GFunc) add_item, NULL); g_slist_foreach(list, (GFunc) g_free, NULL); g_slist_free(list); } + gtk_entry_completion_set_model(entry_completion, GTK_TREE_MODEL(file_store)); } @@ -219,6 +245,14 @@ } +static void on_go_up() +{ + // remove the highest directory part (which becomes the basename of current_dir) + setptr(current_dir, g_path_get_dirname(current_dir)); + refresh(); +} + + static void handle_selection(GList *list, GtkTreeSelection *treesel, gboolean external) { GList *item; @@ -253,22 +287,31 @@ for (item = list; item != NULL; item = g_list_next(item)) { gchar *name, *fname, *dir_sep = G_DIR_SEPARATOR_S; + gboolean go_up = FALSE; treepath = (GtkTreePath*) item->data; gtk_tree_model_get_iter(model, &iter, treepath); gtk_tree_model_get(model, &iter, FILEVIEW_COLUMN_NAME, &name, -1); - if (utils->str_equal(current_dir, G_DIR_SEPARATOR_S)) /// TODO test this on Windows + if (utils->str_equal(current_dir + ROOT_OFFSET, G_DIR_SEPARATOR_S)) dir_sep = ""; setptr(name, utils->get_locale_from_utf8(name)); fname = g_strconcat(current_dir, dir_sep, name, NULL); + if (utils->str_equal(name, "..")) + go_up = TRUE; g_free(name); - if (external) + if (go_up) { + g_free(fname); + on_go_up(); + } + else if (external) + { gchar *cmd; gchar *dir; GString *cmd_str = g_string_new(open_cmd); + GError *error= NULL; if (! dir_found) dir = g_path_get_dirname(fname); @@ -280,7 +323,12 @@ cmd = g_string_free(cmd_str, FALSE); setptr(cmd, utils->get_locale_from_utf8(cmd)); - g_spawn_command_line_async(cmd, NULL); + if (! g_spawn_command_line_async(cmd, &error)) + { + ui->set_statusbar(TRUE, + _("Could not execute external command (%s)."), error->message); + g_error_free(error); + } g_free(cmd); g_free(dir); g_free(fname); @@ -444,14 +492,6 @@ } -static void on_go_up() -{ - // remove the highest directory part (which becomes the basename of current_dir) - setptr(current_dir, g_path_get_dirname(current_dir)); - refresh(); -} - - static gboolean on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data) { if (event->keyval == GDK_Return @@ -472,7 +512,14 @@ { gchar *new_dir = (gchar*) gtk_entry_get_text(entry); if (NZV(new_dir)) + { + if (g_str_has_suffix(new_dir, "..")) + { + on_go_up(); + return; + } new_dir = utils->get_locale_from_utf8(new_dir); + } else new_dir = g_strdup(g_get_home_dir()); @@ -559,6 +606,69 @@ } +static gboolean completion_match_func(GtkEntryCompletion *completion, const gchar *key, + GtkTreeIter *iter, gpointer user_data) +{ + gchar *str, *icon; + gboolean result = FALSE; + + gtk_tree_model_get(GTK_TREE_MODEL(file_store), iter, + FILEVIEW_COLUMN_ICON, &icon, FILEVIEW_COLUMN_NAME, &str, -1); + + if (str != NULL && icon != NULL && utils->str_equal(icon, GTK_STOCK_DIRECTORY) && + ! g_str_has_suffix(key, G_DIR_SEPARATOR_S)) + { + // key is something like "/tmp/te" and str is a filename like "test", + // so strip the path from key to make them comparable + gchar *base_name = g_path_get_basename(key); + gchar *str_lowered = g_utf8_strdown(str, -1); + result = g_str_has_prefix(str_lowered, base_name); + g_free(base_name); + g_free(str_lowered); + } + g_free(str); + g_free(icon); + + return result; +} + + +static gboolean completion_match_selected(GtkEntryCompletion *widget, GtkTreeModel *model, + GtkTreeIter *iter, gpointer user_data) +{ + gchar *str; + gtk_tree_model_get(model, iter, FILEVIEW_COLUMN_NAME, &str, -1); + if (str != NULL) + { + gchar *text = g_strconcat(current_dir, G_DIR_SEPARATOR_S, str, NULL); + gtk_entry_set_text(GTK_ENTRY(path_entry), text); + gtk_editable_set_position(GTK_EDITABLE(path_entry), -1); + // force change of directory when completion is done + on_path_entry_activate(GTK_ENTRY(path_entry), NULL); + g_free(text); + } + g_free(str); + + return TRUE; +} + + +static void completion_create() +{ + entry_completion = gtk_entry_completion_new(); + + gtk_entry_completion_set_inline_completion(entry_completion, FALSE); + gtk_entry_completion_set_popup_completion(entry_completion, TRUE); + gtk_entry_completion_set_text_column(entry_completion, FILEVIEW_COLUMN_NAME); + gtk_entry_completion_set_match_func(entry_completion, completion_match_func, NULL, NULL); + + g_signal_connect(entry_completion, "match-selected", + G_CALLBACK(completion_match_selected), NULL); + + gtk_entry_set_completion(GTK_ENTRY(path_entry), entry_completion); +} + + #define CHECK_READ_SETTING(var, error, tmp) \ if ((error) != NULL) \ { \ @@ -585,6 +695,7 @@ file_view = gtk_tree_view_new(); prepare_file_view(); + completion_create(); scrollwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy( @@ -706,4 +817,5 @@ g_free(config_file); g_free(open_cmd); gtk_widget_destroy(file_view_vbox); + g_object_unref(G_OBJECT(entry_completion)); } This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: geany: [2086] trunk
by eht16@users.sourceforge.net
02 Dec '07
02 Dec '07
Revision: 2086
http://geany.svn.sourceforge.net/geany/?rev=2086&view=rev
Author: eht16 Date: 2007-12-02 03:58:17 -0800 (Sun, 02 Dec 2007) Log Message: ----------- Updated Scintilla to version 1.75. Modified Paths: -------------- trunk/ChangeLog trunk/scintilla/CellBuffer.cxx trunk/scintilla/CellBuffer.h trunk/scintilla/ContractionState.cxx trunk/scintilla/ContractionState.h trunk/scintilla/Document.cxx trunk/scintilla/Document.h trunk/scintilla/DocumentAccessor.cxx trunk/scintilla/Editor.cxx trunk/scintilla/Editor.h trunk/scintilla/LexBash.cxx trunk/scintilla/LexCPP.cxx trunk/scintilla/LexHTML.cxx trunk/scintilla/LexHaskell.cxx trunk/scintilla/LexOthers.cxx trunk/scintilla/LexPerl.cxx trunk/scintilla/LexPython.cxx trunk/scintilla/LexSQL.cxx trunk/scintilla/Partitioning.h trunk/scintilla/PlatGTK.cxx trunk/scintilla/PositionCache.cxx trunk/scintilla/PositionCache.h trunk/scintilla/PropSet.cxx trunk/scintilla/RunStyles.cxx trunk/scintilla/RunStyles.h trunk/scintilla/ScintillaBase.cxx trunk/scintilla/ScintillaGTK.cxx trunk/scintilla/SplitVector.h trunk/scintilla/ViewStyle.cxx trunk/scintilla/ViewStyle.h trunk/scintilla/include/Platform.h trunk/scintilla/include/PropSet.h trunk/scintilla/include/SciLexer.h trunk/scintilla/include/Scintilla.h Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-12-02 10:52:19 UTC (rev 2085) +++ trunk/ChangeLog 2007-12-02 11:58:17 UTC (rev 2086) @@ -7,6 +7,7 @@ Make path entry of filebrowser plugin editable. Add "Open with" and "Find in Files" popup menu items to filebrowser plugin and add configuration dialog. + * scintilla/*, scintilla/include/*: Updated Scintilla to version 1.75. 2007-12-01 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> Modified: trunk/scintilla/CellBuffer.cxx =================================================================== --- trunk/scintilla/CellBuffer.cxx 2007-12-02 10:52:19 UTC (rev 2085) +++ trunk/scintilla/CellBuffer.cxx 2007-12-02 11:58:17 UTC (rev 2086) @@ -13,7 +13,6 @@ #include "Platform.h" #include "Scintilla.h" -#include "SVector.h" #include "SplitVector.h" #include "Partitioning.h" #include "CellBuffer.h" @@ -472,6 +471,7 @@ } void UndoHistory::EndUndoAction() { + PLATFORM_ASSERT(undoSequenceDepth > 0); EnsureUndoRoom(); undoSequenceDepth--; if (0 == undoSequenceDepth) { @@ -563,7 +563,7 @@ CellBuffer::~CellBuffer() { } -char CellBuffer::CharAt(int position) { +char CellBuffer::CharAt(int position) const { return substance.ValueAt(position); } @@ -653,7 +653,7 @@ return data; } -int CellBuffer::Length() { +int CellBuffer::Length() const { return substance.Length(); } @@ -662,11 +662,11 @@ style.ReAllocate(newSize); } -int CellBuffer::Lines() { +int CellBuffer::Lines() const { return lv.Lines(); } -int CellBuffer::LineStart(int line) { +int CellBuffer::LineStart(int line) const { if (line < 0) return 0; else if (line >= Lines()) @@ -726,6 +726,20 @@ // Without undo +void CellBuffer::InsertLine(int line, int position) { + lv.InsertLine(line, position); + if (lineStates.Length()) { + lineStates.Insert(line, 0); + } +} + +void CellBuffer::RemoveLine(int line) { + lv.RemoveLine(line); + if (lineStates.Length()) { + lineStates.Delete(line); + } +} + void CellBuffer::BasicInsertString(int position, const char *s, int insertLength) { if (insertLength == 0) return; @@ -741,21 +755,21 @@ char chAfter = substance.ValueAt(position + insertLength); if (chPrev == '\r' && chAfter == '\n') { // Splitting up a crlf pair at position - lv.InsertLine(lineInsert, position); + InsertLine(lineInsert, position); lineInsert++; } char ch = ' '; for (int i = 0; i < insertLength; i++) { ch = s[i]; if (ch == '\r') { - lv.InsertLine(lineInsert, (position + i) + 1); + InsertLine(lineInsert, (position + i) + 1); lineInsert++; } else if (ch == '\n') { if (chPrev == '\r') { // Patch up what was end of line lv.SetLineStart(lineInsert - 1, (position + i) + 1); } else { - lv.InsertLine(lineInsert, (position + i) + 1); + InsertLine(lineInsert, (position + i) + 1); lineInsert++; } } @@ -765,7 +779,7 @@ if (chAfter == '\n') { if (ch == '\r') { // End of line already in buffer so drop the newly created one - lv.RemoveLine(lineInsert - 1); + RemoveLine(lineInsert - 1); } } } @@ -800,13 +814,13 @@ chNext = substance.ValueAt(position + i + 1); if (ch == '\r') { if (chNext != '\n') { - lv.RemoveLine(lineRemove); + RemoveLine(lineRemove); } } else if (ch == '\n') { if (ignoreNL) { ignoreNL = false; // Further \n are real deletions } else { - lv.RemoveLine(lineRemove); + RemoveLine(lineRemove); } } @@ -817,7 +831,7 @@ char chAfter = substance.ValueAt(position + deleteLength); if (chBefore == '\r' && chAfter == '\n') { // Using lineRemove-1 as cr ended line before start of deletion - lv.RemoveLine(lineRemove - 1); + RemoveLine(lineRemove - 1); lv.SetLineStart(lineRemove - 1, position + 1); } } @@ -892,12 +906,14 @@ } int CellBuffer::SetLineState(int line, int state) { + lineStates.EnsureLength(line + 1); int stateOld = lineStates[line]; lineStates[line] = state; return stateOld; } int CellBuffer::GetLineState(int line) { + lineStates.EnsureLength(line + 1); return lineStates[line]; } Modified: trunk/scintilla/CellBuffer.h =================================================================== --- trunk/scintilla/CellBuffer.h 2007-12-02 10:52:19 UTC (rev 2085) +++ trunk/scintilla/CellBuffer.h 2007-12-02 11:58:17 UTC (rev 2086) @@ -67,11 +67,11 @@ void InsertLine(int line, int position); void SetLineStart(int line, int position); void RemoveLine(int line); - int Lines() { + int Lines() const { return starts.Partitions(); } int LineFromPosition(int pos); - int LineStart(int line) { + int LineStart(int line) const { return starts.PositionFromPartition(line); } @@ -160,7 +160,7 @@ LineVector lv; - SVector lineStates; + SplitVector<int> lineStates; public: @@ -168,15 +168,17 @@ ~CellBuffer(); /// Retrieving positions outside the range of the buffer works and returns 0 - char CharAt(int position); + char CharAt(int position) const; void GetCharRange(char *buffer, int position, int lengthRetrieve); char StyleAt(int position); - int Length(); + int Length() const; void Allocate(int newSize); - int Lines(); - int LineStart(int line); + int Lines() const; + int LineStart(int line) const; int LineFromPosition(int pos) { return lv.LineFromPosition(pos); } + void InsertLine(int line, int position); + void RemoveLine(int line); const char *InsertString(int position, const char *s, int insertLength, bool &startSequence); /// Setting styles for positions outside the range of the buffer is safe and has no effect. Modified: trunk/scintilla/ContractionState.cxx =================================================================== --- trunk/scintilla/ContractionState.cxx 2007-12-02 10:52:19 UTC (rev 2085) +++ trunk/scintilla/ContractionState.cxx 2007-12-02 11:58:17 UTC (rev 2086) @@ -1,293 +1,251 @@ // Scintilla source code edit control /** @file ContractionState.cxx - ** Manages visibility of lines for folding. + ** Manages visibility of lines for folding and wrapping. **/ -// Copyright 1998-2001 by Neil Hodgson <neilh(a)scintilla.org> +// Copyright 1998-2007 by Neil Hodgson <neilh(a)scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. +#include <string.h> + #include "Platform.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" #include "ContractionState.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif -OneLine::OneLine() { - displayLine = 0; - //docLine = 0; - visible = true; - height = 1; - expanded = true; +ContractionState::ContractionState() : visible(0), expanded(0), heights(0), displayLines(0), linesInDocument(1) { + //InsertLine(0); } -ContractionState::ContractionState() { - lines = 0; - size = 0; - linesInDoc = 1; - linesInDisplay = 1; - valid = false; - docLines = 0; - sizeDocLines = 0; -} - ContractionState::~ContractionState() { Clear(); } -void ContractionState::MakeValid() const { - if (!valid) { - // Could be cleverer by keeping the index of the last still valid entry - // rather than invalidating all. - linesInDisplay = 0; - for (int lineInDoc=0; lineInDoc<linesInDoc; lineInDoc++) { - lines[lineInDoc].displayLine = linesInDisplay; - if (lines[lineInDoc].visible) { - linesInDisplay += lines[lineInDoc].height; - } - } - if (sizeDocLines < linesInDisplay) { - delete []docLines; - int *docLinesNew = new int[linesInDisplay + growSize]; - if (!docLinesNew) { - docLines = 0; - sizeDocLines = 0; - return; - } - docLines = docLinesNew; - sizeDocLines = linesInDisplay + growSize; - } - - int lineInDisplay=0; - for (int line=0; line<linesInDoc; line++) { - if (lines[line].visible) { - for (int linePiece=0; linePiece<lines[line].height; linePiece++) { - docLines[lineInDisplay] = line; - lineInDisplay++; - } - } - } - valid = true; +void ContractionState::EnsureData() { + if (OneToOne()) { + visible = new RunStyles(); + expanded = new RunStyles(); + heights = new RunStyles(); + displayLines = new Partitioning(4); + InsertLines(0, linesInDocument); } } void ContractionState::Clear() { - delete []lines; - lines = 0; - size = 0; - linesInDoc = 1; - linesInDisplay = 1; - delete []docLines; - docLines = 0; - sizeDocLines = 0; + delete visible; + visible = 0; + delete expanded; + expanded = 0; + delete heights; + heights = 0; + delete displayLines; + displayLines = 0; + linesInDocument = 1; } int ContractionState::LinesInDoc() const { - return linesInDoc; + if (OneToOne()) { + return linesInDocument; + } else { + return displayLines->Partitions() - 1; + } } int ContractionState::LinesDisplayed() const { - if (size != 0) { - MakeValid(); + if (OneToOne()) { + return linesInDocument; + } else { + return displayLines->PositionFromPartition(LinesInDoc()); } - return linesInDisplay; } int ContractionState::DisplayFromDoc(int lineDoc) const { - if (size == 0) { + if (OneToOne()) { return lineDoc; + } else { + if (lineDoc > displayLines->Partitions()) + lineDoc = displayLines->Partitions(); + return displayLines->PositionFromPartition(lineDoc); } - MakeValid(); - if ((lineDoc >= 0) && (lineDoc < linesInDoc)) { - return lines[lineDoc].displayLine; - } - return -1; } int ContractionState::DocFromDisplay(int lineDisplay) const { - if (lineDisplay <= 0) - return 0; - if (lineDisplay >= linesInDisplay) - return linesInDoc; - if (size == 0) + if (OneToOne()) { return lineDisplay; - MakeValid(); - if (docLines) { // Valid allocation - return docLines[lineDisplay]; } else { - return 0; + if (lineDisplay <= 0) { + return 0; + } + if (lineDisplay > LinesDisplayed()) { + return displayLines->PartitionFromPosition(LinesDisplayed()); + } + int lineDoc = displayLines->PartitionFromPosition(lineDisplay); + PLATFORM_ASSERT(GetVisible(lineDoc)); + return lineDoc; } } -void ContractionState::Grow(int sizeNew) { - OneLine *linesNew = new OneLine[sizeNew]; - if (linesNew) { - int i = 0; - for (; i < size; i++) { - linesNew[i] = lines[i]; - } - for (; i < sizeNew; i++) { - linesNew[i].displayLine = i; - } - delete []lines; - lines = linesNew; - size = sizeNew; - valid = false; +void ContractionState::InsertLine(int lineDoc) { + if (OneToOne()) { + linesInDocument++; } else { - Platform::DebugPrintf("No memory available\n"); - // TODO: Blow up + visible->InsertSpace(lineDoc, 1); + visible->SetValueAt(lineDoc, 1); + expanded->InsertSpace(lineDoc, 1); + expanded->SetValueAt(lineDoc, 1); + heights->InsertSpace(lineDoc, 1); + heights->SetValueAt(lineDoc, 1); + int lineDisplay = DisplayFromDoc(lineDoc); + displayLines->InsertPartition(lineDoc, lineDisplay); + displayLines->InsertText(lineDoc, 1); } } void ContractionState::InsertLines(int lineDoc, int lineCount) { - if (size == 0) { - linesInDoc += lineCount; - linesInDisplay += lineCount; - return; + for (int l = 0; l < lineCount; l++) { + InsertLine(lineDoc + l); } - //Platform::DebugPrintf("InsertLine[%d] = %d\n", lineDoc); - if ((linesInDoc + lineCount + 2) >= size) { - Grow(linesInDoc + lineCount + growSize); + Check(); +} + +void ContractionState::DeleteLine(int lineDoc) { + if (OneToOne()) { + linesInDocument--; + } else { + if (GetVisible(lineDoc)) { + displayLines->InsertText(lineDoc, -heights->ValueAt(lineDoc)); + } + displayLines->RemovePartition(lineDoc); + visible->DeleteRange(lineDoc, 1); + expanded->DeleteRange(lineDoc, 1); + heights->DeleteRange(lineDoc, 1); } - linesInDoc += lineCount; - for (int i = linesInDoc; i >= lineDoc + lineCount; i--) { - lines[i].visible = lines[i - lineCount].visible; - lines[i].height = lines[i - lineCount].height; - linesInDisplay += lines[i].height; - lines[i].expanded = lines[i - lineCount].expanded; - } - for (int d=0;d<lineCount;d++) { - lines[lineDoc+d].visible = true; // Should inherit visibility from context ? - lines[lineDoc+d].height = 1; - lines[lineDoc+d].expanded = true; - } - valid = false; } void ContractionState::DeleteLines(int lineDoc, int lineCount) { - if (size == 0) { - linesInDoc -= lineCount; - linesInDisplay -= lineCount; - return; + for (int l = 0; l < lineCount; l++) { + DeleteLine(lineDoc); } - int deltaDisplayed = 0; - for (int d=0;d<lineCount;d++) { - if (lines[lineDoc+d].visible) - deltaDisplayed -= lines[lineDoc+d].height; - } - for (int i = lineDoc; i < linesInDoc-lineCount; i++) { - if (i != 0) // Line zero is always visible - lines[i].visible = lines[i + lineCount].visible; - lines[i].expanded = lines[i + lineCount].expanded; - lines[i].height = lines[i + lineCount].height; - } - linesInDoc -= lineCount; - linesInDisplay += deltaDisplayed; - valid = false; + Check(); } bool ContractionState::GetVisible(int lineDoc) const { - if (size == 0) + if (OneToOne()) { return true; - if ((lineDoc >= 0) && (lineDoc < linesInDoc)) { - return lines[lineDoc].visible; } else { - return false; + if (lineDoc >= visible->Length()) + return true; + return visible->ValueAt(lineDoc) == 1; } } -bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible) { - if (lineDocStart == 0) - lineDocStart++; - if (lineDocStart > lineDocEnd) +bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible_) { + if (OneToOne() && visible_) { return false; - if (size == 0) { - Grow(linesInDoc + growSize); - } - // TODO: modify docLine members to mirror displayLine - int delta = 0; - // Change lineDocs - if ((lineDocStart <= lineDocEnd) && (lineDocStart >= 0) && (lineDocEnd < linesInDoc)) { - for (int line=lineDocStart; line <= lineDocEnd; line++) { - if (lines[line].visible != visible) { - delta += visible ? lines[line].height : -lines[line].height; - lines[line].visible = visible; - valid = false; + } else { + EnsureData(); + int delta = 0; + Check(); + if ((lineDocStart <= lineDocEnd) && (lineDocStart >= 0) && (lineDocEnd < LinesInDoc())) { + for (int line = lineDocStart; line <= lineDocEnd; line++) { + if (GetVisible(line) != visible_) { + int difference = visible_ ? heights->ValueAt(line) : -heights->ValueAt(line); + visible->SetValueAt(line, visible_ ? 1 : 0); + displayLines->InsertText(line, difference); + delta += difference; + } } + } else { + return false; } + Check(); + return delta != 0; } - linesInDisplay += delta; - return delta != 0; } bool ContractionState::GetExpanded(int lineDoc) const { - if (size == 0) + if (OneToOne()) { return true; - if ((lineDoc >= 0) && (lineDoc < linesInDoc)) { - return lines[lineDoc].expanded; } else { - return false; + Check(); + return expanded->ValueAt(lineDoc) == 1; } } -bool ContractionState::SetExpanded(int lineDoc, bool expanded) { - if (size == 0) { - if (expanded) { - // If in completely expanded state then setting - // one line to expanded has no effect. +bool ContractionState::SetExpanded(int lineDoc, bool expanded_) { + if (OneToOne() && expanded_) { + return false; + } else { + EnsureData(); + if (expanded_ != (expanded->ValueAt(lineDoc) == 1)) { + expanded->SetValueAt(lineDoc, expanded_ ? 1 : 0); + Check(); + return true; + } else { + Check(); return false; } - Grow(linesInDoc + growSize); } - if ((lineDoc >= 0) && (lineDoc < linesInDoc)) { - if (lines[lineDoc].expanded != expanded) { - lines[lineDoc].expanded = expanded; - return true; - } - } - return false; } int ContractionState::GetHeight(int lineDoc) const { - if (size == 0) + if (OneToOne()) { return 1; - if ((lineDoc >= 0) && (lineDoc < linesInDoc)) { - return lines[lineDoc].height; } else { - return 1; + return heights->ValueAt(lineDoc); } } // Set the number of display lines needed for this line. // Return true if this is a change. bool ContractionState::SetHeight(int lineDoc, int height) { - if (lineDoc > linesInDoc) + if (OneToOne() && (height == 1)) { return false; - if (size == 0) { - if (height == 1) { - // If in completely expanded state then all lines - // assumed to have height of one so no effect here. + } else { + EnsureData(); + if (GetHeight(lineDoc) != height) { + if (GetVisible(lineDoc)) { + displayLines->InsertText(lineDoc, height - GetHeight(lineDoc)); + } + heights->SetValueAt(lineDoc, height); + Check(); + return true; + } else { + Check(); return false; } - Grow(linesInDoc + growSize); } - if (lines[lineDoc].height != height) { - lines[lineDoc].height = height; - valid = false; - return true; - } else { - return false; - } } void ContractionState::ShowAll() { - delete []lines; - lines = 0; - size = 0; + int lines = LinesInDoc(); + Clear(); + linesInDocument = lines; +} - delete []docLines; - docLines = 0; - sizeDocLines = 0; +// Debugging checks - linesInDisplay = linesInDoc; +void ContractionState::Check() const { +#ifdef CHECK_CORRECTNESS + for (int vline = 0;vline < LinesDisplayed(); vline++) { + const int lineDoc = DocFromDisplay(vline); + PLATFORM_ASSERT(GetVisible(lineDoc)); + } + for (int lineDoc = 0;lineDoc < LinesInDoc(); lineDoc++) { + const int displayThis = DisplayFromDoc(lineDoc); + const int displayNext = DisplayFromDoc(lineDoc + 1); + const int height = displayNext - displayThis; + PLATFORM_ASSERT(height >= 0); + if (GetVisible(lineDoc)) { + PLATFORM_ASSERT(GetHeight(lineDoc) == height); + } else { + PLATFORM_ASSERT(0 == height); + } + } +#endif } Modified: trunk/scintilla/ContractionState.h =================================================================== --- trunk/scintilla/ContractionState.h 2007-12-02 10:52:19 UTC (rev 2085) +++ trunk/scintilla/ContractionState.h 2007-12-02 11:58:17 UTC (rev 2086) @@ -1,8 +1,8 @@ // Scintilla source code edit control /** @file ContractionState.h - ** Manages visibility of lines for folding. + ** Manages visibility of lines for folding and wrapping. **/ -// Copyright 1998-2001 by Neil Hodgson <neilh(a)scintilla.org> +// Copyright 1998-2007 by Neil Hodgson <neilh(a)scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. #ifndef CONTRACTIONSTATE_H @@ -14,31 +14,21 @@ /** */ -class OneLine { -public: - int displayLine; ///< Position within set of visible lines - //int docLine; ///< Inverse of @a displayLine - int height; ///< Number of display lines needed to show all of the line - bool visible; - bool expanded; +class ContractionState { + // These contain 1 element for every document line. + RunStyles *visible; + RunStyles *expanded; + RunStyles *heights; + Partitioning *displayLines; + int linesInDocument; - OneLine(); - virtual ~OneLine() {} -}; + void EnsureData(); -/** - */ -class ContractionState { - void Grow(int sizeNew); - enum { growSize = 4000 }; - int linesInDoc; - mutable int linesInDisplay; - mutable OneLine *lines; - int size; - mutable int *docLines; - mutable int sizeDocLines; - mutable bool valid; - void MakeValid() const; + bool OneToOne() const { + // True when each document line is exactly one display line so need for + // complex data structures. + return visible == 0; + } public: ContractionState(); @@ -51,7 +41,9 @@ int DisplayFromDoc(int lineDoc) const; int DocFromDisplay(int lineDisplay) const; + void InsertLine(int lineDoc); void InsertLines(int lineDoc, int lineCount); + void DeleteLine(int lineDoc); void DeleteLines(int lineDoc, int lineCount); bool GetVisible(int lineDoc) const; @@ -64,6 +56,7 @@ bool SetHeight(int lineDoc, int height); void ShowAll(); + void Check() const; }; #ifdef SCI_NAMESPACE Modified: trunk/scintilla/Document.cxx =================================================================== --- trunk/scintilla/Document.cxx 2007-12-02 10:52:19 UTC (rev 2085) +++ trunk/scintilla/Document.cxx 2007-12-02 11:58:17 UTC (rev 2086) @@ -13,7 +13,6 @@ #include "Platform.h" #include "Scintilla.h" -#include "SVector.h" #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" @@ -113,7 +112,6 @@ int Document::AddMark(int line, int markerNum) { int prev = cb.AddMark(line, markerNum); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); - mh.line = line; NotifyModified(mh); return prev; } @@ -124,14 +122,12 @@ if (m & 1) cb.AddMark(line, i); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); - mh.line = line; NotifyModified(mh); } void Document::DeleteMark(int line, int markerNum) { cb.DeleteMark(line, markerNum); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); - mh.line = line; NotifyModified(mh); } @@ -149,11 +145,11 @@ NotifyModified(mh); } -int Document::LineStart(int line) { +int Document::LineStart(int line) const { return cb.LineStart(line); } -int Document::LineEnd(int line) { +int Document::LineEnd(int line) const { if (line == LinesTotal() - 1) { return LineStart(line + 1); } else { @@ -191,8 +187,7 @@ int prev = cb.SetLevel(line, level); if (prev != level) { DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER, - LineStart(line), 0, 0, 0); - mh.line = line; + LineStart(line), 0, 0, 0, line); mh.foldLevelNow = level; mh.foldLevelPrev = prev; NotifyModified(mh); @@ -292,6 +287,55 @@ } } +static bool IsTrailByte(int ch) { + return (ch >= 0x80) && (ch < (0x80 + 0x40)); +} + +static int BytesFromLead(int leadByte) { + if (leadByte > 0xF4) { + // Characters longer than 4 bytes not possible in current UTF-8 + return 0; + } else if (leadByte >= 0xF0) { + return 4; + } else if (leadByte >= 0xE0) { + return 3; + } else if (leadByte >= 0xC2) { + return 2; + } + return 0; +} + +bool Document::InGoodUTF8(int pos, int &start, int &end) { + int lead = pos; + while ((lead>0) && (pos-lead < 4) && IsTrailByte(static_cast<unsigned char>(cb.CharAt(lead-1)))) + lead--; + start = 0; + if (lead > 0) { + start = lead-1; + } + int leadByte = static_cast<unsigned char>(cb.CharAt(start)); + int bytes = BytesFromLead(leadByte); + if (bytes == 0) { + return false; + } else { + int trailBytes = bytes - 1; + int len = pos - lead + 1; + if (len > trailBytes) + // pos too far from lead + return false; + // Check that there are enough trails for this lead + int trail = pos + 1; + while ((trail-lead<trailBytes) && (trail < Length())) { + if (!IsTrailByte(static_cast<unsigned char>(cb.CharAt(trail)))) { + return false; + } + trail++; + } + end = start + bytes; + return true; + } +} + // Normalise a position so that it is not halfway through a two byte character. // This can occur in two situations - // When lines are terminated with \r\n pairs which should be treated as one character. @@ -318,13 +362,14 @@ if (dbcsCodePage) { if (SC_CP_UTF8 == dbcsCodePage) { unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos)); - while ((pos > 0) && (pos < Length()) && (ch >= 0x80) && (ch < (0x80 + 0x40))) { - // ch is a trail byte + int startUTF = pos; + int endUTF = pos; + if (IsTrailByte(ch) && InGoodUTF8(pos, startUTF, endUTF)) { + // ch is a trail byte within a UTF-8 character if (moveDir > 0) - pos++; + pos = endUTF; else - pos--; - ch = static_cast<unsigned char>(cb.CharAt(pos)); + pos = startUTF; } } else { // Anchor DBCS calculations at start of line because start of line can @@ -652,7 +697,7 @@ } } -int Document::GetLineIndentPosition(int line) { +int Document::GetLineIndentPosition(int line) const { if (line < 0) return 0; int pos = LineStart(line); @@ -793,7 +838,7 @@ EndUndoAction(); } -bool Document::IsWhiteLine(int line) { +bool Document::IsWhiteLine(int line) const { int currentChar = LineStart(line); int endLine = LineEnd(line); while (currentChar < endLine) { @@ -1238,7 +1283,7 @@ return substituted; } -int Document::LinesTotal() { +int Document::LinesTotal() const { return cb.Lines(); } @@ -1271,11 +1316,7 @@ void Document::SetStylingBits(int bits) { stylingBits = bits; - stylingBitsMask = 0; - for (int bit = 0; bit < stylingBits; bit++) { - stylingBitsMask <<= 1; - stylingBitsMask |= 1; - } + stylingBitsMask = (1 << stylingBits) - 1; } void Document::StartStyling(int position, char mask) { @@ -1339,13 +1380,19 @@ } } -void Document::IncrementStyleClock() { - styleClock++; - if (styleClock > 0x100000) { - styleClock = 0; +int Document::SetLineState(int line, int state) { + int statePrevious = cb.SetLineState(line, state); + if (state != statePrevious) { + DocModification mh(SC_MOD_CHANGELINESTATE, 0, 0, 0, 0, line); + NotifyModified(mh); } + return statePrevious; } +void Document::IncrementStyleClock() { + styleClock = (styleClock + 1) % 0x100000; +} + void Document::DecorationFillRange(int position, int value, int fillLength) { if (decorations.FillRange(position, value, fillLength)) { DocModification mh(SC_MOD_CHANGEINDICATOR | SC_PERFORMED_USER, @@ -1411,6 +1458,11 @@ } void Document::NotifyModified(DocModification mh) { + if (mh.modificationType & SC_MOD_INSERTTEXT) { + decorations.InsertSpace(mh.position, mh.length); + } else if (mh.modificationType & SC_MOD_DELETETEXT) { + decorations.DeleteRange(mh.position, mh.length); + } for (int i = 0; i < lenWatchers; i++) { watchers[i].watcher->NotifyModified(this, mh, watchers[i].userData); } Modified: trunk/scintilla/Document.h =================================================================== --- trunk/scintilla/Document.h 2007-12-02 10:52:19 UTC (rev 2085) +++ trunk/scintilla/Document.h 2007-12-02 11:58:17 UTC (rev 2086) @@ -138,10 +138,12 @@ int ClampPositionIntoDocument(int pos); bool IsCrLf(int pos); int LenChar(int pos); + bool InGoodUTF8(int pos, int &start, int &end); int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true); // Gateways to modifying document void ModifiedAt(int pos); + void CheckReadOnly(); bool DeleteChars(int pos, int len); bool InsertString(int position, const char *s, int insertLength); int Undo(); @@ -160,7 +162,7 @@ int GetLineIndentation(int line); void SetLineIndentation(int line, int indent); - int GetLineIndentPosition(int line); + int GetLineIndentPosition(int line) const; int GetColumn(int position); int FindColumn(int line, int column); void Indent(bool forwards, int lineBottom, int lineTop); @@ -187,8 +189,8 @@ void DeleteMarkFromHandle(int markerHandle); void DeleteAllMarks(int markerNum); int LineFromHandle(int markerHandle) { return cb.LineFromHandle(markerHandle); } - int LineStart(int line); - int LineEnd(int line); + int LineStart(int line) const; + int LineEnd(int line) const; int LineEndPosition(int position); int VCHomePosition(int position); @@ -202,13 +204,13 @@ int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false); int NextWordStart(int pos, int delta); int NextWordEnd(int pos, int delta); - int Length() { return cb.Length(); } + int Length() const { return cb.Length(); } void Allocate(int newSize) { cb.Allocate(newSize); } long FindText(int minPos, int maxPos, const char *s, bool caseSensitive, bool word, bool wordStart, bool regExp, bool posix, int *length); long FindText(int iMessage, unsigned long wParam, long lParam); const char *SubstituteByPosition(const char *text, int *length); - int LinesTotal(); + int LinesTotal() const; void ChangeCase(Range r, bool makeUpperCase); @@ -224,7 +226,7 @@ void IncrementStyleClock(); void DecorationFillRange(int position, int value, int fillLength); - int SetLineState(int line, int state) { return cb.SetLineState(line, state); } + int SetLineState(int line, int state); int GetLineState(int line) { return cb.GetLineState(line); } int GetMaxLineState() { return cb.GetMaxLineState(); } @@ -237,15 +239,13 @@ int WordPartLeft(int pos); int WordPartRight(int pos); int ExtendStyleRange(int pos, int delta, bool singleLine = false); - bool IsWhiteLine(int line); + bool IsWhiteLine(int line) const; int ParaUp(int pos); int ParaDown(int pos); int IndentSize() { return actualIndentInChars; } int BraceMatch(int position, int maxReStyle); private: - void CheckReadOnly(); - CharClassify::cc WordCharClass(unsigned char ch); bool IsWordStartAt(int pos); bool IsWordEndAt(int pos); Modified: trunk/scintilla/DocumentAccessor.cxx =================================================================== --- trunk/scintilla/DocumentAccessor.cxx 2007-12-02 10:52:19 UTC (rev 2085) +++ trunk/scintilla/DocumentAccessor.cxx 2007-12-02 11:58:17 UTC (rev 2086) @@ -13,7 +13,6 @@ #include "Platform.h" #include "PropSet.h" -#include "SVector.h" #include "Accessor.h" #include "DocumentAccessor.h" #include "SplitVector.h" Modified: trunk/scintilla/Editor.cxx =================================================================== --- trunk/scintilla/Editor.cxx 2007-12-02 10:52:19 UTC (rev 2085) +++ trunk/scintilla/Editor.cxx 2007-12-02 11:58:17 UTC (rev 2086) @@ -17,13 +17,12 @@ #endif #include "Scintilla.h" -#include "ContractionState.h" -#include "SVector.h" #include "SplitVector.h" #include "Partitioning.h" +#include "RunStyles.h" +#include "ContractionState.h" #include "CellBuffer.h" #include "KeyMap.h" -#include "RunStyles.h" #include "Indicator.h" #include "XPM.h" #include "LineMarker.h" @@ -44,9 +43,9 @@ may reasonably be deferred (not done now OR [possibly] at all) */ static bool CanDeferToLastStep(const DocModification& mh) { - if (mh.modificationType & (SC_MOD_BEFOREINSERT|SC_MOD_BEFOREDELETE)) + if (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) return true; // CAN skip - if (!(mh.modificationType & (SC_PERFORMED_UNDO|SC_PERFORMED_REDO))) + if (!(mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO))) return false; // MUST do if (mh.modificationType & SC_MULTISTEPUNDOREDO) return true; // CAN skip @@ -55,7 +54,7 @@ static bool CanEliminate(const DocModification& mh) { return - (mh.modificationType & (SC_MOD_BEFOREINSERT|SC_MOD_BEFOREDELETE)) != 0; + (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) != 0; } /* @@ -64,20 +63,20 @@ */ static bool IsLastStep(const DocModification& mh) { return - (mh.modificationType & (SC_PERFORMED_UNDO|SC_PERFORMED_REDO)) != 0 - && (mh.modificationType & SC_MULTISTEPUNDOREDO) != 0 - && (mh.modificationType & SC_LASTSTEPINUNDOREDO) != 0 - && (mh.modificationType & SC_MULTILINEUNDOREDO) != 0; + (mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO)) != 0 + && (mh.modificationType & SC_MULTISTEPUNDOREDO) != 0 + && (mh.modificationType & SC_LASTSTEPINUNDOREDO) != 0 + && (mh.modificationType & SC_MULTILINEUNDOREDO) != 0; } Caret::Caret() : -active(false), on(false), period(500) {} + active(false), on(false), period(500) {} Timer::Timer() : -ticking(false), ticksToWait(0), tickerID(0) {} + ticking(false), ticksToWait(0), tickerID(0) {} Idler::Idler() : -state(false), idlerID(0) {} + state(false), idlerID(0) {} static inline bool IsControlCharacter(int ch) { // iscntrl returns true for lots of chars > 127 which are displayable @@ -138,6 +137,8 @@ xCaretMargin = 50; horizontalScrollBarVisible = true; scrollWidth = 2000; + trackLineWidth = false; + lineWidthMaxSeen = 0; verticalScrollBarVisible = true; endAtLastLine = true; caretSticky = false; @@ -914,13 +915,13 @@ Point pt = LocationFromPosition(currentPos); if (pt.y < rcClient.top) { MovePositionTo(PositionFromLocation( - Point(lastXChosen, rcClient.top)), - noSel, ensureVisible); + Point(lastXChosen, rcClient.top)), + noSel, ensureVisible); } else if ((pt.y + vs.lineHeight - 1) > rcClient.bottom) { int yOfLastLineFullyDisplayed = rcClient.top + (LinesOnScreen() - 1) * vs.lineHeight; MovePositionTo(PositionFromLocation( - Point(lastXChosen, rcClient.top + yOfLastLineFullyDisplayed)), - noSel, ensureVisible); + Point(lastXChosen, rcClient.top + yOfLastLineFullyDisplayed)), + noSel, ensureVisible); } } @@ -1205,7 +1206,7 @@ xOffset = xOffsetNew; if (xOffsetNew > 0) { PRectangle rcText = GetTextRectangle(); - if (horizontalScrollBarVisible == true && + if (horizontalScrollBarVisible && rcText.Width() + xOffset > scrollWidth) { scrollWidth = xOffset + rcText.Width(); SetScrollBars(); @@ -1262,6 +1263,16 @@ } } +bool Editor::WrapOneLine(Surface *surface, int lineToWrap) { + AutoLineLayout ll(llc, RetrieveLineLayout(lineToWrap)); + int linesWrapped = 1; + if (ll) { + LayoutLine(lineToWrap, surface, vs, ll, wrapWidth); + linesWrapped = ll->lines; + } + return cs.SetHeight(lineToWrap, linesWrapped); +} + // Check if wrapping needed and perform any needed wrapping. // fullwrap: if true, all lines which need wrapping will be done, // in this single call. @@ -1283,9 +1294,9 @@ } } if (!fullWrap && priorityWrapLineStart >= 0 && - // .. and if the paint window is outside pending wraps - (((priorityWrapLineStart + linesInOneCall) < wrapStart) || - (priorityWrapLineStart > wrapEnd))) { + // .. and if the paint window is outside pending wraps + (((priorityWrapLineStart + linesInOneCall) < wrapStart) || + (priorityWrapLineStart > wrapEnd))) { // No priority wrap pending return false; } @@ -1338,13 +1349,7 @@ // Platform::DebugPrintf("Wraplines: full = %d, priorityStart = %d (wrapping: %d to %d)\n", fullWrap, priorityWrapLineStart, lineToWrap, lastLineToWrap); // Platform::DebugPrintf("Pending wraps: %d to %d\n", wrapStart, wrapEnd); while (lineToWrap < lastLineToWrap) { - AutoLineLayout ll(llc, RetrieveLineLayout(lineToWrap)); - int linesWrapped = 1; - if (ll) { - LayoutLine(lineToWrap, surface, vs, ll, wrapWidth); - linesWrapped = ll->lines; - } - if (cs.SetHeight(lineToWrap, linesWrapped)) { + if (WrapOneLine(surface, lineToWrap)) { wrapOccurred = true; } lineToWrap++; @@ -1423,7 +1428,7 @@ LayoutLine(line, surface, vs, ll, pixelWidth); for (int subLine = 1; subLine < ll->lines; subLine++) { pdoc->InsertCString(posLineStart + (subLine - 1) * strlen(eol) + - ll->LineStart(subLine), eol); + ll->LineStart(subLine), eol); targetEnd += static_cast<int>(strlen(eol)); } } @@ -1524,9 +1529,9 @@ // Old code does not know about new markers needed to distinguish all cases int folderOpenMid = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEROPENMID, - SC_MARKNUM_FOLDEROPEN); + SC_MARKNUM_FOLDEROPEN); int folderEnd = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEREND, - SC_MARKNUM_FOLDER); + SC_MARKNUM_FOLDER); while ((visibleLine < cs.LinesDisplayed()) && yposScreen < rcMargin.bottom) { @@ -1611,11 +1616,11 @@ if (foldFlags & SC_FOLDFLAG_LEVELNUMBERS) { int lev = pdoc->GetLevel(lineDoc); sprintf(number, "%c%c %03X %03X", - (lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_', - (lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_', - lev & SC_FOLDLEVELNUMBERMASK, - lev >> 16 - ); + (lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_', + (lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_', + lev & SC_FOLDLEVELNUMBERMASK, + lev >> 16 + ); } PRectangle rcNumber = rcMarker; // Right justify @@ -1623,9 +1628,9 @@ int xpos = rcNumber.right - width - 3; rcNumber.left = xpos; surface->DrawTextNoClip(rcNumber, vs.styles[STYLE_LINENUMBER].font, - rcNumber.top + vs.maxAscent, number, istrlen(number), - vs.styles[STYLE_LINENUMBER].fore.allocated, - vs.styles[STYLE_LINENUMBER].back.allocated); + rcNumber.top + vs.maxAscent, number, istrlen(number), + vs.styles[STYLE_LINENUMBER].fore.allocated, + vs.styles[STYLE_LINENUMBER].back.allocated); } if (marks) { @@ -1675,10 +1680,65 @@ PLATFORM_ASSERT(posLineEnd >= posLineStart); int lineCaret = pdoc->LineFromPosition(currentPos); return llc.Retrieve(lineNumber, lineCaret, - posLineEnd - posLineStart, pdoc->GetStyleClock(), - LinesOnScreen() + 1, pdoc->LinesTotal()); + posLineEnd - posLineStart, pdoc->GetStyleClock(), + LinesOnScreen() + 1, pdoc->LinesTotal()); } +static bool GoodTrailByte(int v) { + return (v >= 0x80) && (v < 0xc0); +} + +bool BadUTF(const char *s, int len, int &trailBytes) { + if (trailBytes) { + trailBytes--; + return false; + } + const unsigned char *us = reinterpret_cast<const unsigned char *>(s); + if (*us < 0x80) { + // Single bytes easy + return false; + } else if (*us > 0xF4) { + // Characters longer than 4 bytes not possible in current UTF-8 + return true; + } else if (*us >= 0xF0) { + // 4 bytes + if (len < 4) + return true; + if (GoodTrailByte(us[1]) && GoodTrailByte(us[2]) && GoodTrailByte(us[3])) { + trailBytes = 3; + return false; + } else { + return true; + } + } else if (*us >= 0xE0) { + // 3 bytes + if (len < 3) + return true; + if (GoodTrailByte(us[1]) && GoodTrailByte(us[2])) { + trailBytes = 2; + return false; + } else { + return true; + } + } else if (*us >= 0xC2) { + // 2 bytes + if (len < 2) + return true; + if (GoodTrailByte(us[1])) { + trailBytes = 1; + return false; + } else { + return true; + } + } else if (*us >= 0xC0) { + // Overlong encoding + return true; + } else { + // Trail byte + return true; + } +} + /** * Fill in the LineLayout data for the given line. * Copy the given @a line and its styles from the document into local arrays. @@ -1717,18 +1777,18 @@ char chDoc = pdoc->CharAt(charInDoc); styleByte = pdoc->StyleAt(charInDoc); allSame = allSame && - (ll->styles[numCharsInLine] == static_cast<unsigned char>(styleByte & styleMask)); + (ll->styles[numCharsInLine] == static_cast<unsigned char>(styleByte & styleMask)); allSame = allSame && - (ll->indicators[numCharsInLine] == static_cast<char>(styleByte & ~styleMask)); + (ll->indicators[numCharsInLine] == static_cast<char>(styleByte & ~styleMask)); if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseMixed) allSame = allSame && - (ll->chars[numCharsInLine] == chDoc); + (ll->chars[numCharsInLine] == chDoc); else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower) allSame = allSame && - (ll->chars[numCharsInLine] == static_cast<char>(tolower(chDoc))); + (ll->chars[numCharsInLine] == static_cast<char>(tolower(chDoc))); else // Style::caseUpper allSame = allSame && - (ll->chars[numCharsInLine] == static_cast<char>(toupper(chDoc))); + (ll->chars[numCharsInLine] == static_cast<char>(toupper(chDoc))); numCharsInLine++; } allSame = allSame && (ll->styles[numCharsInLine] == styleByte); // For eolFilled @@ -1790,31 +1850,40 @@ int ctrlCharWidth[32] = {0}; bool isControlNext = IsControlCharacter(ll->chars[0]); + int trailBytes = 0; + bool isBadUTFNext = IsUnicodeMode() && BadUTF(ll->chars, numCharsInLine, trailBytes); for (int charInLine = 0; charInLine < numCharsInLine; charInLine++) { bool isControl = isControlNext; isControlNext = IsControlCharacter(ll->chars[charInLine + 1]); + bool isBadUTF = isBadUTFNext; + isBadUTFNext = IsUnicodeMode() && BadUTF(ll->chars + charInLine + 1, numCharsInLine - charInLine - 1, trailBytes); if ((ll->styles[charInLine] != ll->styles[charInLine + 1]) || - isControl || isControlNext) { + isControl || isControlNext || isBadUTF || isBadUTFNext) { ll->positions[startseg] = 0; if (vstyle.styles[ll->styles[charInLine]].visible) { if (isControl) { if (ll->chars[charInLine] == '\t') { ll->positions[charInLine + 1] = ((((startsegx + 2) / - tabWidth) + 1) * tabWidth) - startsegx; + tabWidth) + 1) * tabWidth) - startsegx; } else if (controlCharSymbol < 32) { if (ctrlCharWidth[ll->chars[charInLine]] == 0) { const char *ctrlChar = ControlCharacterString(ll->chars[charInLine]); // +3 For a blank on front and rounded edge each side: ctrlCharWidth[ll->chars[charInLine]] = - surface->WidthText(ctrlCharsFont, ctrlChar, istrlen(ctrlChar)) + 3; + surface->WidthText(ctrlCharsFont, ctrlChar, istrlen(ctrlChar)) + 3; } ll->positions[charInLine + 1] = ctrlCharWidth[ll->chars[charInLine]]; } else { char cc[2] = { static_cast<char>(controlCharSymbol), '\0' }; surface->MeasureWidths(ctrlCharsFont, cc, 1, - ll->positions + startseg + 1); + ll->positions + startseg + 1); } lastSegItalics = false; + } else if (isBadUTF) { + char hexits[3]; + sprintf(hexits, "%2X", ll->chars[charInLine] & 0xff); + ll->positions[charInLine + 1] = + surface->WidthText(ctrlCharsFont, hexits, istrlen(hexits)) + 3; } else { // Regular character int lenSeg = charInLine - startseg + 1; if ((lenSeg == 1) && (' ' == ll->chars[startseg])) { @@ -1824,7 +1893,7 @@ } else { lastSegItalics = vstyle.styles[ll->styles[charInLine]].italic; posCache.MeasureWidths(surface, vstyle, ll->styles[charInLine], ll->chars + startseg, - lenSeg, ll->positions + startseg + 1); + lenSeg, ll->positions + startseg + 1); } } } else { // invisible @@ -1873,12 +1942,12 @@ // Try moving to start of last character if (p > 0) { lastGoodBreak = pdoc->MovePositionOutsideChar(p + posLineStart, -1) - - posLineStart; + - posLineStart; } if (lastGoodBreak == lastLineStart) { // Ensure at least one character on line. lastGoodBreak = pdoc->MovePositionOutsideChar(lastGoodBreak + posLineStart + 1, 1) - - posLineStart; + - posLineStart; } } lastLineStart = lastGoodBreak; @@ -1893,7 +1962,7 @@ if (p > 0) { if (wrapState == eWrapChar) { lastGoodBreak = pdoc->MovePositionOutsideChar(p + posLineStart, -1) - - posLineStart; + - posLineStart; p = pdoc->MovePositionOutsideChar(p + 1 + posLineStart, 1) - posLineStart; continue; } else if (ll->styles[p] != ll->styles[p - 1]) { @@ -1915,7 +1984,7 @@ } ColourAllocated Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackground, - ColourAllocated background, bool inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) { + ColourAllocated background, bool inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) { if (inSelection) { if (vsDraw.selbackset && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) { return SelectionBackground(vsDraw); @@ -1937,11 +2006,11 @@ Point from(0, ((lineVisible & 1) && (lineHeight & 1)) ? 1 : 0); PRectangle rcCopyArea(start + 1, rcSegment.top, start + 2, rcSegment.bottom); surface->Copy(rcCopyArea, from, - highlight ? *pixmapIndentGuideHighlight : *pixmapIndentGuide); + highlight ? *pixmapIndentGuideHighlight : *pixmapIndentGuide); } void Editor::DrawWrapMarker(Surface *surface, PRectangle rcPlace, - bool isEndMarker, ColourAllocated wrapColour) { + bool isEndMarker, ColourAllocated wrapColour) { surface->PenColour(wrapColour); enum { xa = 1 }; // gap before start @@ -1964,10 +2033,10 @@ int yBase; int yDir; void MoveTo(int xRelative, int yRelative) { - surface->MoveTo(xBase + xDir * xRelative, yBase + yDir * yRelative); + surface->MoveTo(xBase + xDir * xRelative, yBase + yDir * yRelative); } void LineTo(int xRelative, int yRelative) { - surface->LineTo(xBase + xDir * xRelative, yBase + yDir * yRelative); + surface->LineTo(xBase + xDir * xRelative, yBase + yDir * yRelative); } }; Relative rel = {surface, x0, xStraight ? 1 : -1, y0, yStraight ? 1 : -1}; @@ -1983,7 +2052,7 @@ rel.LineTo(xa + w, y); rel.LineTo(xa + w, y - 2 * dy); rel.LineTo(xa - 1, // on windows lineto is exclusive endpoint, perhaps GTK not... - y - 2 * dy); + y - 2 * dy); } static void SimpleAlphaRectangle(Surface *surface, PRectangle rc, ColourAllocated fill, int alpha) { @@ -1993,9 +2062,9 @@ } void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll, - int line, int lineEnd, int xStart, int subLine, int subLineStart, - bool overrideBackground, ColourAllocated background, - bool drawWrapMarkEnd, ColourAllocated wrapColour) { + int line, int lineEnd, int xStart, int subLine, int subLineStart, + bool overrideBackground, ColourAllocated background, + bool drawWrapMarkEnd, ColourAllocated wrapColour) { int styleMask = pdoc->stylingBitsMask; PRectangle rcSegment = rcLine; @@ -2006,7 +2075,7 @@ rcSegment.right = xEol + vsDraw.aveCharWidth + xStart; int posLineEnd = pdoc->LineStart(line + 1); bool eolInSelection = (subLine == (ll->lines - 1)) && - (posLineEnd > ll->selStart) && (posLineEnd <= ll->selEnd) && (ll->selStart != ll->selEnd); + (posLineEnd > ll->selStart) && (posLineEnd <= ll->selEnd) && (ll->selStart != ll->selEnd); if (eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) { surface->FillRectangle(rcSegment, SelectionBackground(vsDraw)); @@ -2044,7 +2113,7 @@ if (vsDraw.selEOLFilled && eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha != SC_ALPHA_NOALPHA)) { SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw), vsDraw.selAlpha); } - } + } if (drawWrapMarkEnd) { PRectangle rcPlace = rcSegment; @@ -2062,7 +2131,7 @@ } void Editor::DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int xStart, - PRectangle rcLine, LineLayout *ll, int subLine, int lineEnd, bool under) { + PRectangle rcLine, LineLayout *ll, int subLine, int lineEnd, bool under) { // Draw decorators const int posLineStart = pdoc->LineStart(line); const int lineStart = ll->LineStart(subLine); @@ -2092,10 +2161,10 @@ if (indicPos >= lineEnd || !(ll->indicators[indicPos] & mask)) { // AT end of indicator run, DRAW it! PRectangle rcIndic( - ll->positions[startPos] + xStart - subLineStart, - rcLine.top + vsDraw.maxAscent, - ll->positions[indicPos] + xStart - subLineStart, - rcLine.top + vsDraw.maxAscent + 3); + ll->positions[startPos] + xStart - subLineStart, + rcLine.top + vsDraw.maxAscent, + ll->positions[indicPos] + xStart - subLineStart, + rcLine.top + vsDraw.maxAscent + 3); vsDraw.indicators[indicnum].Draw(surface, rcIndic, rcLine); // RESET control var startPos = -1; @@ -2106,9 +2175,9 @@ } } - for (Decoration *deco=pdoc->decorations.root; deco; deco = deco->next) { + for (Decoration *deco = pdoc->decorations.root; deco; deco = deco->next) { if (under == vsDraw.indicators[deco->indicator].under) { - int startPos = posLineStart + subLineStart; + int startPos = posLineStart + lineStart; if (!deco->rs.ValueAt(startPos)) { startPos = deco->rs.EndRun(startPos); } @@ -2117,10 +2186,10 @@ if (endPos > posLineEnd) endPos = posLineEnd; PRectangle rcIndic( - ll->positions[startPos - posLineStart] + xStart - subLineStart, - rcLine.top + vsDraw.maxAscent, - ll->positions[endPos - posLineStart] + xStart - subLineStart, - rcLine.top + vsDraw.maxAscent + 3); + ll->positions[startPos - posLineStart] + xStart - subLineStart, + rcLine.top + vsDraw.maxAscent, + ll->positions[endPos - posLineStart] + xStart - subLineStart, + rcLine.top + vsDraw.maxAscent + 3); vsDraw.indicators[deco->indicator].Draw(surface, rcIndic, rcLine); startPos = deco->rs.EndRun(endPos); } @@ -2128,8 +2197,32 @@ } } +void DrawTextBlob(Surface *surface, ViewStyle &vsDraw, PRectangle rcSegment, + const char *s, ColourAllocated textBack, ColourAllocated textFore, bool twoPhaseDraw) { + if (!twoPhaseDraw) { + surface->FillRectangle(rcSegment, textBack); + } + Font &ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font; + int normalCharHeight = surface->Ascent(ctrlCharsFont) - + surface->InternalLeading(ctrlCharsFont); + PRectangle rcCChar = rcSegment; + rcCChar.left = rcCChar.left + 1; + rcCChar.top = rcSegment.top + vsDraw.maxAscent - normalCharHeight; + rcCChar.bottom = rcSegment.top + vsDraw.maxAscent + 1; + PRectangle rcCentral = rcCChar; + rcCentral.top++; + rcCentral.bottom--; + surface->FillRectangle(rcCentral, textFore); + PRectangle rcChar = rcCChar; + rcChar.left++; + rcChar.right--; + surface->DrawTextClipped(rcChar, ctrlCharsFont, + rcSegment.top + vsDraw.maxAscent, s, istrlen(s), + textBack, textFore); +} + void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart, - PRectangle rcLine, LineLayout *ll, int subLine) { + PRectangle rcLine, LineLayout *ll, int subLine) { PRectangle rcSegment = rcLine; @@ -2154,7 +2247,7 @@ int marks = pdoc->GetMark(line); for (int markBit = 0; (markBit < 32) && marks; markBit++) { if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) && - (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) { + (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) { background = vsDraw.markers[markBit].back.allocated; overrideBackground = true; } @@ -2167,7 +2260,7 @@ if (marksMasked) { for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) { if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY) && - (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) { + (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) { overrideBackground = true; background = vsDraw.markers[markBit].back.allocated; } @@ -2178,7 +2271,7 @@ } bool drawWhitespaceBackground = (vsDraw.viewWhitespace != wsInvisible) && - (!overrideBackground) && (vsDraw.whitespaceBackgroundSet); + (!overrideBackground) && (vsDraw.whitespaceBackgroundSet); bool inIndentation = subLine == 0; // Do not handle indentation except on first subline. int indentWidth = pdoc->IndentSize() * vsDraw.spaceWidth; @@ -2222,7 +2315,7 @@ // default bgnd here.. surface->FillRectangle(rcSegment, overrideBackground ? background : - vsDraw.styles[STYLE_DEFAULT].back.allocated); + vsDraw.styles[STYLE_DEFAULT].back.allocated); // main line style would be below but this would be inconsistent with end markers // also would possibly not be the style at wrap point @@ -2246,7 +2339,7 @@ // Does not take margin into account but not significant int xStartVisible = subLineStart - xStart; - BreakFinder bfBack(ll, lineStart, lineEnd, posLineStart, xStartVisible); + BreakFinder bfBack(ll, lineStart, lineEnd, posLineStart, IsUnicodeMode(), xStartVisible); int next = bfBack.First(); // Background drawing loop @@ -2284,13 +2377,13 @@ // Normal text display surface->FillRectangle(rcSegment, textBack); if (vsDraw.viewWhitespace != wsInvisible || - (inIndentation && vsDraw.viewIndentationGuides)) { + (inIndentation && vsDraw.viewIndentationGuides == ivReal)) { for (int cpos = 0; cpos <= i - startseg; cpos++) { if (ll->chars[cpos + startseg] == ' ') { if (drawWhitespaceBackground && (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) { PRectangle rcSpace(ll->positions[cpos + startseg] + xStart, rcSegment.top, - ll->positions[cpos + startseg + 1] + xStart, rcSegment.bottom); + ll->positions[cpos + startseg + 1] + xStart, rcSegment.bottom); surface->FillRectangle(rcSpace, vsDraw.whitespaceBackground.allocated); } } else { @@ -2321,7 +2414,7 @@ inIndentation = subLine == 0; // Do not handle indentation except on first subline. // Foreground drawing loop - BreakFinder bfFore(ll, lineStart, lineEnd, posLineStart, xStartVisible); + BreakFinder bfFore(ll, lineStart, lineEnd, posLineStart, IsUnicodeMode(), xStartVisible); next = bfFore.First(); while (next < lineEnd) { @@ -2359,23 +2452,24 @@ textBack = vsDraw.whitespaceBackground.allocated; surface->FillRectangle(rcSegment, textBack); } - if ((vsDraw.viewWhitespace != wsInvisible) || ((inIndentation && vsDraw.viewIndentationGuides))) { + if ((vsDraw.viewWhitespace != wsInvisible) || + (inIndentation && vsDraw.viewIndentationGuides != ivNone)) { if (vsDraw.whitespaceForegroundSet) textFore = vsDraw.whitespaceForeground.allocated; surface->PenColour(textFore); } - if (inIndentation && vsDraw.viewIndentationGuides) { + if (inIndentation && vsDraw.viewIndentationGuides == ivReal) { for (int xIG = ll->positions[i] / indentWidth * indentWidth; xIG < ll->positions[i + 1]; xIG += indentWidth) { if (xIG >= ll->positions[i] && xIG > 0) { DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIG + xStart, rcSegment, - (ll->xHighlightGuide == xIG)); + (ll->xHighlightGuide == xIG)); } } } if (vsDraw.viewWhitespace != wsInvisible) { if (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways) { PRectangle rcTab(rcSegment.left + 1, rcSegment.top + 4, - rcSegment.right - 1, rcSegment.bottom - vsDraw.maxDescent); + rcSegment.right - 1, rcSegment.bottom - vsDraw.maxDescent); DrawTabArrow(surface, rcTab, rcSegment.top + vsDraw.lineHeight / 2); } } @@ -2385,46 +2479,32 @@ if (controlCharSymbol < 32) { // Draw the character const char *ctrlChar = ControlCharacterString(ll->chars[i]); - if (!twoPhaseDraw) { - surface->FillRectangle(rcSegment, textBack); - } - int normalCharHeight = surface->Ascent(ctrlCharsFont) - - surface->InternalLeading(ctrlCharsFont); - PRectangle rcCChar = rcSegment; - rcCChar.left = rcCChar.left + 1; - rcCChar.top = rcSegment.top + vsDraw.maxAscent - normalCharHeight; - rcCChar.bottom = rcSegment.top + vsDraw.maxAscent + 1; - PRectangle rcCentral = rcCChar; - rcCentral.top++; - rcCentral.bottom--; - surface->FillRectangle(rcCentral, textFore); - PRectangle rcChar = rcCChar; - rcChar.left++; - rcChar.right--; - surface->DrawTextClipped(rcChar, ctrlCharsFont, - rcSegment.top + vsDraw.maxAscent, ctrlChar, istrlen(ctrlChar), - textBack, textFore); + DrawTextBlob(surface, vsDraw, rcSegment, ctrlChar, textBack, textFore, twoPhaseDraw); } else { char cc[2] = { static_cast<char>(controlCharSymbol), '\0' }; surface->DrawTextNoClip(rcSegment, ctrlCharsFont, - rcSegment.top + vsDraw.maxAscent, - cc, 1, textBack, textFore); + rcSegment.top + vsDraw.maxAscent, + cc, 1, textBack, textFore); } + } else if ((i == startseg) && (static_cast<unsigned char>(ll->chars[i]) >= 0x80) && IsUnicodeMode()) { + char hexits[3]; + sprintf(hexits, "%2X", ll->chars[i] & 0xff); + DrawTextBlob(surface, vsDraw, rcSegment, hexits, textBack, textFore, twoPhaseDraw); } else { // Normal text display if (vsDraw.styles[styleMain].visible) { if (twoPhaseDraw) { surface->DrawTextTransparent(rcSegment, textFont, - rcSegment.top + vsDraw.maxAscent, ll->chars + startseg, - i - startseg + 1, textFore); + rcSegment.top + vsDraw.maxAscent, ll->chars + startseg, + i - startseg + 1, textFore); } else { surface->DrawTextNoClip(rcSegment, textFont, - rcSegment.top + vsDraw.maxAscent, ll->chars + startseg, - i - startseg + 1, textFore, textBack); + rcSegment.top + vsDraw.maxAscent, ll->chars + startseg, + i - startseg + 1, textFore, textBack); } } if (vsDraw.viewWhitespace != wsInvisible || - (inIndentation && vsDraw.viewIndentationGuides)) { + (inIndentation && vsDraw.viewIndentationGuides != ivNone)) { for (int cpos = 0; cpos <= i - startseg; cpos++) { if (ll->chars[cpos + startseg] == ' ') { if (vsDraw.viewWhitespace != wsInvisible) { @@ -2444,11 +2524,11 @@ surface->FillRectangle(rcDot, textFore); } } - if (inIndentation && vsDraw.viewIndentationGuides) { + if (inIndentation && vsDraw.viewIndentationGuides == ivReal) { int startSpace = ll->positions[cpos + startseg]; if (startSpace > 0 && (startSpace % indentWidth == 0)) { DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, startSpace + xStart, rcSegment, - (ll->xHighlightGuide == ll->positions[cpos + startseg])); + (ll->xHighlightGuide == ll->positions[cpos + startseg])); } } } else { @@ -2475,7 +2555,50 @@ break; } } + if ((vsDraw.viewIndentationGuides == ivLookForward || vsDraw.viewIndentationGuides == ivLookBoth) + && (subLine == 0)) { + int indentSpace = pdoc->GetLineIndentation(line); + // Find the most recent line with some text + int lineLastWithText = line; + while (lineLastWithText > 0 && pdoc->IsWhiteLine(lineLastWithText)) { + lineLastWithText--; + } + if (lineLastWithText < line) { + // This line is empty, so use indentation of last line with text + int indentLastWithText = pdoc->GetLineIndentation(lineLastWithText); + int isFoldHeader = pdoc->GetLevel(lineLastWithText) & SC_FOLDLEVELHEADERFLAG; + if (isFoldHeader) { + // Level is one more level than parent + indentLastWithText += pdoc->IndentSize(); + } + if (vsDraw.viewIndentationGuides == ivLookForward) { + // In viLookForward mode, previous line only used if it is a fold header + if (isFoldHeader) { + indentSpace = Platform::Maximum(indentSpace, indentLastWithText); + } + } else { // viLookBoth + indentSpace = Platform::Maximum(indentSpace, indentLastWithText); + } + } + + int lineNextWithText = line; + while (lineNextWithText < pdoc->LinesTotal() && pdoc->IsWhiteLine(lineNextWithText)) { + lineNextWithText++; + } + if (lineNextWithText > line) { + // This line is empty, so use indentation of last line with text + indentSpace = Platform::Maximum(indentSpace, + pdoc->GetLineIndentation(lineNextWithText)); + } + + for (int indentPos = pdoc->IndentSize(); indentPos < indentSpace; indentPos += pdoc->IndentSize()) { + int xIndent = indentPos * vsDraw.spaceWidth; + DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcSegment, + (ll->xHighlightGuide == xIndent)); + } + } + DrawIndicators(surface, vsDraw, line, xStart, rcLine, ll, subLine, lineEnd, false); // End of the drawing of the current line @@ -2526,7 +2649,7 @@ int lineStart = ll->LineStart(subLine); int posBefore = posCaret; - int posAfter = MovePositionOutsideChar(posCaret+1, 1); + int posAfter = MovePositionOutsideChar(posCaret + 1, 1); int numCharsToDraw = posAfter - posCaret; // Work out where the starting and ending offsets are. We need to @@ -2541,7 +2664,7 @@ } // Char shares horizontal space, update the numChars to draw // Update posBefore to point to the prev char - posBefore = MovePositionOutsideChar(posBefore-1, -1); + posBefore = MovePositionOutsideChar(posBefore - 1, -1); numCharsToDraw = posAfter - posBefore; offsetFirstChar = offset - (posCaret - posBefore); } @@ -2554,7 +2677,7 @@ // the next character ends, and 2nd next begins. We'll need // to compare these two posBefore = posAfter; - posAfter = MovePositionOutsideChar(posAfter+1, 1); + posAfter = MovePositionOutsideChar(posAfter + 1, 1); offsetLastChar = offset + (posAfter - posCaret); if ((ll->positions[offsetLastChar] - ll->positions[offsetLastChar - (posAfter - posBefore)]) > 0) { // The char does not share horizontal space @@ -2572,9 +2695,9 @@ // (inversed) for drawing the caret here. int styleMain = ll->styles[offsetFirstChar]; surface->DrawTextClipped(rcCaret, vsDraw.styles[styleMain].font, - rcCaret.top + vsDraw.maxAscent, ll->chars + offsetFirstChar, - numCharsToDraw, vsDraw.styles[styleMain].back.allocated, - vsDraw.caretcolour.allocated); + rcCaret.top + vsDraw.maxAscent, ll->chars + offsetFirstChar, + numCharsToDraw, vsDraw.styles[styleMain].back.allocated, + vsDraw.caretcolour.allocated); } void Editor::RefreshPixMaps(Surface *surfaceWindow) { @@ -2636,9 +2759,9 @@ if (!pixmapLine->Initialised()) { PRectangle rcClient = GetClientRectangle(); pixmapLine->InitPixMap(rcClient.Width(), vs.lineHeight, - surfaceWindow, wMain.GetID()); + surfaceWindow, wMain.GetID()); pixmapSelMargin->InitPixMap(vs.fixedColumnWidth, - rcClient.Height(), surfaceWindow, wMain.GetID()); + rcClient.Height(), surfaceWindow, wMain.GetID()); } } } @@ -2799,7 +2922,7 @@ Range rangeLine(pdoc->LineStart(lineDoc), pdoc->LineStart(lineDoc + 1)); // Highlight the current braces if any ll->SetBracesHighlight(rangeLine, braces, static_cast<char>(bracesMatchStyle), - highlightGuideColumn * vs.spaceWidth); + highlightGuideColumn * vs.spaceWidth); // Draw the line DrawLine(surface, vs, lineDoc, visibleLine, xStart, rcLine, ll, subLine); @@ -2869,8 +2992,7 @@ // Draw the Caret if (lineDoc == lineCaret) { int offset = Platform::Minimum(posCaret - rangeLine.start, ll->maxLineLength); - if ((offset >= ll->LineStart(subLine)) && - ((offset < ll->LineStart(subLine + 1)) || offset == ll->numCharsInLine)) { + if (ll->InLine(offset, subLine)) { int xposCaret = ll->positions[offset] - ll->positions[ll->LineStart(subLine)] + xStart; if (actualWrapVisualStartIndent != 0) { @@ -2879,7 +3001,7 @@ xposCaret += actualWrapVisualStartIndent * vs.aveCharWidth; } if ((xposCaret >= 0) && (vs.caretWidth > 0) && (vs.caretStyle != CARETSTYLE_INVISIBLE) && - ((posDrag >= 0) || (caret.active && caret.on))) { + ((posDrag >= 0) || (caret.active && caret.on))) { bool caretAtEOF = false; bool caretAtEOL = false; bool drawBlockCaret = false; @@ -2899,7 +3021,7 @@ if (widthOverstrikeCaret < 3) // Make sure its visible widthOverstrikeCaret = 3; - if (offset > 0) + if (offset > ll->LineStart(subLine)) caretWidthOffset = 1; // Move back so overlaps both character cells. if (posDrag >= 0) { /* Dragging text, use a line caret */ @@ -2936,7 +3058,7 @@ if (bufferedDraw) { Point from(vs.fixedColumnWidth, 0); PRectangle rcCopyArea(vs.fixedColumnWidth, yposScreen, - rcClient.right, yposScreen + vs.lineHeight); + rcClient.right, yposScreen + vs.lineHeight); surfaceWindow->Copy(rcCopyArea, from, *pixmapLine); } //durCopy += et.Duration(true); @@ -2948,6 +3070,9 @@ yposScreen += vs.lineHeight; visibleLine++; + + lineWidthMaxSeen = Platform::Maximum( + lineWidthMaxSeen, ll->positions[ll->numCharsInLine]); //gdk_flush(); } ll.Set(0); @@ -3025,7 +3150,7 @@ vsPrint.showMarkedLines = false; vsPrint.fixedColumnWidth = 0; vsPrint.zoomLevel = printMagnification; - vsPrint.viewIndentationGuides = false; + vsPrint.viewIndentationGuides = ivNone; // Don't show the selection when printing vsPrint.selbackset = false; vsPrint.selforeset = false; @@ -3035,7 +3160,7 @@ vsPrint.showCaretLineBackground = false; // Set colours for printing according to users settings - for (int sty = 0;sty <= STYLE_MAX;sty++) { + for (size_t sty = 0;sty < vsPrint.stylesSize;sty++) { if (printColourMode == SC_PRINT_INVERTLIGHT) { vsPrint.styles[sty].fore.desired = InvertedLight(vsPrint.styles[sty].fore.desired); vsPrint.styles[sty].back.desired = InvertedLight(vsPrint.styles[sty].back.desired); @@ -3058,7 +3183,7 @@ int lineNumberWidth = 0; if (lineNumberIndex >= 0) { lineNumberWidth = surfaceMeasure->WidthText(vsPrint.styles[STYLE_LINENUMBER].font, - "99999" lineNumberPrintSpace, 5 + istrlen(lineNumberPrintSpace)); + "99999" lineNumberPrintSpace, 5 + istrlen(lineNumberPrintSpace)); vsPrint.ms[lineNumberIndex].width = lineNumberWidth; vsPrint.Refresh(*surfaceMeasure); // Recalculate fixedColumnWidth } @@ -3142,12 +3267,12 @@ rcNumber.right = rcNumber.left + lineNumberWidth; // Right justify rcNumber.left = rcNumber.right - surfaceMeasure->WidthText( - vsPrint.styles[STYLE_LINENUMBER].font, number, istrlen(number)); + vsPrint.styles[STYLE_LINENUMBER].font, number, istrlen(number)); surface->FlushCachedState(); surface->DrawTextNoClip(rcNumber, vsPrint.styles[STYLE_LINENUMBER].font, - ypos + vsPrint.maxAscent, number, istrlen(number), - vsPrint.styles[STYLE_LINENUMBER].fore.allocated, - vsPrint.styles[STYLE_LINENUMBER].back.allocated); + ypos + vsPrint.maxAscent, number, istrlen(number), + vsPrint.styles[STYLE_LINENUMBER].fore.allocated, + vsPrint.styles[STYLE_LINENUMBER].back.allocated); } // Draw the line @@ -3238,6 +3363,7 @@ AddCharUTF(s, 1); } +// AddCharUTF inserts an array of bytes which may or may not be in UTF-8. void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) { bool wasSelection = currentPos != anchor; ClearSelection(); @@ -3257,6 +3383,14 @@ if (charReplaceAction) { pdoc->EndUndoAction(); } + // If in wrap mode rewrap current line so EnsureCaretVisible has accurate information + if (wrapState != eWrapNone) { + AutoSurface surface(this); + if (surface) { + WrapOneLine(surface, pdoc->LineFromPosition(currentPos)); + } + SetScrollBars(); + } EnsureCaretVisible(); // Avoid blinking during rapid typing: ShowCaretAtCurrentPosition(); @@ -3266,7 +3400,7 @@ if (treatAsDBCS) { NotifyChar((static_cast<unsigned char>(s[0]) << 8) | - static_cast<unsigned char>(s[1])); + static_cast<unsigned char>(s[1])); } else { int byte = static_cast<unsigned char>(s[0]); if ((byte < 0xC0) || (1 == len)) { @@ -3353,6 +3487,7 @@ } void Editor::Cut() { + pdoc->CheckReadOnly(); if (!pdoc->IsReadOnly() && !SelectionContainsProtected()) { Copy(); ClearSelection(); @@ -3522,7 +3657,7 @@ scn.line = LineFromLocation(pt); scn.position = PositionFromLocationClose(pt); scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | - (alt ? SCI_ALT : 0); + (alt ? SCI_ALT : 0); NotifyParent(scn); } @@ -3531,7 +3666,7 @@ scn.nmhdr.code = SCN_HOTSPOTDOUBLECLICK; scn.position = position; scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | - (alt ? SCI_ALT : 0); + (alt ? SCI_ALT : 0); NotifyParent(scn); } @@ -3540,7 +3675,7 @@ scn.nmhdr.code = SCN_HOTSPOTCLICK; scn.position = position; scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | - (alt ? SCI_ALT : 0); + (alt ? SCI_ALT : 0); NotifyParent(scn); } @@ -3580,7 +3715,7 @@ SCNotification scn = {0}; scn.nmhdr.code = SCN_MARGINCLICK; scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | - (alt ? SCI_ALT : 0); + (alt ? SCI_ALT : 0); scn.position = pdoc->LineStart(LineFromLocation(pt)); scn.margin = marginClicked; NotifyParent(scn); @@ -3632,7 +3767,7 @@ } void Editor::CheckModificationForWrap(DocModification mh) { - if (mh.modificationType & (SC_MOD_INSERTTEXT|SC_MOD_DELETETEXT)) { + if (mh.modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) { llc.Invalidate(LineLayout::llCheckTextAndStyle); if (wrapState != eWrapNone) { int lineDoc = pdoc->LineFromPosition(mh.position); @@ -3670,7 +3805,16 @@ if (paintState == painting) { CheckForChangeOutsidePaint(Range(mh.position, mh.position + mh.length)); } - if (mh.modificationType & (SC_MOD_CHANGESTYLE|SC_MOD_CHANGEINDICATOR)) { + if (mh.modificationType & SC_MOD_CHANGELINESTATE) { + if (paintState == painting) { + CheckForChangeOutsidePaint( + Range(pdoc->LineStart(mh.line), pdoc->LineStart(mh.line + 1))); + } else { + // Could check that change is before last visible line. + Redraw(); + } + } + if (mh.modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR)) { if (mh.modificationType & SC_MOD_CHANGESTYLE) { pdoc->IncrementStyleClock(); } @@ -3692,13 +3836,11 @@ anchor = MovePositionForInsertion(anchor, mh.position, mh.length); braces[0] = MovePositionForInsertion(braces[0], mh.position, mh.length); braces[1] = MovePositionForInsertion(braces[1], mh.position, mh.length); - pdoc->decorations.InsertSpace(mh.position, mh.length); } else if (mh.modificationType & SC_MOD_DELETETEXT) { currentPos = MovePositionForDeletion(currentPos, mh.position, mh.length); anchor = MovePositionForDeletion(anchor, mh.position, mh.length); braces[0] = MovePositionForDeletion(braces[0], mh.position, mh.length); braces[1] = MovePositionForDeletion(braces[1], mh.position, mh.length); - pdoc->decorations.DeleteRange(mh.position, mh.length); } if (cs.LinesDisplayed() < cs.LinesInDoc()) { // Some lines are hidden so may need shown. @@ -3768,7 +3910,7 @@ // If client wants to see this modification if (mh.modificationType & modEventMask) { - if ((mh.modificationType & (SC_MOD_CHANGESTYLE|SC_MOD_CHANGEINDICATOR)) == 0) { + if ((mh.modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR)) == 0) { // Real modification made to text of document. NotifyChange(); // Send EN_CHANGE } @@ -3896,8 +4038,8 @@ case SCI_SELECTIONDUPLICATE: break; - // Filter out all others like display changes. Also, newlines are redundant - // with char insert messages. + // Filter out all others like display changes. Also, newlines are redundant + // with char insert messages. case SCI_NEWLINE: default: // printf("Filtered out %ld of macro recording\n", iMessage); @@ -3926,9 +4068,9 @@ int currentLine = pdoc->LineFromPosition(currentPos); int topStutterLine = topLine + caretYSlop; int bottomStutterLine = - pdoc->LineFromPosition(PositionFromLocation( - Point(lastXChosen, direction * vs.lineHeight * LinesToScroll()))) - - caretYSlop - 1; + pdoc->LineFromPosition(PositionFromLocation( + Point(lastXChosen, direction * vs.lineHeight * LinesToScroll()))) + - caretYSlop - 1; if (stuttered && (direction < 0 && currentLine > topStutterLine)) { topLineNew = topLine; @@ -3942,9 +4084,9 @@ Point pt = LocationFromPosition(currentPos); topLineNew = Platform::Clamp( - topLine + direction * LinesToScroll(), 0, MaxScrollPos()); + topLine + direction * LinesToScroll(), 0, MaxScrollPos()); newPos = PositionFromLocation( - Point(lastXChosen, pt.y + direction * (vs.lineHeight * LinesToScroll()))); + Point(lastXChosen, pt.y + direction * (vs.lineHeight * LinesToScroll()))); } if (topLineNew != topLine) { @@ -3963,7 +4105,7 @@ int startAnchor = anchor; if (selType == selStream) { pdoc->ChangeCase(Range(SelectionStart(), SelectionEnd()), - makeUpperCase); + makeUpperCase); SetSelection(startCurrent, startAnchor); } else { SelectionLineIterator lineIterator(this, false); @@ -4043,6 +4185,7 @@ } } SetLastXChosen(); + SetScrollBars(); EnsureCaretVisible(); // Avoid blinking during rapid typing: ShowCaretAtCurrentPosition(); @@ -4051,7 +4194,7 @@ void Editor::CursorUpOrDown(int direction, selTypes sel) { Point pt = LocationFromPosition(currentPos); int posNew = PositionFromLocation( - Point(lastXChosen, pt.y + direction * vs.lineHeight)); + Point(lastXChosen, pt.y + direction * vs.lineHeight)); if (direction < 0) { // Line wrapping may lead to a location on the same line, so // seek back if that is the case. @@ -4264,7 +4407,7 @@ int endPos = MovePositionSoVisible(StartEndDisplayLine(currentPos, false), 1); int realEndPos = pdoc->LineEndPosition(currentPos); if (endPos > realEndPos // if moved past visible EOLs - || currentPos >= endPos) // if at end of display line already + || currentPos >= endPos) // if at end of display line already endPos = realEndPos; MovePositionTo(endPos); SetLastXChosen(); @@ -4274,7 +4417,7 @@ int endPos = MovePositionSoVisible(StartEndDisplayLine(currentPos, false), 1); int realEndPos = pdoc->LineEndPosition(currentPos); if (endPos > realEndPos // if moved past visible EOLs - || currentPos >= endPos) // if at end of display line already + || currentPos >= endPos) // if at end of display line already endPos = realEndPos; MovePositionTo(endPos, selStream); SetLastXChosen(); @@ -4449,7 +4592,7 @@ int lineStart = pdoc->LineFromPosition(SelectionStart()); int lineEnd = pdoc->LineFromPosition(SelectionEnd()); CopyRangeToClipboard(pdoc->LineStart(lineStart), - pdoc->LineStart(lineEnd + 1)); + pdoc->LineStart(lineEnd + 1)); } break; case SCI_LINECUT: { @@ -4502,22 +4645,22 @@ break; case SCI_HOMEDISPLAY: MovePositionTo(MovePositionSoVisible( - StartEndDisplayLine(currentPos, true), -1)); + StartEndDisplayLine(currentPos, true), -1)); SetLastXChosen(); break; case SCI_HOMEDISPLAYEXTEND: MovePositionTo(MovePositionSoVisible( - StartEndDisplayLine(currentPos, true), -1), selStream); + StartEndDisplayLine(currentPos, true), -1), selStream); SetLastXChosen(); break; case SCI_LINEENDDISPLAY: MovePositionTo(MovePositionSoVisible( - StartEndDisplayLine(currentPos, false), 1)); + StartEndDisplayLine(currentPos, false), 1)); SetLastXChosen(); break; case SCI_LINEENDDISPLAYEXTEND: MovePositionTo(MovePositionSoVisible( - StartEndDisplayLine(currentPos, false), 1), selStream); + StartEndDisplayLine(currentPos, false), 1), selStream); SetLastXChosen(); break; } @@ -4531,7 +4674,7 @@ int Editor::KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed) { DwellEnd(false); int modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | - (alt ? SCI_ALT : 0); + (alt ? SCI_ALT : 0); int msg = kmap.Find(key, modifiers); if (msg) { if (consumed) @@ -4572,7 +4715,7 @@ SetEmptySelection(currentPos + 1); } else { int numSpaces = (pdoc->tabInChars) - - (pdoc->GetColumn(currentPos) % (pdoc->tabInChars)); + (pdoc->GetColumn(currentPos) % (pdoc->tabInChars)); if (numSpaces < 1) numSpaces = pdoc->tabInChars; for (int i = 0; i < numSpaces; i++) { @@ -4593,7 +4736,7 @@ pdoc->EndUndoAction(); } else { int newColumn = ((pdoc->GetColumn(currentPos) - 1) / pdoc->tabInChars) * - pdoc->tabInChars; + pdoc->tabInChars; if (newColumn < 0) newColumn = 0; int newPos = currentPos; @@ -4632,19 +4775,19 @@ * @return The position of the found text, -1 if not found. */ long Editor::FindText( - uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, - ///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX. - sptr_t lParam) { ///< @c TextToFind structure: The text to search for in the given range. + uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, + ///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX. + sptr_t lParam) { ///< @c TextToFind structure: The text to search for in the given range. TextToFind *ft = reinterpret_cast<TextToFind *>(lParam); int lengthFound = istrlen(ft->lpstrText); int pos = pdoc->FindText(ft->chrg.cpMin, ft->chrg.cpMax, ft->lpstrText, - (wParam & SCFIND_MATCHCASE) != 0, - (wParam & SCFIND_WHOLEWORD) != 0, - (wParam & SCFIND_WORDSTART) != 0, - (wParam & SCFIND_REGEXP) != 0, - (wParam & SCFIND_POSIX) != 0, - &lengthFound); + (wParam & SCFIND_MATCHCASE) != 0, + (wParam & SCFIND_WHOLEWORD) != 0, + (wParam & SCFIND_WORDSTART) != 0, + (wParam & SCFIND_REGEXP) != 0, + (wParam & SCFIND_POSIX) != 0, + &lengthFound); if (pos != -1) { ft->chrgText.cpMin = pos; ft->chrgText.cpMax = pos + lengthFound; @@ -4675,7 +4818,7 @@ long Editor::SearchText( unsigned int iMessage, ///< Accepts both @c SCI_SEARCHNEXT and @c SCI_SEARCHPREV. uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, - ///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX. + ///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX. sptr_t lParam) { ///< The text to search for. const char *txt = reinterpret_cast<char *>(lParam); @@ -4683,20 +4826,20 @@ int lengthFound = istrlen(txt); if (iMessage == SCI_SEARCHNEXT) { pos = pdoc->FindText(searchAnchor, pdoc->Length(), txt, - (wParam & SCFIND_MATCHCASE) != 0, - (wParam & SCFIND_WHOLEWORD) != 0, - (wParam & SCFIND_WORDSTART) != 0, - (wParam & SCFIND_REGEXP) != 0, - (wParam & SCFIND_POSIX) != 0, - &lengthFound); + (wParam & SCFIND_MATCHCASE) != 0, + (wParam & SCFIND_WHOLEWORD) != 0, + (wParam & SCFIND_WORDSTART) != 0, + (wParam & SCFIND_REGEXP) != 0, + (wParam & SCFIND_POSIX) != 0, + &lengthFound); } else { pos = pdoc->FindText(searchAnchor, 0, txt, - (wParam & SCFIND_MATCHCASE) != 0, - (wParam & SCFIND_WHOLEWORD) != 0, - (wParam & SCFIND_WORDSTART) != 0, - (wParam & SCFIND_REGEXP) != 0, - (wParam & SCFIND_POSIX) != 0, - &lengthFound); + (wParam & SCFIND_MATCHCASE) != 0, + (wParam & SCFIND_WHOLEWORD) != 0, + (wParam & SCFIND_WORDSTART) != 0, + (wParam & SCFIND_REGEXP) != 0, + (wParam & SCFIND_POSIX) != 0, + &lengthFound); } if (pos != -1) { @@ -4713,12 +4856,12 @@ long Editor::SearchInTarget(const char *text, int length) { int lengthFound = length; int pos = pdoc->FindText(targetStart, targetEnd, text, - (searchFlags & SCFIND_MATCHCASE) != 0, - (searchFlags & SCFIND_WHOLEWORD) != 0, - (searchFlags & SCFIND_WORDSTART) != 0, - (searchFlags & SCFIND_REGEXP) != 0, - (searchFlags & SCFIND_POSIX) != 0, - &lengthFound); + (searchFlags & SCFIND_MATCHCASE) != 0, + (searchFlags & SCFIND_WHOLEWORD) != 0, + (searchFlags & SCFIND_WORDSTART) != 0, + (searchFlags & SCFIND_REGEXP) != 0, + (searchFlags & SCFIND_POSIX) != 0, + &lengthFound); if (pos != -1) { targetStart = pos; targetEnd = pos + lengthFound; @@ -4761,7 +4904,7 @@ void Editor::CopySelectionFromRange(SelectionText *ss, int start, int end) { ss->Set(CopyRange(start, end), end - start + 1, - pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false); + pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false); } void Editor::CopySelectionRange(SelectionText *ss) { @@ -4787,8 +4930,8 @@ lineIterator.Reset(); while (lineIterator.Iterate()) { for (int i = lineIterator.startPos; - i < lineIterator.endPos; - i++) { + i < lineIterator.endPos; + i++) { text[j++] = pdoc->CharAt(i); } if (selType != selLines) { @@ -4804,7 +4947,7 @@ } } ss->Set(text, size + 1, pdoc->dbcsCodePage, - vs.styles[STYLE_DEFAULT].characterSet, selType == selRectangle); + vs.styles[STYLE_DEFAULT].characterSet, selType == selRectangle); } } @@ -4813,14 +4956,14 @@ end = pdoc->ClampPositionIntoDocument(end); SelectionText selectedText; selectedText.Set(CopyRange(start, end), end - start + 1, - pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false); + pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false); CopyToClipboard(selectedText); } void Editor::CopyText(int length, const char *text) { SelectionText selectedText; selectedText.Copy(text, length + 1, - pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false); + pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false); CopyToClipboard(selectedText); } @@ -4991,13 +5134,13 @@ void Editor::LineSelection(int lineCurrent_, int lineAnchor_) { if (lineAnchor_ < lineCurrent_) { SetSelection(pdoc->LineStart(lineCurrent_ + 1), - pdoc->LineStart(lineAnchor_)); + pdoc->LineStart(lineAnchor_)); } else if (lineAnchor_ > lineCurrent_) { SetSelection(pdoc->LineStart(lineCurrent_), - pdoc->LineStart(lineAnchor_ + 1)); + pdoc->LineStart(lineAnchor_ + 1)); } else { // Same line, select it SetSelection(pdoc->LineStart(lineAnchor_ + 1), - pdoc->LineStart(lineAnchor_)); + pdoc->LineStart(lineAnchor_)); } } @@ -5051,10 +5194,10 @@ if (selectionType == selWord) { if (currentPos >= originalAnchorPos) { // Moved forward SetSelection(pdoc->ExtendWordSelect(currentPos, 1), - pdoc->ExtendWordSelect(originalAnchorPos, -1)); + pdoc->ExtendWordSelect(originalAnchorPos, -1)); } else { // Moved backward SetSelection(pdoc->ExtendWordSelect(currentPos, -1), - pdoc->ExtendWordSelect(originalAnchorPos, 1)); + pdoc->ExtendWordSelect(originalAnchorPos, 1)); } } else if (selectionType == selLine) { lineAnchor = LineFromLocation(pt); @@ -5082,7 +5225,7 @@ // Single click in margin: select whole line LineSelection(lineAnchor, lineAnchor); SetSelection(pdoc->LineStart(lineAnchor + 1), - pdoc->LineStart(lineAnchor)); + pdoc->LineStart(lineAnchor)); } else { // Single shift+click in margin: select from line anchor to clicked line if (anchor > currentPos) @@ -5107,14 +5250,6 @@ else inDragDrop = ddNone; } -#ifdef __APPLE__ - // we need to additionaly check if the mouse moved before we - // decide that we can in fact start a drag session. Currently - // only OSX will return anything but true. - if (inDragDrop == ddInitial && !Platform::WaitMouseMoved(pt)) { - inDragDrop = ddNone; - } -#endif SetMouseCapture(true); if (inDragDrop != ddInitial) { SetDragPosition(invalidPosition); @@ -5230,10 +5365,10 @@ // being unmade. } else if (movePos > originalAnchorPos) { // Moved forward SetSelection(pdoc->ExtendWordSelect(movePos, 1), - pdoc->ExtendWordSelect(originalAnchorPos, -1)); + pdoc->ExtendWordSelect(originalAnchorPos, -1)); } else { // Moved backward SetSelection(pdoc->ExtendWordSelect(movePos, -1), - pdoc->ExtendWordSelect(originalAnchorPos, 1)); + pdoc->ExtendWordSelect(originalAnchorPos, 1)); } } else { // Continue selecting by line @@ -5366,6 +5501,10 @@ } } } + if (horizontalScrollBarVisible && trackLineWidth && (lineWidthMaxSeen > scrollWidth)) { + scrollWidth = lineWidthMaxSeen; + SetScrollBars(); + } if ((dwellDelay < SC_TIME_FOREVER) && (ticksToDwell > 0) && (!HaveMouseCapture())) { @@ -5413,7 +5552,11 @@ } bool Editor::PaintContains(PRectangle rc) { - return rcPaint.Contains(rc); + if (rc.Empty()) { + return true; + } else { + return rcPaint.Contains(rc); + } } bool Editor::PaintContainsMargin() { @@ -5583,7 +5726,7 @@ SetVerticalScrollPos(); Redraw(); } else if ((lineDisplay > topLine + LinesOnScreen() - 1) || - ((visiblePolicy & VISIBLE_STRICT) && (lineDisplay > topLine + LinesOnScreen() - 1 - visibleSlop))) { + ((visiblePolicy & VISIBLE_STRICT) && (lineDisplay > topLine + LinesOnScreen() - 1 - visibleSlop))) { SetTopLine(Platform::Clamp(lineDisplay - LinesOnScreen() + 1 + visibleSlop, 0, MaxScrollPos())); SetVerticalScrollPos(); Redraw(); @@ -5604,8 +5747,10 @@ length = istrlen(text); if (replacePatterns) { text = pdoc->SubstituteByPosition(text, &length); - if (!text) + if (!text) { + pdoc->EndUndoAction(); return 0; + } } if (targetStart != targetEnd) pdoc->DeleteChars(targetStart, targetEnd - targetStart); @@ -5645,11 +5790,11 @@ char *text = new char[textLength]; if (text) { size_t i; - for (i=0;i<textLength;i++) { + for (i = 0;i < textLength;i++) { text[i] = buffer[i*2]; } pdoc->InsertString(CurrentPosition(), text, textLength); - for (i=0;i<textLength;i++) { + for (i = 0;i < textLength;i++) { text[i] = buffer[i*2+1]; } pdoc->StartStyling(CurrentPosition(), static_cast<char>(0xff)); @@ -5667,6 +5812,89 @@ return reinterpret_cast<char *>(lParam); } +void Editor::StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { + vs.EnsureStyle(wParam); + switch (iMessage) { + case SCI_STYLESETFORE: + vs.styles[wParam].fore.desired = ColourDesired(lParam); + break; + case SCI_STYLESETBACK: + vs.styles[wParam].back.desired = ColourDesired(lParam); + break; + case SCI_STYLESETBOLD: + vs.styles[wParam].bold = lParam != 0; + break; + case SCI_STYLESETITALIC: + vs.styles[wParam].italic = lParam != 0; + break; + case SCI_STYLESETEOLFILLED: + vs.styles[wParam].eolFilled = lParam != 0; + break; + case SCI_STYLESETSIZE: + vs.styles[wParam].size = lParam; + break; + case SCI_STYLESETFONT: + if (lParam != 0) { + vs.SetStyleFontName(wParam, CharPtrFromSPtr(lParam)); + } + break; + case SCI_STYLESETUNDERLINE: + vs.styles[wParam].underline = lParam != 0; + break; + case SCI_STYLESETCASE: + vs.styles[wParam].caseForce = static_cast<Style::ecaseForced>(lParam); + break; + case SCI_STYLESETCHARACTERSET: + vs.styles[wParam].characterSet = lParam; + break; + case SCI_STYLESETVISIBLE: + vs.styles[wParam].visible = lParam != 0; + break; + case SCI_STYLESETCHANGEABLE: + vs.styles[wParam].changeable = lParam != 0; + break; + case SCI_STYLESETHOTSPOT: + vs.styles[wParam].hotspot = lParam != 0; + break; + } + InvalidateStyleRedraw(); +} + +sptr_t Editor::StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { + vs.EnsureStyle(wParam); + switch (iMessage) { + case SCI_STYLEGETFORE: + return vs.styles[wParam].fore.desired.AsLong(); + case SCI_STYLEGETBACK: + return vs.styles[wParam].back.desired.AsLong(); + case SCI_STYLEGETBOLD: + return vs.styles[wParam].bold ? 1 : 0; + case SCI_STYLEGETITALIC: + return vs.styles[wParam].italic ? 1 : 0; + case SCI_STYLEGETEOLFILLED: + return vs.styles[wParam].eolFilled ? 1 : 0; + case SCI_STYLEGETSIZE: + return vs.styles[wParam].size; + case SCI_STYLEGETFONT: + if (lParam != 0) + strcpy(CharPtrFromSPtr(lParam), vs.styles[wParam].fontName); + return strlen(vs.styles[wParam].fontName); + case SCI_STYLEGETUNDERLINE: + return vs.styles[wParam].underline ? 1 : 0; + case SCI_STYLEGETCASE: + return static_cast<int>(vs.styles[wParam].caseForce); + case SCI_STYLEGETCHARACTERSET: + return vs.styles[wParam].characterSet; + case SCI_STYLEGETVISIBLE: + return vs.styles[wParam].visible ? 1 : 0; + case SCI_STYLEGETCHANGEABLE: + return vs.styles[wParam].changeable ? 1 : 0; + case SCI_STYLEGETHOTSPOT: + return vs.styles[wParam].hotspot ? 1 : 0; + } + return 0; +} + sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { //Platform::DebugPrintf("S start wnd proc %d %d %d\n",iMessage, wParam, lParam); @@ -5896,10 +6124,10 @@ return searchFlags; case SCI_POSITIONBEFORE: - return pdoc->MovePositionOutsideChar(wParam-1, -1, true); + return pdoc->MovePositionOutsideChar(wParam - 1, -1, true); case SCI_POSITIONAFTER: - return pdoc->MovePositionOutsideChar(wParam+1, 1, true); + return pdoc->MovePositionOutsideChar(wParam + 1, 1, true); case SCI_LINESCROLL: ScrollTo(topLine + lParam); @@ -6394,6 +6622,7 @@ case SCI_SETSCROLLWIDTH: PLATFORM_ASSERT(wParam > 0); if ((wParam > 0) && (wParam != static_cast<unsigned int >(scrollWidth))) { + lineWidthMaxSeen = 0; scrollWidth = wParam; SetScrollBars(); } @@ -6402,6 +6631,13 @@ case SCI_GETSCROLLWIDTH: return scrollWidth; + case SCI_SETSCROLLWIDTHTRACKING: + trackLineWidth = wParam != 0; + break; + + case SCI_GETSCROLLWIDTHTRACKING: + return trackLineWidth; + case SCI_LINESJOIN: LinesJoin(); break; @@ -6411,7 +6647,7 @@ break; case SCI_TEXTWIDTH: - PLATFORM_ASSERT(wParam <= STYLE_MAX); + PLATFORM_ASSERT(wParam < vs.stylesSize); PLATFORM_ASSERT(lParam); return TextWidth(wParam, CharPtrFromSPtr(lParam)); @@ -6472,7 +6708,7 @@ return verticalScrollBarVisible; case SCI_SETINDENTATIONGUIDES: - vs.viewIndentationGuides = wParam != 0; + vs.viewIndentationGuides = IndentView(wParam); Redraw(); break; @@ -6640,157 +6876,42 @@ break; case SCI_STYLESETFORE: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].fore.desired = ColourDesired(lParam); - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETBACK: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].back.desired = ColourDesired(lParam); - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETBOLD: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].bold = lParam != 0; - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETITALIC: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].italic = lParam != 0; - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETEOLFILLED: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].eolFilled = lParam != 0; - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETSIZE: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].size = lParam; - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETFONT: - if (lParam == 0) - return 0; - if (wParam <= STYLE_MAX) { - vs.SetStyleFontName(wParam, CharPtrFromSPtr(lParam)); - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETUNDERLINE: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].underline = lParam != 0; - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETCASE: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].caseForce = static_cast<Style::ecaseForced>(lParam); - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETCHARACTERSET: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].characterSet = lParam; - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETVISIBLE: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].visible = lParam != 0; - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETCHANGEABLE: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].changeable = lParam != 0; - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETHOTSPOT: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].hotspot = lParam != 0; - InvalidateStyleRedraw(); - } + StyleSetMessage(iMessage, wParam, lParam); break; + case SCI_STYLEGETFORE: - if (wParam <= STYLE_MAX) - return vs.styles[wParam].fore.desired.AsLong(); - else - return 0; case SCI_STYLEGETBACK: - if (wParam <= STYLE_MAX) - return vs.styles[wParam].back.desired.AsLong(); - else - return 0; case SCI_STYLEGETBOLD: - if (wParam <= STYLE_MAX) - return vs.styles[wParam].bold ? 1 : 0; - else - return 0; case SCI_STYLEGETITALIC: - if (wParam <= STYLE_MAX) - return vs.styles[wParam].italic ? 1 : 0; - else - return 0; case SCI_STYLEGETEOLFILLED: - if (wParam <= STYLE_MAX) - return vs.styles[wParam].eolFilled ? 1 : 0; - else - return 0; case SCI_STYLEGETSIZE: - if (wParam <= STYLE_MAX) - return vs.styles[wParam].size; - else - return 0; case SCI_STYLEGETFONT: - if (lParam == 0) - return strlen(vs.styles[wParam].fontName); - - if (wParam <= STYLE_MAX) - strcpy(CharPtrFromSPtr(lParam), vs.styles[wParam].fontName); - break; case SCI_STYLEGETUNDERLINE: - if (wParam <= STYLE_MAX) - return vs.styles[wParam].underline ? 1 : 0; - else - return 0; case SCI_STYLEGETCASE: - if (wParam <= STYLE_MAX) - return static_cast<int>(vs.styles[wParam].caseForce); - else - return 0; case SCI_STYLEGETCHARACTERSET: - if (wParam <= STYLE_MAX) - return vs.styles[wParam].characterSet; - else - return 0; case SCI_STYLEGETVISIBLE: - if (wParam <= STYLE_MAX) - return vs.styles[wParam].visible ? 1 : 0; - else - return 0; case SCI_STYLEGETCHANGEABLE: - if (wParam <= STYLE_MAX) - return vs.styles[wParam].changeable ? 1 : 0; - else - return 0; case SCI_STYLEGETHOTSPOT: - if (wParam <= STYLE_MAX) - return vs.styles[wParam].hotspot ? 1 : 0; - else - return 0; + return StyleGetMessage(iMessage, wParam, lParam); + case SCI_STYLERESETDEFAULT: vs.ResetDefaultStyle(); InvalidateStyleRedraw(); break; case SCI_SETSTYLEBITS: + vs.EnsureStyle((1 << wParam) - 1); pdoc->SetStylingBits(wParam); break; @@ -7001,12 +7122,12 @@ case SCI_ASSIGNCMDKEY: kmap.AssignCmdKey(Platform::LowShortFromLong(wParam), - Platform::HighShortFromLong(wParam), lParam); + Platform::HighShortFromLong(wParam), lParam); break; case SCI_CLEARCMDKEY: kmap.AssignCmdKey(Platform::LowShortFromLong(wParam), - Platform::HighShortFromLong(wParam), SCI_NULL); + Platform::HighShortFromLong(wParam), SCI_NULL); break; case SCI_CLEARALLCMDKEYS: Modified: trunk/scintilla/Editor.h =================================================================== --- trunk/scintilla/Editor.h 2007-12-02 10:52:19 UTC (rev 2085) +++ trunk/scintilla/Editor.h 2007-12-02 11:58:17 UTC (rev 2086) @@ -136,6 +136,8 @@ int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret bool horizontalScrollBarVisible; int scrollWidth; + bool trackLineWidth; + int lineWidthMaxSeen; bool verticalScrollBarVisible; bool endAtLastLine; bool caretSticky; @@ -297,6 +299,7 @@ virtual void UpdateSystemCaret(); void NeedWrapping(int docLineStart = 0, int docLineEnd = wrapLineLarge); + bool WrapOneLine(Surface *surface, int lineToWrap); bool WrapLines(bool fullWrap, int priorityWrapLineStart); void LinesJoin(); void LinesSplit(int pixelWidth); @@ -454,6 +457,8 @@ void AddStyledText(char *buffer, int appendLength); virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0; + void StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); + sptr_t StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); public: // Public so the COM thunks can access it. Modified: trunk/scintilla/LexBash.cxx =================================================================== --- trunk/scintilla/LexBash.cxx 2007-12-02 10:52:19 UTC (rev 2085) +++ trunk/scintilla/LexBash.cxx 2007-12-02 11:58:17 UTC (rev 2086) @@ -2,7 +2,7 @@ /** @file LexBash.cxx ** Lexer for Bash. **/ -// Copyright 2004-2005 by Neil Hodgson <neilh(a)scintilla.org> +// Copyright 2004-2007 by Neil Hodgson <neilh(a)scintilla.org> // Adapted from LexPerl by Kein-Hong Man <mkh(a)pl.jaring.my> 2004 // The License.txt file describes the conditions under which this software may be distributed. @@ -20,11 +20,17 @@ #include "Scintilla.h" #include "SciLexer.h" +// define this if you want 'invalid octals' to be marked as errors +// usually, this is not a good idea, permissive lexing is better +#undef PEDANTIC_OCTAL + #define BASH_BASE_ERROR 65 #define BASH_BASE_DECIMAL 66 #define BASH_BASE_HEX 67 +#ifdef PEDANTIC_OCTAL #define BASH_BASE_OCTAL 68 #define BASH_BASE_OCTAL_ERROR 69 +#endif #define HERE_DELIM_MAX 256 @@ -277,7 +283,11 @@ ch = chNext; chNext = chNext2; } else if (isdigit(chNext)) { +#ifdef PEDANTIC_OCTAL numBase = BASH_BASE_OCTAL; +#else + numBase = BASH_BASE_HEX; +#endif } } } else if (iswordstart(ch)) { @@ -369,14 +379,16 @@ // hex digit 0-9a-fA-F } else goto numAtEnd; +#ifdef PEDANTIC_OCTAL } else if (numBase == BASH_BASE_OCTAL || numBase == BASH_BASE_OCTAL_ERROR) { if (digit > 7) { if (digit <= 9) { - numBase = BASH_BASE_OCTAL_ERROR; + numBase = BASH_BASE_OCTAL_ERROR; } else goto numAtEnd; } +#endif } else if (numBase == BASH_BASE_ERROR) { if (digit > 9) goto numAtEnd; @@ -394,8 +406,11 @@ } } else { numAtEnd: - if (numBase == BASH_BASE_ERROR || - numBase == BASH_BASE_OCTAL_ERROR) + if (numBase == BASH_BASE_ERROR +#ifdef PEDANTIC_OCTAL + || numBase == BASH_BASE_OCTAL_ERROR +#endif + ) state = SCE_SH_ERROR; styler.ColourTo(i - 1, state); state = SCE_SH_DEFAULT; Modified: trunk/scintilla/LexCPP.cxx =================================================================== --- trunk/scintilla/LexCPP.cxx 2007-12-02 10:52:19 UTC (rev 2085) +++ trunk/scintilla/LexCPP.cxx 2007-12-02 11:58:17 UTC (rev 2086) @@ -32,6 +32,24 @@ (state == SCE_C_COMMENTDOCKEYWORDERROR); } +// Preconditions: sc.currentPos points to a character after '+' or '-'. +// The test for pos reaching 0 should be redundant, +// and is in only for safety measures. +// Limitation: this code will give the incorrect answer for code like +// a = b+++/ptn/... +// Putting a space between the '++' post-inc operator and the '+' binary op +// fixes this, and is highly recommended for readability anyway. +static bool FollowsPostfixOperator(StyleContext &sc, Accessor &styler) { + int pos = (int) sc.currentPos; + while (--pos > 0) { + char ch = styler[pos]; + if (ch == '+' || ch == '-') { + return styler[pos - 1] == ch; + } + } + return false; +} + static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler, bool caseSensitive) { @@ -42,7 +60,8 @@ bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0; - CharacterSet setOKBeforeRE(CharacterSet::setNone, "(=,"); + CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-"); + CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-"); CharacterSet setDoxygen(CharacterSet::setLower, "$@\\&<>#{}[]"); @@ -297,7 +316,8 @@ sc.SetState(SCE_C_COMMENTLINEDOC); else sc.SetState(SCE_C_COMMENTLINE); - } else if (sc.ch == '/' && setOKBeforeRE.Contains(chPrevNonWhite)) { + } else if (sc.ch == '/' && setOKBeforeRE.Contains(chPrevNonWhite) && + (!setCouldBePostOp.Contains(chPrevNonWhite) || !FollowsPostfixOperator(sc, styler))) { sc.SetState(SCE_C_REGEX); // JavaScript's RegEx } else if (sc.ch == '\"') { sc.SetState(SCE_C_STRING); @@ -337,7 +357,7 @@ // Store both the current line's fold level and the next lines in the // level store to make it easy to pick up with each increment // and to make it possible to fiddle the current level for "} else {". -static void FoldCppDoc(unsigned int startPos, int length, int initStyle, +static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; Modified: trunk/scintilla/LexHTML.cxx =================================================================== --- trunk/scintilla/LexHTML.cxx 2007-12-02 10:52:19 UTC (rev 2085) +++ trunk/scintilla/LexHTML.cxx 2007-12-02 11:58:17 UTC (rev 2086) @@ -565,7 +565,7 @@ break; } if (style == SCE_HJ_SYMBOLS) { - chPrevNonWhite = styler.SafeGetCharAt(back); + chPrevNonWhite = static_cast<unsigned char>(styler.SafeGetCharAt(back)); } } @@ -676,10 +676,13 @@ case SCE_HJ_COMMENTDOC: //case SCE_HJ_COMMENTLINE: // removed as this is a common thing done to hide // the end of script marker from some JS interpreters. + case SCE_HB_COMMENTLINE: + case SCE_HBA_COMMENTLINE: case SCE_HJ_DOUBLESTRING: case SCE_HJ_SINGLESTRING: case SCE_HJ_REGEX: case SCE_HB_STRING: + case SCE_HBA_STRING: case SCE_HP_STRING: case SCE_HP_TRIPLE: case SCE_HP_TRIPLEDOUBLE: @@ -688,9 +691,8 @@ // check if the closing tag is a script tag if (state == SCE_HJ_COMMENTLINE || isXml) { char tag[7]; // room for the <script> tag - char chr; // current char - int j=0; - chr = styler.SafeGetCharAt(i+2); + int j = 0; + char chr = styler.SafeGetCharAt(i+2); while (j < 6 && !IsASpace(chr)) { tag[j++] = static_cast<char>(MakeLowerCase(chr)); chr = styler.SafeGetCharAt(i+2+j); @@ -740,7 +742,7 @@ levelCurrent++; } // should be better @@ Diff output truncated at 100000 characters. @@ This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: geany: [2085] trunk
by eht16@users.sourceforge.net
02 Dec '07
02 Dec '07
Revision: 2085
http://geany.svn.sourceforge.net/geany/?rev=2085&view=rev
Author: eht16 Date: 2007-12-02 02:52:19 -0800 (Sun, 02 Dec 2007) Log Message: ----------- Add search_show_find_in_files_dialog() to the plugin API. Make path entry of filebrowser plugin editable. Add "Open with" and "Find in Files" popup menu items to filebrowser plugin and add configuration dialog. Modified Paths: -------------- trunk/ChangeLog trunk/plugins/filebrowser.c trunk/plugins/pluginmacros.h trunk/src/callbacks.c trunk/src/plugindata.h trunk/src/plugins.c trunk/src/search.c trunk/src/search.h trunk/src/utils.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-12-01 17:53:36 UTC (rev 2084) +++ trunk/ChangeLog 2007-12-02 10:52:19 UTC (rev 2085) @@ -1,3 +1,14 @@ +2007-12-02 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + + * plugins/filebrowser.c, plugins/pluginmacros.h, src/callbacks.c, + src/plugins.c, src/plugindata.h, src/search.c, src/search.h, + src/utils.c: + Add search_show_find_in_files_dialog() to the plugin API. + Make path entry of filebrowser plugin editable. + Add "Open with" and "Find in Files" popup menu items to filebrowser + plugin and add configuration dialog. + + 2007-12-01 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> * src/templates.c: Modified: trunk/plugins/filebrowser.c =================================================================== --- trunk/plugins/filebrowser.c 2007-12-01 17:53:36 UTC (rev 2084) +++ trunk/plugins/filebrowser.c 2007-12-02 10:52:19 UTC (rev 2085) @@ -66,6 +66,8 @@ static GtkWidget *path_entry; static gchar *current_dir = NULL; // in locale-encoding +static gchar *open_cmd; // in locale-encoding +static gchar *config_file; // Returns: whether name should be hidden. @@ -154,6 +156,10 @@ gchar *utf8_dir; GSList *list; + // don't clear when the new path doesn't exist + if (! g_file_test(current_dir, G_FILE_TEST_EXISTS)) + return; + clear(); utf8_dir = utils->get_utf8_from_locale(current_dir); @@ -184,7 +190,7 @@ if (project) dir = project->base_path; if (NZV(dir)) - return g_strdup(dir); + return utils->get_locale_from_utf8(dir); return g_get_current_dir(); } @@ -213,7 +219,7 @@ } -static void handle_selection(GList *list, GtkTreeSelection *treesel) +static void handle_selection(GList *list, GtkTreeSelection *treesel, gboolean external) { GList *item; GtkTreeModel *model = GTK_TREE_MODEL(file_store); @@ -252,14 +258,35 @@ gtk_tree_model_get_iter(model, &iter, treepath); gtk_tree_model_get(model, &iter, FILEVIEW_COLUMN_NAME, &name, -1); + if (utils->str_equal(current_dir, G_DIR_SEPARATOR_S)) /// TODO test this on Windows + dir_sep = ""; setptr(name, utils->get_locale_from_utf8(name)); - if (utils->str_equal(current_dir, G_DIR_SEPARATOR_S)) - dir_sep = ""; fname = g_strconcat(current_dir, dir_sep, name, NULL); g_free(name); - if (dir_found) + if (external) { + gchar *cmd; + gchar *dir; + GString *cmd_str = g_string_new(open_cmd); + + if (! dir_found) + dir = g_path_get_dirname(fname); + else + dir = g_strdup(fname); + + utils->string_replace_all(cmd_str, "%f", fname); + utils->string_replace_all(cmd_str, "%d", dir); + + cmd = g_string_free(cmd_str, FALSE); + setptr(cmd, utils->get_locale_from_utf8(cmd)); + g_spawn_command_line_async(cmd, NULL); + g_free(cmd); + g_free(dir); + g_free(fname); + } + else if (dir_found) + { setptr(current_dir, fname); refresh(); return; @@ -273,7 +300,7 @@ } -static void open_selected_files() +static void open_selected_files(GtkMenuItem *menuitem, gpointer user_data) { GtkTreeSelection *treesel; GtkTreeModel *model; @@ -282,13 +309,58 @@ treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(file_view)); list = gtk_tree_selection_get_selected_rows(treesel, &model); - handle_selection(list, treesel); + handle_selection(list, treesel, GPOINTER_TO_INT(user_data)); g_list_foreach(list, (GFunc) gtk_tree_path_free, NULL); g_list_free(list); } +static void on_find_in_files(GtkMenuItem *menuitem, gpointer user_data) +{ + GtkTreeSelection *treesel; + GtkTreeModel *model; + GtkTreePath *treepath; + GtkTreeIter iter; + GList *list; + GList *item; + gchar *icon; + gchar *dir; + gchar *name; + gboolean is_dir = FALSE; + + treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(file_view)); + if (gtk_tree_selection_count_selected_rows(treesel) != 1) + return; + + list = gtk_tree_selection_get_selected_rows(treesel, &model); + for (item = list; item != NULL; item = g_list_next(item)) + { + treepath = (GtkTreePath*) item->data; + gtk_tree_model_get_iter(model, &iter, treepath); + gtk_tree_model_get(model, &iter, + FILEVIEW_COLUMN_ICON, &icon, + FILEVIEW_COLUMN_NAME, &name, -1); + + if (utils->str_equal(icon, GTK_STOCK_DIRECTORY)) + is_dir = TRUE; + g_free(icon); + } + + g_list_foreach(list, (GFunc) gtk_tree_path_free, NULL); + g_list_free(list); + + if (is_dir) + dir = g_strconcat(current_dir, G_DIR_SEPARATOR_S, name, NULL); + else + dir = g_strdup(current_dir); + + setptr(dir, utils->get_utf8_from_locale(dir)); + search->show_find_in_files_dialog(dir); + g_free(dir); +} + + static void on_hidden_files_clicked(GtkCheckMenuItem *item) { show_hidden_files = gtk_check_menu_item_get_active(item); @@ -298,7 +370,7 @@ static GtkWidget *create_popup_menu() { - GtkWidget *item, *menu; + GtkWidget *item, *menu, *image; menu = gtk_menu_new(); @@ -306,8 +378,26 @@ gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item); g_signal_connect((gpointer) item, "activate", - G_CALLBACK(open_selected_files), NULL); + G_CALLBACK(open_selected_files), GINT_TO_POINTER(FALSE)); + + image = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU); + gtk_widget_show(image); + item = gtk_image_menu_item_new_with_mnemonic(_("Open _with ...")); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image); + gtk_widget_show(item); + gtk_container_add(GTK_CONTAINER(menu), item); + g_signal_connect((gpointer) item, "activate", + G_CALLBACK(open_selected_files), GINT_TO_POINTER(TRUE)); + + image = gtk_image_new_from_stock(GTK_STOCK_FIND, GTK_ICON_SIZE_MENU); + gtk_widget_show(image); + item = gtk_image_menu_item_new_with_mnemonic(_("_Find in Files")); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image); + gtk_widget_show(item); + gtk_container_add(GTK_CONTAINER(menu), item); + g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_find_in_files), NULL); + item = gtk_separator_menu_item_new(); gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item); @@ -315,8 +405,7 @@ item = gtk_check_menu_item_new_with_mnemonic(_("Show _Hidden Files")); gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item); - g_signal_connect((gpointer) item, "activate", - G_CALLBACK(on_hidden_files_clicked), NULL); + g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_hidden_files_clicked), NULL); item = gtk_separator_menu_item_new(); gtk_widget_show(item); @@ -338,7 +427,7 @@ static gboolean on_button_press(GtkWidget *widget, GdkEventButton *event, gpointer user_data) { if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) - open_selected_files(); + open_selected_files(NULL, NULL); else if (event->button == 3) { @@ -369,7 +458,7 @@ || event->keyval == GDK_ISO_Enter || event->keyval == GDK_KP_Enter || event->keyval == GDK_space) - open_selected_files(); + open_selected_files(NULL, NULL); if ((event->keyval == GDK_Up || event->keyval == GDK_KP_Up) && @@ -379,6 +468,19 @@ } +static void on_path_entry_activate(GtkEntry *entry, gpointer user_data) +{ + gchar *new_dir = (gchar*) gtk_entry_get_text(entry); + if (NZV(new_dir)) + new_dir = utils->get_locale_from_utf8(new_dir); + else + new_dir = g_strdup(g_get_home_dir()); + + setptr(current_dir, new_dir); + refresh(); +} + + static void prepare_file_view() { GtkCellRenderer *text_renderer, *icon_renderer; @@ -457,17 +559,29 @@ } +#define CHECK_READ_SETTING(var, error, tmp) \ + if ((error) != NULL) \ + { \ + g_error_free((error)); \ + (error) = NULL; \ + } \ + else \ + (var) = (tmp); + void init(GeanyData *data) { GtkWidget *scrollwin, *toolbar; + GKeyFile *config = g_key_file_new(); + GError *error = NULL; + gboolean tmp; file_view_vbox = gtk_vbox_new(FALSE, 0); toolbar = make_toolbar(); gtk_box_pack_start(GTK_BOX(file_view_vbox), toolbar, FALSE, FALSE, 0); path_entry = gtk_entry_new(); - gtk_editable_set_editable(GTK_EDITABLE(path_entry), FALSE); gtk_box_pack_start(GTK_BOX(file_view_vbox), path_entry, FALSE, FALSE, 2); + g_signal_connect(G_OBJECT(path_entry), "activate", G_CALLBACK(on_path_entry_activate), NULL); file_view = gtk_tree_view_new(); prepare_file_view(); @@ -482,10 +596,114 @@ gtk_widget_show_all(file_view_vbox); gtk_notebook_append_page(GTK_NOTEBOOK(app->treeview_notebook), file_view_vbox, gtk_label_new(_("Files"))); + + config_file = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "plugins", G_DIR_SEPARATOR_S, + "filebrowser", G_DIR_SEPARATOR_S, "filebrowser.conf", NULL); + g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL); + open_cmd = g_key_file_get_string(config, "filebrowser", "open_command", &error); + if (error != NULL) + { + open_cmd = g_strdup("nautilus \"%d\""); + g_error_free(error); + error = NULL; + } + tmp = g_key_file_get_boolean(config, "filebrowser", "show_hidden_files", &error); + CHECK_READ_SETTING(show_hidden_files, error, tmp); + tmp = g_key_file_get_boolean(config, "filebrowser", "hide_object_files", &error); + CHECK_READ_SETTING(hide_object_files, error, tmp); + + g_key_file_free(config); } +void configure(GtkWidget *parent) +{ + GtkWidget *dialog, *label, *entry, *checkbox_of, *checkbox_hf, *vbox; + GtkTooltips *tooltips = gtk_tooltips_new(); + + dialog = gtk_dialog_new_with_buttons(_("File Browser"), + GTK_WINDOW(parent), GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); + vbox = ui->dialog_vbox_new(GTK_DIALOG(dialog)); + gtk_widget_set_name(dialog, "GeanyDialog"); + gtk_box_set_spacing(GTK_BOX(vbox), 6); + + label = gtk_label_new("External open command:"); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_container_add(GTK_CONTAINER(vbox), label); + + entry = gtk_entry_new(); + gtk_widget_show(entry); + if (open_cmd != NULL) + gtk_entry_set_text(GTK_ENTRY(entry), open_cmd); + gtk_tooltips_set_tip(tooltips, entry, + _("The command to execute when using \"Open with\". You can use %f and %d wildcards.\n" + "%f will be replaced with the filename including full path\n" + "%d will be replaced with the path name of the selected file without the filename"), + NULL); + gtk_container_add(GTK_CONTAINER(vbox), entry); + + checkbox_hf = gtk_check_button_new_with_label(_("Show hidden files")); + gtk_button_set_focus_on_click(GTK_BUTTON(checkbox_hf), FALSE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox_hf), show_hidden_files); + gtk_box_pack_start(GTK_BOX(vbox), checkbox_hf, FALSE, FALSE, 5); + + checkbox_of = gtk_check_button_new_with_label(_("Hide object files")); + gtk_button_set_focus_on_click(GTK_BUTTON(checkbox_of), FALSE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox_of), hide_object_files); + gtk_tooltips_set_tip(tooltips, checkbox_of, + _("Don't show generated object files in the file browser, this includes " + "*.o, *.obj. *.so, *.dll, *.a, *.lib"), + NULL); + gtk_box_pack_start(GTK_BOX(vbox), checkbox_of, FALSE, FALSE, 5); + + + gtk_widget_show_all(vbox); + + // run the dialog and check for the response code + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) + { + GKeyFile *config = g_key_file_new(); + gchar *data; + gchar *config_dir = g_path_get_dirname(config_file); + + g_free(open_cmd); + open_cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry))); + show_hidden_files = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox_hf)); + hide_object_files = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox_of)); + + g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL); + + g_key_file_set_string(config, "filebrowser", "open_command", open_cmd); + g_key_file_set_boolean(config, "filebrowser", "show_hidden_files", show_hidden_files); + g_key_file_set_boolean(config, "filebrowser", "hide_object_files", hide_object_files); + + if (! g_file_test(config_dir, G_FILE_TEST_IS_DIR) && utils->mkdir(config_dir, TRUE) != 0) + { + dialogs->show_msgbox(GTK_MESSAGE_ERROR, + _("Plugin configuration directory could not be created.")); + } + else + { + // write config to file + data = g_key_file_to_data(config, NULL, NULL); + utils->write_file(config_file, data); + g_free(data); + } + + // apply the changes + refresh(); + + g_free(config_dir); + g_key_file_free(config); + } + gtk_widget_destroy(dialog); +} + + void cleanup() { + g_free(config_file); + g_free(open_cmd); gtk_widget_destroy(file_view_vbox); } Modified: trunk/plugins/pluginmacros.h =================================================================== --- trunk/plugins/pluginmacros.h 2007-12-01 17:53:36 UTC (rev 2084) +++ trunk/plugins/pluginmacros.h 2007-12-02 10:52:19 UTC (rev 2085) @@ -38,6 +38,7 @@ #define keybindings geany_data->keybindings #define msgwindow geany_data->msgwindow #define scintilla geany_data->sci +#define search geany_data->search #define support geany_data->support #define templates geany_data->templates #define tagmanager geany_data->tm // avoids conflict with "struct tm *t" Modified: trunk/src/callbacks.c =================================================================== --- trunk/src/callbacks.c 2007-12-01 17:53:36 UTC (rev 2084) +++ trunk/src/callbacks.c 2007-12-02 10:52:19 UTC (rev 2085) @@ -1187,7 +1187,7 @@ on_find_in_files1_activate (GtkMenuItem *menuitem, gpointer user_data) { - search_show_find_in_files_dialog(); + search_show_find_in_files_dialog(NULL); } Modified: trunk/src/plugindata.h =================================================================== --- trunk/src/plugindata.h 2007-12-01 17:53:36 UTC (rev 2084) +++ trunk/src/plugindata.h 2007-12-02 10:52:19 UTC (rev 2085) @@ -93,7 +93,7 @@ /* The API version should be incremented whenever any plugin data types below are * modified or appended to. */ -static const gint api_version = 33; +static const gint api_version = 34; /* The ABI version should be incremented whenever existing fields in the plugin * data types below have to be changed or reordered. It should stay the same if fields @@ -195,6 +195,7 @@ struct EncodingFuncs *encoding; struct KeybindingFuncs *keybindings; struct TagManagerFuncs *tm; + struct SearchFuncs *search; } GeanyData; @@ -337,6 +338,13 @@ KeybindingFuncs; +typedef struct SearchFuncs +{ + void (*show_find_in_files_dialog) (const gchar *dir); +} +SearchFuncs; + + typedef struct TagManagerFuncs { gchar* (*get_real_path) (const gchar *file_name); Modified: trunk/src/plugins.c =================================================================== --- trunk/src/plugins.c 2007-12-01 17:53:36 UTC (rev 2084) +++ trunk/src/plugins.c 2007-12-02 10:52:19 UTC (rev 2085) @@ -49,6 +49,7 @@ #include "geanyobject.h" #include "build.h" #include "encodings.h" +#include "search.h" void keybindings_cmd(gint cmd_id); // don't require keybindings.h enum in plugindata.h @@ -182,7 +183,11 @@ &tm_get_real_path }; +static SearchFuncs search_funcs = { + &search_show_find_in_files_dialog +}; + static GeanyData geany_data = { NULL, NULL, @@ -203,6 +208,7 @@ &encoding_funcs, &keybindings_funcs, &tagmanager_funcs, + &search_funcs, }; Modified: trunk/src/search.c =================================================================== --- trunk/src/search.c 2007-12-01 17:53:36 UTC (rev 2084) +++ trunk/src/search.c 2007-12-02 10:52:19 UTC (rev 2085) @@ -543,7 +543,9 @@ } -void search_show_find_in_files_dialog() +/* dir is the directory to search in (UTF-8 encoding), maybe NULL to determine it the usual way + * by using the current file's path */ +void search_show_find_in_files_dialog(const gchar *dir) { static GtkWidget *combo = NULL; static GtkWidget *dir_combo; @@ -552,7 +554,7 @@ gchar *sel = NULL; gchar *cur_dir; - if (idx == -1 || ! doc_list[idx].is_valid) return; + if (! DOC_IDX_VALID(idx)) return; if (widgets.find_in_files_dialog == NULL) { @@ -712,7 +714,10 @@ g_free(sel); entry = GTK_BIN(dir_combo)->child; - cur_dir = utils_get_current_file_dir(); + if (NZV(dir)) + cur_dir = g_strdup(dir); + else + cur_dir = utils_get_current_file_dir(); if (cur_dir) { gtk_entry_set_text(GTK_ENTRY(entry), cur_dir); Modified: trunk/src/search.h =================================================================== --- trunk/src/search.h 2007-12-01 17:53:36 UTC (rev 2084) +++ trunk/src/search.h 2007-12-02 10:52:19 UTC (rev 2085) @@ -55,7 +55,7 @@ void search_show_replace_dialog(); -void search_show_find_in_files_dialog(); +void search_show_find_in_files_dialog(const gchar *dir); void search_find_usage(const gchar *search_text, gint flags, gboolean in_session); Modified: trunk/src/utils.c =================================================================== --- trunk/src/utils.c 2007-12-01 17:53:36 UTC (rev 2084) +++ trunk/src/utils.c 2007-12-02 10:52:19 UTC (rev 2085) @@ -1039,12 +1039,12 @@ /* Get directory from current file in the notebook. * Returns dir string that should be freed or NULL, depending on whether current file is valid. - * (thanks to Nick Treleaven for this patch) */ + * Returned string is in UTF-8 encoding */ gchar *utils_get_current_file_dir() { gint cur_idx = document_get_cur_idx(); - if (cur_idx >= 0 && doc_list[cur_idx].is_valid) // if valid page found + if (DOC_IDX_VALID(cur_idx)) // if valid page found { // get current filename const gchar *cur_fname = doc_list[cur_idx].file_name; This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: geany: [2084] trunk
by eht16@users.sourceforge.net
01 Dec '07
01 Dec '07
Revision: 2084
http://geany.svn.sourceforge.net/geany/?rev=2084&view=rev
Author: eht16 Date: 2007-12-01 09:53:36 -0800 (Sat, 01 Dec 2007) Log Message: ----------- Remove obsolete SVNdiff plugin, use the VC Diff plugin. Add option for amount of characters to trigger symbol completion. Add document_find_by_filename to the plugin API. Modified Paths: -------------- trunk/ChangeLog trunk/geany.glade trunk/plugins/Makefile.am trunk/plugins/makefile.win32 trunk/src/editor.c trunk/src/editor.h trunk/src/geany.h trunk/src/interface.c trunk/src/keyfile.c trunk/src/plugindata.h trunk/src/plugins.c trunk/src/prefs.c Removed Paths: ------------- trunk/plugins/svndiff.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-12-01 11:27:03 UTC (rev 2083) +++ trunk/ChangeLog 2007-12-01 17:53:36 UTC (rev 2084) @@ -2,6 +2,13 @@ * src/templates.c: Avoid inclusion of PHP tags in PHP function descriptions. + * plugins/Makefile.am, plugins/svndiff.c: + Remove obsolete SVNdiff plugin, use the VC Diff plugin. + * geany.glade, src /editor.c, src/editor.h, src/geany.h, + src/interface.c, src/keyfile.c, src/plugindata.h, src/plugins.c, + src/prefs.c: + Add option for amount of characters to trigger symbol completion. + Add document_find_by_filename to the plugin API. 2007-11-30 Frank Lanitz <frank(at)frank(dot)uvena(dot)de> Modified: trunk/geany.glade =================================================================== --- trunk/geany.glade 2007-12-01 11:27:03 UTC (rev 2083) +++ trunk/geany.glade 2007-12-01 17:53:36 UTC (rev 2084) @@ -6050,12 +6050,65 @@ </child> <child> - <widget class="GtkHBox" id="hbox6"> + <widget class="GtkTable" id="table14"> <property name="visible">True</property> + <property name="n_rows">2</property> + <property name="n_columns">2</property> <property name="homogeneous">False</property> - <property name="spacing">12</property> + <property name="row_spacing">3</property> + <property name="column_spacing">12</property> <child> + <widget class="GtkSpinButton" id="spin_symbollistheight"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Number of rows to display in the autocompletion list.</property> + <property name="can_focus">True</property> + <property name="climb_rate">1</property> + <property name="digits">0</property> + <property name="numeric">True</property> + <property name="update_policy">GTK_UPDATE_ALWAYS</property> + <property name="snap_to_ticks">False</property> + <property name="wrap">False</property> + <property name="adjustment">9 1 99 1 10 10</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label205"> + <property name="visible">True</property> + <property name="label" translatable="yes">Characters to type for completion:</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> <widget class="GtkLabel" id="label173"> <property name="visible">True</property> <property name="label" translatable="yes">Rows of symbol completion list:</property> @@ -6074,16 +6127,19 @@ <property name="angle">0</property> </widget> <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkSpinButton" id="spin_symbollistheight"> + <widget class="GtkSpinButton" id="spin_symbol_complete_chars"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Number of rows to display in the autocompletion list.</property> + <property name="tooltip" translatable="yes">The amount of characters which are necessary to show the symbol auto completion list.</property> <property name="can_focus">True</property> <property name="climb_rate">1</property> <property name="digits">0</property> @@ -6091,12 +6147,14 @@ <property name="update_policy">GTK_UPDATE_ALWAYS</property> <property name="snap_to_ticks">False</property> <property name="wrap">False</property> - <property name="adjustment">10 1 99 1 10 10</property> + <property name="adjustment">9 1 99 1 10 10</property> </widget> <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="y_options"></property> </packing> </child> </widget> @@ -6208,7 +6266,7 @@ <property name="n_columns">2</property> <property name="homogeneous">False</property> <property name="row_spacing">3</property> - <property name="column_spacing">12</property> + <property name="column_spacing">0</property> <child> <widget class="GtkEventBox" id="eventbox1"> @@ -6264,28 +6322,6 @@ </child> <child> - <widget class="GtkCheckButton" id="check_open_encoding"> - <property name="visible">True</property> - <property name="tooltip" translatable="yes">This option disables the automatic detection of the file encoding when opening files and opens the file with the specified encoding (usually not needed).</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Use fixed encoding when opening files</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">False</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="y_options"></property> - </packing> - </child> - - <child> <widget class="GtkLabel" id="label_open_encoding"> <property name="visible">True</property> <property name="label" translatable="yes">Default encoding (existing files):</property> @@ -6306,8 +6342,8 @@ <packing> <property name="left_attach">0</property> <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> @@ -6331,12 +6367,34 @@ <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="x_options">fill</property> <property name="y_options">fill</property> </packing> </child> + + <child> + <widget class="GtkCheckButton" id="check_open_encoding"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">This option disables the automatic detection of the file encoding when opening files and opens the file with the specified encoding (usually not needed).</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Use fixed encoding when opening files</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">False</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_options"></property> + </packing> + </child> </widget> <packing> <property name="padding">0</property> Modified: trunk/plugins/Makefile.am =================================================================== --- trunk/plugins/Makefile.am 2007-12-01 11:27:03 UTC (rev 2083) +++ trunk/plugins/Makefile.am 2007-12-01 17:53:36 UTC (rev 2084) @@ -10,7 +10,6 @@ classbuilder_la_LDFLAGS = -module -avoid-version htmlchars_la_LDFLAGS = -module -avoid-version export_la_LDFLAGS = -module -avoid-version -svndiff_la_LDFLAGS = -module -avoid-version vcdiff_la_LDFLAGS = -module -avoid-version autosave_la_LDFLAGS = -module -avoid-version filebrowser_la_LDFLAGS = -module -avoid-version @@ -22,7 +21,6 @@ classbuilder.la \ htmlchars.la \ export.la \ - svndiff.la \ vcdiff.la \ autosave.la \ filebrowser.la @@ -35,7 +33,6 @@ classbuilder_la_SOURCES = classbuilder.c htmlchars_la_SOURCES = htmlchars.c export_la_SOURCES = export.c -svndiff_la_SOURCES = svndiff.c vcdiff_la_SOURCES = vcdiff.c autosave_la_SOURCES = autosave.c filebrowser_la_SOURCES = filebrowser.c @@ -44,7 +41,6 @@ classbuilder_la_LIBADD = $(GTK_LIBS) htmlchars_la_LIBADD = $(GTK_LIBS) export_la_LIBADD = $(GTK_LIBS) -svndiff_la_LIBADD = $(GTK_LIBS) vcdiff_la_LIBADD = $(GTK_LIBS) autosave_la_LIBAD = $(GTK_LIBS) filebrowser_la_LIBADD = $(GTK_LIBS) Modified: trunk/plugins/makefile.win32 =================================================================== --- trunk/plugins/makefile.win32 2007-12-01 11:27:03 UTC (rev 2083) +++ trunk/plugins/makefile.win32 2007-12-01 17:53:36 UTC (rev 2084) @@ -45,7 +45,6 @@ demoplugin.dll \ classbuilder.dll \ export.dll \ - svndiff.dll \ vcdiff.dll \ autosave.dll \ filebrowser.dll Deleted: trunk/plugins/svndiff.c =================================================================== --- trunk/plugins/svndiff.c 2007-12-01 11:27:03 UTC (rev 2083) +++ trunk/plugins/svndiff.c 2007-12-01 17:53:36 UTC (rev 2084) @@ -1,390 +0,0 @@ -/* - * svndiff.c - this file is part of Geany, a fast and lightweight IDE - * - * Copyright 2007 Frank Lanitz <frank(at)frank(dot)uvena(dot)de> - * Copyright 2007 Enrico Tröger <enrico.troeger(a)uvena.de> - * Copyright 2007 Nick Treleaven <nick.treleaven(a)btinternet.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* SVNdiff plugin */ -/* This small plugin uses svn to generate a diff against the current - * version inside svn.*/ - -#include "geany.h" -#include "support.h" -#include "plugindata.h" -#include "document.h" -#include "filetypes.h" -#include "utils.h" -#include "project.h" -#include "pluginmacros.h" - -PluginFields *plugin_fields; -GeanyData *geany_data; - - -VERSION_CHECK(27) - -PLUGIN_INFO(_("SVNdiff"), _("Plugin to create a patch of a file against svn"), VERSION, - _("The Geany developer team")) - -static int find_by_filename(const gchar* filename) -{ - guint i; - - for (i = 0; i < doc_array->len; i++) - { - if (doc_list[i].is_valid && doc_list[i].file_name && - strcmp(doc_list[i].file_name, filename) == 0) - return i; - } - return -1; -} - -/* name_prefix should be in UTF-8, and can have a path. */ -static void show_output(const gchar *std_output, const gchar *name_prefix, - const gchar *force_encoding) -{ - gchar *text, *detect_enc = NULL; - gint idx, page; - GtkNotebook *book; - gchar *filename; - - filename = g_path_get_basename(name_prefix); - setptr(filename, g_strconcat(filename, ".svn.diff", NULL)); - - // need to convert input text from the encoding of the original file into - // UTF-8 because internally Geany always needs UTF-8 - if (force_encoding) - { - text = geany_data->encoding->convert_to_utf8_from_charset( - std_output, -1, force_encoding, TRUE); - } - else - { - text = geany_data->encoding->convert_to_utf8(std_output, -1, &detect_enc); - } - if (text) - { - idx = find_by_filename(filename); - if ( idx == -1) - { - idx = geany_data->document->new_file(filename, - geany_data->filetypes[GEANY_FILETYPES_DIFF], text); - } - else - { - scintilla->set_text(doc_list[idx].sci, text); - book = GTK_NOTEBOOK(app->notebook); - page = gtk_notebook_page_num(book, GTK_WIDGET(doc_list[idx].sci)); - gtk_notebook_set_current_page(book, page); - doc_list[idx].changed = FALSE; - documents->set_text_changed(idx); - } - - geany_data->document->set_encoding(idx, - force_encoding ? force_encoding : detect_enc); - } - else - { - ui->set_statusbar(FALSE, _("Could not parse the output of svn diff")); - } - g_free(text); - g_free(detect_enc); - g_free(filename); -} - -static gboolean make_revert(const gchar *svn_file) -{ - gchar *std_output = NULL; - gchar *std_error = NULL; - gint exit_code; - gchar *command = NULL; - - // use '' quotation for Windows compatibility - command = g_strdup_printf("svn revert '%s'", svn_file); - - if (g_spawn_command_line_sync(command, &std_output, &std_error, &exit_code, NULL)) - { - if (! exit_code) - { - if (NZV(std_output)) - { - ui->set_statusbar(FALSE, std_output); - } - else - { - ui->set_statusbar(FALSE, _("No changes were made.")); - return FALSE; - } - } - else - { // SVN returns some error - dialogs->show_msgbox(1, - _("SVN exited with an error: \n%s."), g_strstrip(std_error)); - return FALSE; - } - } - else - { - ui->set_statusbar(FALSE, - _("Something went really wrong. Is there any svn-binary in your path?")); - return FALSE; - } - - return TRUE; -} - -static gchar *make_diff(const gchar *svn_file) -{ - gchar *std_output = NULL; - gchar *std_error = NULL; - gint exit_code; - gchar *command, *text = NULL; - - // use '' quotation for Windows compatibility - command = g_strdup_printf("svn diff --non-interactive '%s'", svn_file); - - if (g_spawn_command_line_sync(command, &std_output, &std_error, &exit_code, NULL)) - { - if (! exit_code) - { - if (NZV(std_output)) - { - text = std_output; - } - else - { - ui->set_statusbar(FALSE, _("No changes were made.")); - } - } - else - { // SVN returns some error - dialogs->show_msgbox(1, - _("SVN exited with an error: \n%s."), g_strstrip(std_error)); - } - } - else - { - ui->set_statusbar(FALSE, - _("Something went really wrong. Is there any svn-binary in your path?")); - } - g_free(std_error); - g_free(command); - return text; -} - - -/* Make a diff from the current directory */ -static void svndirectory_activated(GtkMenuItem *menuitem, gpointer gdata) -{ - gint idx; - gchar *base_name = NULL; - gchar *locale_filename = NULL; - gchar *text; - - idx = documents->get_cur_idx(); - - g_return_if_fail(DOC_IDX_VALID(idx) && doc_list[idx].file_name != NULL); - - if (doc_list[idx].changed) - { - documents->save_file(idx, FALSE); - } - - locale_filename = utils->get_locale_from_utf8(doc_list[idx].file_name); - base_name = g_path_get_dirname(locale_filename); - - text = make_diff(base_name); - if (text) - show_output(text, base_name, NULL); - g_free(text); - - g_free(base_name); - g_free(locale_filename); -} - - -/* Callback if menu item for the current project was activated */ -static void svnproject_activated(GtkMenuItem *menuitem, gpointer gdata) -{ - gint idx; - gchar *locale_filename = NULL; - gchar *text; - - idx = documents->get_cur_idx(); - - g_return_if_fail(project != NULL && NZV(project->base_path)); - - if (DOC_IDX_VALID(idx) && doc_list[idx].changed && doc_list[idx].file_name != NULL) - { - documents->save_file(idx, FALSE); - } - - locale_filename = utils->get_locale_from_utf8(project->base_path); - text = make_diff(locale_filename); - if (text) - show_output(text, project->name, NULL); - g_free(text); - g_free(locale_filename); -} - - -/* Callback if menu item for a single file was activated */ -static void svnfile_activated(GtkMenuItem *menuitem, gpointer gdata) -{ - gint idx; - gchar *locale_filename, *text; - - idx = documents->get_cur_idx(); - - g_return_if_fail(DOC_IDX_VALID(idx) && doc_list[idx].file_name != NULL); - - if (doc_list[idx].changed) - { - documents->save_file(idx, FALSE); - } - - locale_filename = utils->get_locale_from_utf8(doc_list[idx].file_name); - - text = make_diff(locale_filename); - if (text) - show_output(text, doc_list[idx].file_name, doc_list[idx].encoding); - g_free(text); - g_free(locale_filename); -} - -/* Callback if menu item for a single file was activated */ -static void svnrevert_activated(GtkMenuItem *menuitem, gpointer gdata) -{ - gint idx; - gchar *locale_filename; - - idx = documents->get_cur_idx(); - - g_return_if_fail(DOC_IDX_VALID(idx) && doc_list[idx].file_name != NULL); - - if (dialogs->show_question(_("Do you realy want to revert '%s'?"), doc_list[idx].file_name)) - { - locale_filename = utils->get_locale_from_utf8(doc_list[idx].file_name); - - if (make_revert(locale_filename)) - { - documents->reload_file(idx, NULL); - } - g_free(locale_filename); - } -} - -static GtkWidget *menu_svndiff_file = NULL; -static GtkWidget *menu_svndiff_dir = NULL; -static GtkWidget *menu_svndiff_project = NULL; -static GtkWidget *menu_svndiff_revert = NULL; - -static void update_menu_items() -{ - document *doc; - gboolean have_file; - - doc = documents->get_current(); - have_file = doc && doc->file_name && g_path_is_absolute(doc->file_name); - - gtk_widget_set_sensitive(menu_svndiff_file, have_file); - gtk_widget_set_sensitive(menu_svndiff_dir, have_file); - gtk_widget_set_sensitive(menu_svndiff_revert, have_file); - gtk_widget_set_sensitive(menu_svndiff_project, - project != NULL && NZV(project->base_path)); -} - - -/* Called by Geany to initialize the plugin */ -void init(GeanyData *data) -{ - GtkWidget *menu_svndiff = NULL; - GtkWidget *menu_svndiff_menu = NULL; - GtkTooltips *tooltips = NULL; - gchar *tmp = NULL; - gboolean have_svn = FALSE; - - // Check for svn inside $PATH. Thanks to Yura Siamashka <yurand2(a)gmail.com> - tmp = g_find_program_in_path("svn"); - have_svn = (tmp != NULL); - g_free(tmp); - - tooltips = gtk_tooltips_new(); - - menu_svndiff = gtk_image_menu_item_new_with_mnemonic(_("_SVNdiff")); - gtk_container_add(GTK_CONTAINER(data->tools_menu), menu_svndiff); - - g_signal_connect((gpointer) menu_svndiff, "activate", - G_CALLBACK(update_menu_items), NULL); - - menu_svndiff_menu = gtk_menu_new (); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_svndiff), menu_svndiff_menu); - - // Single file - menu_svndiff_file = gtk_menu_item_new_with_mnemonic(_("From Current _File")); - gtk_container_add(GTK_CONTAINER (menu_svndiff_menu), menu_svndiff_file); - gtk_tooltips_set_tip (tooltips, menu_svndiff_file, - _("Make a diff from the current active file"), NULL); - - g_signal_connect((gpointer) menu_svndiff_file, "activate", - G_CALLBACK(svnfile_activated), NULL); - - // Directory - menu_svndiff_dir = gtk_menu_item_new_with_mnemonic(_("From Current _Directory")); - gtk_container_add(GTK_CONTAINER (menu_svndiff_menu), menu_svndiff_dir); - gtk_tooltips_set_tip (tooltips, menu_svndiff_dir, - _("Make a diff from the directory of the current active file"), NULL); - - g_signal_connect((gpointer) menu_svndiff_dir, "activate", - G_CALLBACK(svndirectory_activated), NULL); - - // Project - menu_svndiff_project = gtk_menu_item_new_with_mnemonic(_("From Current _Project")); - gtk_container_add(GTK_CONTAINER (menu_svndiff_menu), menu_svndiff_project); - gtk_tooltips_set_tip (tooltips, menu_svndiff_project, - _("Make a diff from the current project's base path"), NULL); - - g_signal_connect((gpointer) menu_svndiff_project, "activate", - G_CALLBACK(svnproject_activated), NULL); - - gtk_container_add(GTK_CONTAINER (menu_svndiff_menu), - gtk_separator_menu_item_new()); - - // SVN revert - menu_svndiff_revert = gtk_menu_item_new_with_mnemonic(_("Revert Changes")); - gtk_container_add(GTK_CONTAINER (menu_svndiff_menu), menu_svndiff_revert); - gtk_tooltips_set_tip(tooltips, menu_svndiff_revert, _("Revert all made changes at this file"), NULL); - g_signal_connect((gpointer) menu_svndiff_revert, "activate", G_CALLBACK(svnrevert_activated), NULL); - - gtk_widget_show_all(menu_svndiff); - - plugin_fields->menu_item = menu_svndiff; - if (have_svn) - plugin_fields->flags = PLUGIN_IS_DOCUMENT_SENSITIVE; - else - gtk_widget_set_sensitive(plugin_fields->menu_item, FALSE); -} - - -/* Called by Geany before unloading the plugin. */ -void cleanup() -{ - // remove the menu item added in init() - gtk_widget_destroy(plugin_fields->menu_item); -} Modified: trunk/src/editor.c =================================================================== --- trunk/src/editor.c 2007-12-01 11:27:03 UTC (rev 2083) +++ trunk/src/editor.c 2007-12-01 17:53:36 UTC (rev 2084) @@ -1030,8 +1030,9 @@ ret = autocomplete_html(sci, root, rootlen); else { - // force is set when called by keyboard shortcut, otherwise start at the 4th char - if (force || rootlen >= 4) + // force is set when called by keyboard shortcut, otherwise start at the + // editor_prefs.symbolcompletion_min_chars'th char + if (force || rootlen >= editor_prefs.symbolcompletion_min_chars) ret = autocomplete_tags(idx, root, rootlen); } Modified: trunk/src/editor.h =================================================================== --- trunk/src/editor.h 2007-12-01 11:27:03 UTC (rev 2083) +++ trunk/src/editor.h 2007-12-01 17:53:36 UTC (rev 2084) @@ -70,6 +70,7 @@ gboolean auto_complete_symbols; gboolean auto_close_xml_tags; gboolean complete_snippets; + gint symbolcompletion_min_chars; gint symbolcompletion_max_height; GHashTable *snippets; gboolean brace_match_ltgt; // whether to highlight < and > chars (hidden pref) Modified: trunk/src/geany.h =================================================================== --- trunk/src/geany.h 2007-12-01 11:27:03 UTC (rev 2083) +++ trunk/src/geany.h 2007-12-01 17:53:36 UTC (rev 2084) @@ -55,6 +55,7 @@ #define GEANY_MAX_WORD_LENGTH 192 #define GEANY_MAX_AUTOCOMPLETE_WORDS 30 #define GEANY_MAX_SYMBOLLIST_HEIGHT 10 +#define GEANY_MIN_SYMBOLLIST_CHARS 4 #define GEANY_STRING_UNTITLED _("untitled") #define GEANY_MSGWIN_HEIGHT 208 #define GEANY_WINDOW_MINIMAL_WIDTH 620 Modified: trunk/src/interface.c =================================================================== --- trunk/src/interface.c 2007-12-01 11:27:03 UTC (rev 2083) +++ trunk/src/interface.c 2007-12-01 17:53:36 UTC (rev 2084) @@ -2611,10 +2611,13 @@ GtkWidget *check_complete_snippets; GtkWidget *check_xmltag; GtkWidget *check_symbol_auto_completion; - GtkWidget *hbox6; - GtkWidget *label173; + GtkWidget *table14; GtkObject *spin_symbollistheight_adj; GtkWidget *spin_symbollistheight; + GtkWidget *label205; + GtkWidget *label173; + GtkObject *spin_symbol_complete_chars_adj; + GtkWidget *spin_symbol_complete_chars; GtkWidget *label177; GtkWidget *label95; GtkWidget *vbox18; @@ -2625,10 +2628,10 @@ GtkWidget *eventbox1; GtkWidget *combo_new_encoding; GtkWidget *label153; - GtkWidget *check_open_encoding; GtkWidget *label_open_encoding; GtkWidget *eventbox3; GtkWidget *combo_open_encoding; + GtkWidget *check_open_encoding; GtkWidget *label109; GtkWidget *frame2; GtkWidget *alignment3; @@ -3702,22 +3705,44 @@ gtk_tooltips_set_tip (tooltips, check_symbol_auto_completion, _("Automatic completion of known symbols in open files (function names, global variables, ...)"), NULL); gtk_button_set_focus_on_click (GTK_BUTTON (check_symbol_auto_completion), FALSE); - hbox6 = gtk_hbox_new (FALSE, 12); - gtk_widget_show (hbox6); - gtk_box_pack_start (GTK_BOX (vbox19), hbox6, FALSE, FALSE, 0); + table14 = gtk_table_new (2, 2, FALSE); + gtk_widget_show (table14); + gtk_box_pack_start (GTK_BOX (vbox19), table14, FALSE, FALSE, 0); + gtk_table_set_row_spacings (GTK_TABLE (table14), 3); + gtk_table_set_col_spacings (GTK_TABLE (table14), 12); - label173 = gtk_label_new (_("Rows of symbol completion list:")); - gtk_widget_show (label173); - gtk_box_pack_start (GTK_BOX (hbox6), label173, FALSE, FALSE, 0); - gtk_misc_set_alignment (GTK_MISC (label173), 0, 0.5); - - spin_symbollistheight_adj = gtk_adjustment_new (10, 1, 99, 1, 10, 10); + spin_symbollistheight_adj = gtk_adjustment_new (9, 1, 99, 1, 10, 10); spin_symbollistheight = gtk_spin_button_new (GTK_ADJUSTMENT (spin_symbollistheight_adj), 1, 0); gtk_widget_show (spin_symbollistheight); - gtk_box_pack_start (GTK_BOX (hbox6), spin_symbollistheight, FALSE, TRUE, 0); + gtk_table_attach (GTK_TABLE (table14), spin_symbollistheight, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); gtk_tooltips_set_tip (tooltips, spin_symbollistheight, _("Number of rows to display in the autocompletion list."), NULL); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_symbollistheight), TRUE); + label205 = gtk_label_new (_("Characters to type for completion:")); + gtk_widget_show (label205); + gtk_table_attach (GTK_TABLE (table14), label205, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (label205), 0, 0.5); + + label173 = gtk_label_new (_("Rows of symbol completion list:")); + gtk_widget_show (label173); + gtk_table_attach (GTK_TABLE (table14), label173, 0, 1, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (label173), 0, 0.5); + + spin_symbol_complete_chars_adj = gtk_adjustment_new (9, 1, 99, 1, 10, 10); + spin_symbol_complete_chars = gtk_spin_button_new (GTK_ADJUSTMENT (spin_symbol_complete_chars_adj), 1, 0); + gtk_widget_show (spin_symbol_complete_chars); + gtk_table_attach (GTK_TABLE (table14), spin_symbol_complete_chars, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_tooltips_set_tip (tooltips, spin_symbol_complete_chars, _("The amount of characters which are necessary to show the symbol auto completion list."), NULL); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_symbol_complete_chars), TRUE); + label177 = gtk_label_new (_("<b>Completions</b>")); gtk_widget_show (label177); gtk_frame_set_label_widget (GTK_FRAME (frame18), label177); @@ -3749,7 +3774,6 @@ gtk_widget_show (table5); gtk_box_pack_start (GTK_BOX (vbox8), table5, FALSE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table5), 3); - gtk_table_set_col_spacings (GTK_TABLE (table5), 12); eventbox1 = gtk_event_box_new (); gtk_widget_show (eventbox1); @@ -3769,24 +3793,16 @@ (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label153), 0, 0.5); - check_open_encoding = gtk_check_button_new_with_mnemonic (_("Use fixed encoding when opening files")); - gtk_widget_show (check_open_encoding); - gtk_table_attach (GTK_TABLE (table5), check_open_encoding, 0, 2, 2, 3, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_tooltips_set_tip (tooltips, check_open_encoding, _("This option disables the automatic detection of the file encoding when opening files and opens the file with the specified encoding (usually not needed)."), NULL); - gtk_button_set_focus_on_click (GTK_BUTTON (check_open_encoding), FALSE); - label_open_encoding = gtk_label_new (_("Default encoding (existing files):")); gtk_widget_show (label_open_encoding); - gtk_table_attach (GTK_TABLE (table5), label_open_encoding, 0, 1, 1, 2, + gtk_table_attach (GTK_TABLE (table5), label_open_encoding, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label_open_encoding), 0, 0.5); eventbox3 = gtk_event_box_new (); gtk_widget_show (eventbox3); - gtk_table_attach (GTK_TABLE (table5), eventbox3, 1, 2, 1, 2, + gtk_table_attach (GTK_TABLE (table5), eventbox3, 1, 2, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); gtk_tooltips_set_tip (tooltips, eventbox3, _("Sets the default encoding for opening existing files."), NULL); @@ -3795,6 +3811,14 @@ gtk_widget_show (combo_open_encoding); gtk_container_add (GTK_CONTAINER (eventbox3), combo_open_encoding); + check_open_encoding = gtk_check_button_new_with_mnemonic (_("Use fixed encoding when opening files")); + gtk_widget_show (check_open_encoding); + gtk_table_attach (GTK_TABLE (table5), check_open_encoding, 0, 2, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_tooltips_set_tip (tooltips, check_open_encoding, _("This option disables the automatic detection of the file encoding when opening files and opens the file with the specified encoding (usually not needed)."), NULL); + gtk_button_set_focus_on_click (GTK_BUTTON (check_open_encoding), FALSE); + label109 = gtk_label_new (_("<b>New files</b>")); gtk_widget_show (label109); gtk_frame_set_label_widget (GTK_FRAME (frame6), label109); @@ -4536,9 +4560,11 @@ GLADE_HOOKUP_OBJECT (prefs_dialog, check_complete_snippets, "check_complete_snippets"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_xmltag, "check_xmltag"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_symbol_auto_completion, "check_symbol_auto_completion"); - GLADE_HOOKUP_OBJECT (prefs_dialog, hbox6, "hbox6"); + GLADE_HOOKUP_OBJECT (prefs_dialog, table14, "table14"); + GLADE_HOOKUP_OBJECT (prefs_dialog, spin_symbollistheight, "spin_symbollistheight"); + GLADE_HOOKUP_OBJECT (prefs_dialog, label205, "label205"); GLADE_HOOKUP_OBJECT (prefs_dialog, label173, "label173"); - GLADE_HOOKUP_OBJECT (prefs_dialog, spin_symbollistheight, "spin_symbollistheight"); + GLADE_HOOKUP_OBJECT (prefs_dialog, spin_symbol_complete_chars, "spin_symbol_complete_chars"); GLADE_HOOKUP_OBJECT (prefs_dialog, label177, "label177"); GLADE_HOOKUP_OBJECT (prefs_dialog, label95, "label95"); GLADE_HOOKUP_OBJECT (prefs_dialog, vbox18, "vbox18"); @@ -4549,10 +4575,10 @@ GLADE_HOOKUP_OBJECT (prefs_dialog, eventbox1, "eventbox1"); GLADE_HOOKUP_OBJECT (prefs_dialog, combo_new_encoding, "combo_new_encoding"); GLADE_HOOKUP_OBJECT (prefs_dialog, label153, "label153"); - GLADE_HOOKUP_OBJECT (prefs_dialog, check_open_encoding, "check_open_encoding"); GLADE_HOOKUP_OBJECT (prefs_dialog, label_open_encoding, "label_open_encoding"); GLADE_HOOKUP_OBJECT (prefs_dialog, eventbox3, "eventbox3"); GLADE_HOOKUP_OBJECT (prefs_dialog, combo_open_encoding, "combo_open_encoding"); + GLADE_HOOKUP_OBJECT (prefs_dialog, check_open_encoding, "check_open_encoding"); GLADE_HOOKUP_OBJECT (prefs_dialog, label109, "label109"); GLADE_HOOKUP_OBJECT (prefs_dialog, frame2, "frame2"); GLADE_HOOKUP_OBJECT (prefs_dialog, alignment3, "alignment3"); Modified: trunk/src/keyfile.c =================================================================== --- trunk/src/keyfile.c 2007-12-01 11:27:03 UTC (rev 2083) +++ trunk/src/keyfile.c 2007-12-01 17:53:36 UTC (rev 2084) @@ -198,6 +198,7 @@ // editor g_key_file_set_integer(config, PACKAGE, "symbolcompletion_max_height", editor_prefs.symbolcompletion_max_height); + g_key_file_set_integer(config, PACKAGE, "symbolcompletion_min_chars", editor_prefs.symbolcompletion_min_chars); g_key_file_set_boolean(config, PACKAGE, "use_folding", editor_prefs.folding); g_key_file_set_boolean(config, PACKAGE, "unfold_all_children", editor_prefs.unfold_all_children); g_key_file_set_integer(config, PACKAGE, "indent_mode", editor_prefs.indent_mode); @@ -487,6 +488,7 @@ editor_prefs.long_line_type = utils_get_setting_integer(config, PACKAGE, "long_line_type", 0); editor_prefs.long_line_color = utils_get_setting_string(config, PACKAGE, "long_line_color", "#C2EBC2"); editor_prefs.long_line_column = utils_get_setting_integer(config, PACKAGE, "long_line_column", 72); + editor_prefs.symbolcompletion_min_chars = utils_get_setting_integer(config, PACKAGE, "symbolcompletion_min_chars", GEANY_MIN_SYMBOLLIST_CHARS); editor_prefs.symbolcompletion_max_height = utils_get_setting_integer(config, PACKAGE, "symbolcompletion_max_height", GEANY_MAX_SYMBOLLIST_HEIGHT); editor_prefs.line_wrapping = utils_get_setting_boolean(config, PACKAGE, "line_breaking", FALSE); // default is off for better performance editor_prefs.indent_mode = utils_get_setting_integer(config, PACKAGE, "indent_mode", INDENT_CURRENTCHARS); Modified: trunk/src/plugindata.h =================================================================== --- trunk/src/plugindata.h 2007-12-01 11:27:03 UTC (rev 2083) +++ trunk/src/plugindata.h 2007-12-01 17:53:36 UTC (rev 2084) @@ -93,12 +93,12 @@ /* The API version should be incremented whenever any plugin data types below are * modified or appended to. */ -static const gint api_version = 32; +static const gint api_version = 33; /* The ABI version should be incremented whenever existing fields in the plugin * data types below have to be changed or reordered. It should stay the same if fields * are only appended, as this doesn't affect existing fields. */ -static const gint abi_version = 16; +static const gint abi_version = 17; /* This performs runtime checks that try to ensure: * 1. Geany ABI data types are compatible with this plugin. @@ -211,6 +211,7 @@ gint (*new_file) (const gchar *filename, struct filetype *ft, const gchar *text); gint (*get_cur_idx) (); gint (*get_n_idx) (guint i); + gint (*find_by_filename) (const gchar *filename, gboolean is_tm_filename); struct document* (*get_current) (); gboolean (*save_file)(gint idx, gboolean force); gint (*open_file)(const gchar *locale_filename, gboolean readonly, Modified: trunk/src/plugins.c =================================================================== --- trunk/src/plugins.c 2007-12-01 11:27:03 UTC (rev 2083) +++ trunk/src/plugins.c 2007-12-01 17:53:36 UTC (rev 2084) @@ -87,6 +87,7 @@ &document_new_file, &document_get_cur_idx, &document_get_n_idx, + &document_find_by_filename, &document_get_current, &document_save_file, &document_open_file, Modified: trunk/src/prefs.c =================================================================== --- trunk/src/prefs.c 2007-12-01 11:27:03 UTC (rev 2083) +++ trunk/src/prefs.c 2007-12-01 17:53:36 UTC (rev 2084) @@ -403,7 +403,10 @@ widget = lookup_widget(ui_widgets.prefs_dialog, "spin_symbollistheight"); gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.symbolcompletion_max_height); + widget = lookup_widget(ui_widgets.prefs_dialog, "spin_symbol_complete_chars"); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.symbolcompletion_min_chars); + // Tools Settings if (prefs.tools_make_cmd) gtk_entry_set_text(GTK_ENTRY(lookup_widget(ui_widgets.prefs_dialog, "entry_com_make")), prefs.tools_make_cmd); @@ -774,6 +777,9 @@ widget = lookup_widget(ui_widgets.prefs_dialog, "check_symbol_auto_completion"); editor_prefs.auto_complete_symbols = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); + widget = lookup_widget(ui_widgets.prefs_dialog, "spin_symbol_complete_chars"); + editor_prefs.symbolcompletion_min_chars = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); + widget = lookup_widget(ui_widgets.prefs_dialog, "spin_symbollistheight"); editor_prefs.symbolcompletion_max_height = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: geany: [2083] trunk
by eht16@users.sourceforge.net
01 Dec '07
01 Dec '07
Revision: 2083
http://geany.svn.sourceforge.net/geany/?rev=2083&view=rev
Author: eht16 Date: 2007-12-01 03:27:03 -0800 (Sat, 01 Dec 2007) Log Message: ----------- Avoid inclusion of PHP tags in PHP function descriptions. Modified Paths: -------------- trunk/ChangeLog trunk/src/templates.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-11-30 18:06:10 UTC (rev 2082) +++ trunk/ChangeLog 2007-12-01 11:27:03 UTC (rev 2083) @@ -1,3 +1,9 @@ +2007-12-01 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + + * src/templates.c: + Avoid inclusion of PHP tags in PHP function descriptions. + + 2007-11-30 Frank Lanitz <frank(at)frank(dot)uvena(dot)de> * src/filetypes.c, data/filetypes.conf: Modified: trunk/src/templates.c =================================================================== --- trunk/src/templates.c 2007-11-30 18:06:10 UTC (rev 2082) +++ trunk/src/templates.c 2007-12-01 11:27:03 UTC (rev 2083) @@ -146,7 +146,10 @@ }\n\ "; -static const gchar templates_filetype_php[] = "{fileheader}\n\ +static const gchar templates_filetype_php[] = "\ +<?php\n\ +{fileheader}\ +?>\n\n\ <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\ \"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\
">\n\ <html xmlns=\"
http://www.w3.org/1999/xhtml\
" xml:lang=\"en\" lang=\"en\">\n\ @@ -454,8 +457,8 @@ case GEANY_FILETYPES_PHP: { - frame_start = "<?php\n/*\n"; - frame_end = " */\n?>\n"; + frame_start = "/*\n"; + frame_end = " */\n"; line_prefix = " *"; break; } This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
← Newer
1
2
3
4
5
6
Older →
Jump to page:
1
2
3
4
5
6
Results per page:
10
25
50
100
200