sciteproj-1.14/0000755000175000017500000000000013542152470013014 5ustar gusnangusnansciteproj-1.14/sciteproj.desktop0000644000175000017500000000037013542152470016411 0ustar gusnangusnan[Desktop Entry] Name=SciteProj Type=Application Comment=Project manager for the Scintilla Text Editor (SciTE) Comment[sv]=Projekt-hanterare för Scintilla Text Editor (SciTE) Exec=sciteproj Icon=sciteproj Categories=Development;IDE; Terminal=false sciteproj-1.14/ChangeLog0000644000175000017500000002335513542152470014576 0ustar gusnangusnan ChangeLog: ---------- 1.14 * Create folder for man page in Makefile * Minor formatting fixes 1.13 * Pack and install man-page * Make it possible to close about dialog using ESC * Various minor code fixes 1.12 * Remove GTK2 compatibility header file * Minor fixes * Make pkg-config substitutable * Make it easier to build on Windows 1.11 * Remove checks for GTK version, we require GTK 3 from now on * Update required LUA version to 5.3 1.10 * Fix webpage link in about dialog 1.09 * Fix transient parent to dialogs, fixes warnings to stdout * Clean up cppcheck output * Various small fixes 1.08 * Fix sizes of properties dialog * Fix output of GTK warnings in terminal * Update the text of the recent file menu item * Update my email address * Update Swedish translation 1.07 * Fix typo Coudn't/Couldn't * Fixed more missing NULL-checks 1.06 * Various formatting fixes, source cleanups * Add GTK 3.22 versions of menu popups 1.05 * Update copyright years * Fix gtk_misc_set_alignment warnings * Fix Swedish translation of descending * Update translation example with valid language code * Remove unused Swedish translations, cleaning up the po-file * Don't use deprecated cursor functions * Formatting and whitespace fixes * Makefile: make CC customizable 1.04 * Fix manpage commenting 1.02 * Also mention installing required liblua5.1-0-dev in INSTALL * Fix copyright headers and specify licenses * Fix homepage address 1.01 * Add GPL header in several more places * Remove date and version from man-page * Some formatting fixes 1.00 * Remove functionality to rename and the required files * Remove GTK_STOCK stuff to make it build cleanly on GTK3 * Simplify menus * Make sure menu items are translated * Update Swedish translation 0.7.96 * Fix build system not including CPPFLAGS 0.7.95 * Remove XML-based project file loading and saving - work directly on folder using filters and sorting instead. * Load prefs from setup file in the requested folder, and secondarily (if an option doesn't exist here), check in the user config folder. * Remove search functionality - "Find in Files" is already available in SciTE. * Add option start_scite to start scite immediately on sciteproj start * Require LUA for the config file loading * Remove some functions for deleting files and creating folders * Don't use g_type_init on newer versions of glib 0.7.05 * Fix menu translations context to actually work * Move gui_callbacks to own sourcefiles * Move menu stuff to a header * Update manpage 0.7.04 * Remove translation context from a string where it isn't required (and causes build failure) 0.7.03 * Add context to menu translatable strings * Updated build instructions with gettext info * Removed printing non-informational error numbers 0.7.02 * Really fix the dependency generation 0.7.01 * Add LIB_CFLAGS to dependency generation in Makefile 0.7.00 * Make it possible to hide the statusbar to save screen space * Made SciteProj translatable using gettext * Complete GTK3 migration * Add linking on gthread-2.0 0.6.06 * Update makefile to nicely use obj folder again 0.6.05 * Make build use INSTALL_PREFIX flag to simplify packaging 0.6.04 * Move libraries to after objects in linker call, allowing to build with --as-needed * Whitespace fixes 0.6.03 * More makefile fixes to support both prefix and DESTDIR 0.6.02 * Fixes to the makefile, fixing the depends, fixed flags order 0.6.01 * Update build flags to include standard system build flags * install sciteproj icon to correct place 0.6.00 * Use g_get_user_config_dir to get where to put the config file, if it doesn't exist, copy the configfile from ~/.sciteproj * Make code GTK3 compatible * Remove Cmake stuff and use a basic Makefile instead * Update makefile to use GTK3 by default (add GTK2=1 to make command to use GTK2 during compilation) 0.5.11 * Added icons for lua and java files * Fix minor warning (-Wformat-security) 0.5.10 * Removed a debug printf * Fixed warnings caused by new version of gcc * Added missing clicked_node.h to project file * Removed making a busy cursor in the search code, one was already created in the graphics codes * Fixed homepage in the about dialog * Some minor code cleanups * Fix minus-sign in the man page 0.5.01 * Fix a cppcheck warning (writing to non-initialized char pointer) * Man-page updates 0.5.00 * Added a search dialog * Fixed problems with the prefs system * Documentation updates 0.4.10 * Added a "Recently opened files" box * Updated in-source commenting * Updated documentation * Split up the GUI code into several files * Redesigned the About-dialog * Removed the TODO file - it kept getting invalid 0.4.01 * Made the rename functionality rename in the treeview, instead of using another dialog 0.4.00 * Implemented Treeview quick search * Updated desktop comment wording * Mem leaks fixed * Code cleanups * Split the clipboard stuff to files of their own * Fixed a problem with the --generate option 0.3.22 * Fixed slash problems * Spelling fixes 0.3.21 * Fixed double slash in generated project files * Minor updates to documentation * Rephrased warnings * Debug updates 0.3.20 * Better checks for return values of changedirs 0.3.19 * Fixed exit codes * Fixed cppcheck reports * Many minor fixes (unused variables removed and stuff like that) 0.3.18 * Added and implemented --generate option * Fixed minor memory leaks 0.3.17 * Added menu item to copy filename+full path to clipboard * man-page updates * Documentation updates 0.3.16 * Remove mms-bitfields build option 0.3.15 * Fixed stuff that was deprecated in newer GTK * Update version in man-page 0.3.14 * Even more fixes to build system 0.3.12 * Fixes to build system 0.3.11 * Fixed includes and libraries 0.3.10 * Added /usr/include/gdk-pixbuf-2.0 to CFLAGS * Completely removed search dialog 0.3.9 * Documentation updates * Split INSTALL from the README file * Cleaned up statusbar code 0.3.8 * Documentation fixes * Updated .desktop file * Check for Scite in more places 0.3.7 * Tweaked CMakeLists.txt to avoid GTK-related debuild build warnings * Updated homepage in the about-dialog 0.3.6 * Added man page * Removed unnecessary Apache license 0.3.5 * Removed GTK modules (they are included in Cmake in debian post lenny) 0.3.4 * Fixed the SciteProj xml project file referencing removed stuff * Fixed copyright details 0.3.3 * Remove homepage from source control * Cleaned up gui.c 0.3.2 * Put GPL in header files too * Desktop file fixes 0.3.1 * Windows version * Removed Scite connection checkbox * Removed everything that isn't portable * Removed C++ stuff - code is purely C now * Made delete button work to remove items too. * Moved rename code to a source file of its own * Fixed order of added files 0.3.0 * Streamlined CMakeLists * Made homepage XHTML Transitional * Removed gfileutils_local files (Upping the GLib requirement) * Show SciTE status in SciteProj statusbar * Updates to statusbar infotext * Search dialog * Better checks for SciTE existance * Added file_to_load option to config file * More memory leaks fixed 0.2.7 * minor bugs * went from GTK's command line options to own code (easier to translate?) * moved show_version to about.c * Fixed image and desktop file 0.2.6 * Added more places to check for SciTE * Made it possible to use customized SciTE executable filename * Documentation updates * Made it check for Scite in SciTE_HOME too 0.2.5 * Several memory leaks fixed * More comments in source * Documentation updates * Updates to the add file error dialog * Compilation warnings fixed * Fixed cmake stuff * No cmake check for c++ 0.2.4 * Fixed memory leaks * Made icons compiled into the executable instead of external PNG's * Minor bugs fixed * Documentation updates * Made error reporting when adding files better 0.2.3 * Switched to g_option_context * Added commandline setting for customizable graphics folder * Added menu item for opening the options file * Fixed location of files that are added through main menu add item * Debug information in about dialog * Documentation updates * Made it possible to delete via keyboard * Removed ChangeLog from homepage * Added allow_duplicates option 0.2.2 * Fixed graphics search folders * Removed unused variables * Made the file selector remember last folder it added from * Added abort_add_on_duplicate preference * Added folder sorting functionality * Minor changes 0.2.1 * Added dirty_on_folder_change preference * Added Expand All Groups and Collapse All Groups menu items * Fixed about dialog scrollbar policy and usage dialog scrollbar policy * Added checkbox showing if there is an active connection to SciTE * Added Save As menu item * Added some system information to about dialog * Added ChangeLog 0.2.0 * Made the program save info about folder open/closed status to the project XML file. 0.1.7 * Fixed folder icon bugs * Group properties dialog 0.1.6 * Fixed order of files in the XML project file * Debug mode warnings removed * File properties dialog 0.1.5 * Fixed project file sorting 0.1.4 * Fixed errorhandling in preferences bug 0.1.3 * Removed calls to unfinished code 0.1.2 * Changed scrollbar policy * Began on folder-structure to XML converter * New About-dialog 0.1.1 * Made it possible to open several items in one go using the rightclick menu * Various string code fixes * Homepage updates 0.1 * Initial release -------------------------------------------------------------------------------- Copyright (C) 2010-2017 Andreas Rönnquist This file is distributed under the same license as the sciteproj package, see COPYING file. -------------------------------------------------------------------------------- sciteproj-1.14/obj/0000755000175000017500000000000013542152470013566 5ustar gusnangusnansciteproj-1.14/obj/placeholder.txt0000644000175000017500000000000013542152470016577 0ustar gusnangusnansciteproj-1.14/INSTALL0000644000175000017500000000176113542152470014052 0ustar gusnangusnan# # Copyright (C) 2010-2018 Andreas Rönnquist # This file is distributed under the same license # as the sciteproj package, see COPYING file. # Installation: ------------- To build, first check that you have the packages required. The ones required to build are: pkg-config libgtk-3-dev liblua5.3-dev gettext Then the build process is simple - to build the program, just type make which will in the end create an executable in the bin folder. If you want to build an executable with debug symbols enable, run make DEBUG=1 To install the program run make install with super user priviliges, on a system using root: su -c "make install" or on a system using sudo, run sudo make install This will install the program in the system. This installs a desktop file too, so now you should have an icon in the development part of your X menu. This will default to /usr/local, installing the executable to /usr/local/bin. This can be changed using PREFIX variable: make install PREFIX=/usr sciteproj-1.14/po/0000755000175000017500000000000013542152470013432 5ustar gusnangusnansciteproj-1.14/po/sv.po0000644000175000017500000001740413542152470014430 0ustar gusnangusnan# Swedish translation of SciteProj # Copyright (C) 2012-2017 Andreas Rönnquist # This file is distributed under the same license as the sciteproj package. # Andreas Rönnquist , 2012-2017. # # msgid "" msgstr "" "Project-Id-Version: sciteproj 1.07\n" "Report-Msgid-Bugs-To: andreas@ronnquist.net\n" "POT-Creation-Date: 2017-08-25 18:00+0200\n" "PO-Revision-Date: 2017-08-25 18:01+0200\n" "Last-Translator: Andreas Rönnquist \n" "Language-Team: Swedish\n" "Language: sv\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 1.8.11\n" #: about.c:194 msgid "Information" msgstr "Information" #: about.c:195 msgid "License" msgstr "Licens" #: about.c:203 msgid "" "SciteProj is free software: you can redistribute it and/or modify it under " "the terms of the GNU General Public License as published by the Free " "Software Foundation, either version 3 of the License, or (at your option) " "any later version.\n" "\n" "SciteProj 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.\n" "\n" "You should have received a copy of the GNU General Public License along with " "SciteProj. If not, see .\n" msgstr "" "SciteProj är fri mjukvara: du kan redistribuera det och/eller modifiera det " "enligt villkoren i GNU General Public License som publicerad av the Free " "Software Foundation; enligt version 3, eller (efter ditt eget val) någon " "senare version.\n" "\n" "SciteProj distribueras med förhoppningen att det kommer att vara användbart, " "men UTAN NÅGON SOM HELST GARANTI; utan ens den implicita garantin av " "SÄLJBARHET eller ÄNDAMÅLSENLIGHET FÖR NÅGOT SÄRSKILT SYFTE. Se GNU General " "Public License för fler detaljer.\n" "\n" "Du bör ha fått en kopia av GNU General Public License tillsammans med detta " "program; om inte, se .\n" #: about.c:250 msgid "SciteProj is based on ScitePM by" msgstr "SciteProj är baserat på ScitePM av" #: about.c:251 msgid "Many thanks to" msgstr "Många tack till" #: about.c:252 msgid "" "For more information about SciteProj, see the README file that\n" "is provided with this package." msgstr "" "För mer information om SciteProj, se README-filen som\n" "är bifogad med detta paket." #: about.c:385 #, c-format msgid "version %s" msgstr "version %s" #: gui.c:141 msgid "[UNTITLED]" msgstr "[NAMNLÖS]" #: gui.c:774 recent_files.c:557 scite_utils.c:216 #, c-format msgid "Opened %s" msgstr "Öppnade %s" #: gui.c:787 gui_callbacks.c:95 recent_files.c:570 recent_files.c:611 #, c-format msgid "" "Could not open selected file: \n" "\n" "%s" msgstr "" "Kunde inte öppna vald fil: \n" "\n" "%s" #: main.c:69 msgid "Show program version and quit" msgstr "Visa programversion och avsluta" #: main.c:72 msgid "Set a filename for the instance of SciTE to open" msgstr "Sätt ett filnamn för instansen av SciTE du önskar köra" #: main.c:72 msgid "SCITE_FILENAME" msgstr "SCITE_FILNAMN" #: main.c:75 msgid "Load a folder" msgstr "Ladda en mapp" #: main.c:78 msgid "Start SciTE automatically with SciteProj" msgstr "Starta SciTE automatiskt med SciteProj" #: main.c:90 msgid "SciTE Project Manager" msgstr "SciTE Projekthanterare" #: main.c:97 #, c-format msgid "option parsing failed: %s" msgstr "tolkning av alternativ misslyckades: %s" #: main.c:141 #, c-format msgid "A folder is expected as parameter to sciteproj..." msgstr "En mapp väntas som parameter till sciteproj..." #: main.c:180 main.c:190 msgid "" "Environment variable exists, but doesn't point to a folder containing scite." msgstr "" "Miljövariabeln finns, men hänvisar inte till någon mapp som innehåller scite." #: main.c:207 #, c-format msgid "Couldn't find a SciTE executable named '%s'!\n" msgstr "Kunde inte hitta en körbar fil för SciTE med namnet '%s'!\n" #: main.c:208 msgid "Checking for SciTE in the standard locations instead.\n" msgstr "Kollar efter SciTE på standard-platserna istället.\n" #: main.c:221 msgid "" "Warning! Couldn't locate SciTE!\n" "Program will start, but you won't be able to open SciTE to edit files." msgstr "" "Varning! Kunde inte hitta SciTE!\n" "Programmet kommer att starta, men du kommer inte kunna använda SciTE för att " "editera filer." #: main.c:229 #, c-format msgid "Could not setup the gui: %s" msgstr "Kunde inte ställa in GUI: %s" #: main.c:235 #, c-format msgid "Not a valid folder!" msgstr "Inte en giltig mapp!" #: menus.c:117 msgid "_File" msgstr "_Arkiv" #: menus.c:118 msgid "_Edit" msgstr "R_edigera" #: menus.c:119 msgid "_View" msgstr "_Visa" #: menus.c:120 msgid "_Help" msgstr "_Hjälp" #: menus.c:129 msgid "_Quit" msgstr "Avsluta" #: menus.c:138 msgid "Edit properties" msgstr "Editera egenskaper" #: menus.c:144 msgid "Show Recently Opened Files" msgstr "Visa nyligen öppnade filer" #: menus.c:151 msgid "About" msgstr "_Om" #: menus.c:164 menus.c:236 msgid "Open file in SciTE" msgstr "Öppna fil i SciTE" #: menus.c:167 menus.c:238 msgid "Copy filename to clipboard" msgstr "Kopiera filnamn till urklipp" #: menus.c:173 menus.c:210 menus.c:239 msgid "Properties" msgstr "Egenskaper" #: menus.c:183 msgid "Sort folder contents" msgstr "Sortera mappinnehåll" #: menus.c:185 msgid "Sort ascending by name" msgstr "Sortera mapp stigande efter namn" #: menus.c:186 msgid "Sort descending by name" msgstr "Sortera mapp fallande efter namn" #: menus.c:188 msgid "Sort ascending by extension" msgstr "Sortera mapp stigande efter filändelse" #: menus.c:189 msgid "Sort descending by extension" msgstr "Sortera mapp fallande efter filändelse" #: menus.c:212 msgid "Update folder content" msgstr "Uppdatera mappinnehåll" #: menus.c:237 msgid "Remove file from this list" msgstr "Ta bort fil från denna lista" #: properties_dialog.c:76 properties_dialog.c:79 msgid "Group Properties" msgstr "Mappegenskaper" #: properties_dialog.c:77 properties_dialog.c:171 msgid "OK" msgstr "OK" #: properties_dialog.c:85 msgid "Group name:" msgstr "Gruppnamn:" #: properties_dialog.c:86 msgid "Full folder:" msgstr "Fullt mappnamn:" #: properties_dialog.c:170 properties_dialog.c:173 msgid "File Properties" msgstr "Filegenskaper" #: properties_dialog.c:197 msgid "Filename:" msgstr "Filnamn:" #: properties_dialog.c:198 msgid "Path:" msgstr "Sökväg:" #: properties_dialog.c:199 msgid "File size:" msgstr "Filstorlek:" #: recent_files.c:177 msgid "Recently opened files:" msgstr "Nyligen öppnade filer:" #: remove.c:218 remove.c:223 msgid "Error!!!\n" msgstr "Fel!!!\n" #: remove.c:373 msgid "Delete all selected items?" msgstr "Ta bort alla valda objekt?" #: remove.c:404 #, c-format msgid "Delete file '%s'?" msgstr "Ta bort fil '%s'?" #: remove.c:407 msgid "Delete file?" msgstr "Ta bort fil?" #: remove.c:437 #, c-format msgid "Delete folder '%s' and any contained files?" msgstr "Ta bort mappen '%s' och alla filer som den innehåller?" #: remove.c:440 msgid "Delete folder and any contained files?" msgstr "Ta bort mapp och dess innehåll?" #: remove.c:468 #, c-format msgid "" "Could not delete the selected node: \n" "\n" "%s" msgstr "" "Kunde inte ta bort vald nod: \n" "\n" "%s" #: scite_utils.c:190 #, c-format msgid "Closed %s" msgstr "Stängde %s" #: scite_utils.c:199 msgid "Closed SciTE" msgstr "Stängde SciTE" #: scite_utils.c:206 #, c-format msgid "Switched to %s" msgstr "Växlade till %s" #: scite_utils.c:589 msgid "Connecting to Scite...." msgstr "Ansluter till Scite...." #: scite_utils.c:638 msgid "Launched SciTE" msgstr "Startade SciTE" #: script.c:144 #, c-format msgid "Error: %s" msgstr "Fel:%s" #: statusbar.c:57 msgid "Welcome to SciteProj\n" msgstr "Välkommen till SciteProj\n" sciteproj-1.14/po/Makefile0000644000175000017500000000343013542152470015072 0ustar gusnangusnan# # Copyright (C) 2009-2017 Andreas Rönnquist # This file is distributed under the same license # as the sciteproj package, see COPYING file. # ifndef PREFIX ifdef INSTALL_PREFIX PREFIX=$(INSTALL_PREFIX) else PREFIX=/usr/local endif endif NAME = sciteproj VERSION = $(shell cat ../VERSION) DATADIR = ${DESTDIR}${PREFIX}/share LOCALEDIR = ${DATADIR}/locale SOURCES = about.c clipboard.c file_utils.c expand.c\ folder_config.c graphics.c gui.c gui_callbacks.c load_folder.c\ main.c menus.c prefs.c properties_dialog.c recent_files.c remove.c\ scite_utils.c script.c sort.c statusbar.c string_utils.c tree_manipulation.c\ menus.h XG_ARGS = --keyword=_ --keyword=N_ --keyword=NC_:1c,2 -w 80 --package-name=${NAME} --package-version=${VERSION} --msgid-bugs-address=andreas@ronnquist.net LANGUAGES = sv # LANGUAGES_MO = $(foreach currlang,$(LANGUAGES),$(currlang).mo) LANGUAGES_PO = $(foreach currlang,$(LANGUAGES),$(currlang).po) all: build ${NAME}.pot: xgettext ${XG_ARGS} --directory=../src/ ${SOURCES} -d ${NAME} -o ./${NAME}.pot update-pot: ${NAME}.pot %.pox: %.po msgmerge -o $@ --previous $< ${NAME}.pot build: $(LANGUAGES_MO) $(LANGUAGES_MO): $(LANGUAGES_PO) for po in ${LANGUAGES}; \ do msgfmt -v --statistics -c -o t-$${po} $${po}.po && mv -f t-$${po} $${po}.mo; \ done install: all install-dirs for po in ${LANGUAGES}; \ do install -m 0644 $${po}.mo ${LOCALEDIR}/$${po}/LC_MESSAGES/${NAME}.mo; \ done install-dirs: for po in ${LANGUAGES}; \ do install -d ${LOCALEDIR}/$${po}/LC_MESSAGES; \ done uninstall: for po in ${LANGUAGES}; \ do rm -f ${LOCALEDIR}/$${po}/LC_MESSAGES/${NAME}.mo; \ done clean-build: rm -f *.mo clean-pox: rm -f *.pox clean: clean-build rm -f *~ .PHONY: all build install install-dirs uninstall clean clean-pox clean-build update-pot sciteproj-1.14/po/sciteproj.pot0000644000175000017500000001257113542152470016166 0ustar gusnangusnan# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the sciteproj package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: sciteproj 1.12\n" "Report-Msgid-Bugs-To: andreas@ronnquist.net\n" "POT-Creation-Date: 2019-01-15 16:29+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: about.c:157 msgid "Information" msgstr "" #: about.c:158 msgid "License" msgstr "" #: about.c:166 msgid "" "SciteProj is free software: you can redistribute it and/or modify it under " "the terms of the GNU General Public License as published by the Free Software " "Foundation, either version 3 of the License, or (at your option) any later " "version.\n" "\n" "SciteProj 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.\n" "\n" "You should have received a copy of the GNU General Public License along with " "SciteProj. If not, see .\n" msgstr "" #: about.c:213 msgid "SciteProj is based on ScitePM by" msgstr "" #: about.c:214 msgid "Many thanks to" msgstr "" #: about.c:215 msgid "" "For more information about SciteProj, see the README file that\n" "is provided with this package." msgstr "" #: about.c:329 #, c-format msgid "version %s" msgstr "" #: gui.c:125 msgid "[UNTITLED]" msgstr "" #: gui.c:537 recent_files.c:545 scite_utils.c:216 #, c-format msgid "Opened %s" msgstr "" #: gui.c:550 gui_callbacks.c:93 recent_files.c:558 recent_files.c:599 #, c-format msgid "" "Could not open selected file: \n" "\n" "%s" msgstr "" #: main.c:69 msgid "Show program version and quit" msgstr "" #: main.c:72 msgid "Set a filename for the instance of SciTE to open" msgstr "" #: main.c:72 msgid "SCITE_FILENAME" msgstr "" #: main.c:75 msgid "Load a folder" msgstr "" #: main.c:78 msgid "Start SciTE automatically with SciteProj" msgstr "" #: main.c:90 msgid "SciTE Project Manager" msgstr "" #: main.c:97 #, c-format msgid "option parsing failed: %s" msgstr "" #: main.c:142 #, c-format msgid "A folder is expected as parameter to sciteproj..." msgstr "" #: main.c:181 main.c:191 msgid "" "Environment variable exists, but doesn't point to a folder containing scite." msgstr "" #: main.c:208 #, c-format msgid "Couldn't find a SciTE executable named '%s'!\n" msgstr "" #: main.c:209 msgid "Checking for SciTE in the standard locations instead.\n" msgstr "" #: main.c:222 msgid "" "Warning! Couldn't locate SciTE!\n" "Program will start, but you won't be able to open SciTE to edit files." msgstr "" #: main.c:230 #, c-format msgid "Could not setup the gui: %s" msgstr "" #: main.c:236 #, c-format msgid "Not a valid folder!" msgstr "" #: menus.c:116 msgid "_File" msgstr "" #: menus.c:117 msgid "_Edit" msgstr "" #: menus.c:118 msgid "_View" msgstr "" #: menus.c:119 msgid "_Help" msgstr "" #: menus.c:128 msgid "_Quit" msgstr "" #: menus.c:137 msgid "Edit properties" msgstr "" #: menus.c:143 msgid "Show Recently Opened Files" msgstr "" #: menus.c:150 msgid "About" msgstr "" #: menus.c:163 menus.c:235 msgid "Open file in SciTE" msgstr "" #: menus.c:166 menus.c:237 msgid "Copy filename to clipboard" msgstr "" #: menus.c:172 menus.c:209 menus.c:238 msgid "Properties" msgstr "" #: menus.c:182 msgid "Sort folder contents" msgstr "" #: menus.c:184 msgid "Sort ascending by name" msgstr "" #: menus.c:185 msgid "Sort descending by name" msgstr "" #: menus.c:187 msgid "Sort ascending by extension" msgstr "" #: menus.c:188 msgid "Sort descending by extension" msgstr "" #: menus.c:211 msgid "Update folder content" msgstr "" #: menus.c:236 msgid "Remove file from this list" msgstr "" #: properties_dialog.c:73 msgid "Group Properties" msgstr "" #: properties_dialog.c:74 properties_dialog.c:149 msgid "OK" msgstr "" #: properties_dialog.c:79 msgid "Group name:" msgstr "" #: properties_dialog.c:80 msgid "Full folder:" msgstr "" #: properties_dialog.c:148 msgid "File Properties" msgstr "" #: properties_dialog.c:172 msgid "Filename:" msgstr "" #: properties_dialog.c:173 msgid "Path:" msgstr "" #: properties_dialog.c:174 msgid "File size:" msgstr "" #: recent_files.c:177 msgid "Recently opened files:" msgstr "" #: remove.c:210 remove.c:215 msgid "Error!!!\n" msgstr "" #: remove.c:365 msgid "Delete all selected items?" msgstr "" #: remove.c:396 #, c-format msgid "Delete file '%s'?" msgstr "" #: remove.c:399 msgid "Delete file?" msgstr "" #: remove.c:429 #, c-format msgid "Delete folder '%s' and any contained files?" msgstr "" #: remove.c:432 msgid "Delete folder and any contained files?" msgstr "" #: remove.c:460 #, c-format msgid "" "Could not delete the selected node: \n" "\n" "%s" msgstr "" #: scite_utils.c:190 #, c-format msgid "Closed %s" msgstr "" #: scite_utils.c:199 msgid "Closed SciTE" msgstr "" #: scite_utils.c:206 #, c-format msgid "Switched to %s" msgstr "" #: scite_utils.c:589 msgid "Connecting to Scite...." msgstr "" #: scite_utils.c:638 msgid "Launched SciTE" msgstr "" #: script.c:144 #, c-format msgid "Error: %s" msgstr "" #: statusbar.c:57 msgid "Welcome to SciteProj\n" msgstr "" sciteproj-1.14/GPL3.txt0000644000175000017500000010451313542152470014266 0ustar gusnangusnan GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 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, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . sciteproj-1.14/sciteproj.10000644000175000017500000000301713542152470015101 0ustar gusnangusnan.\" .\" Copyright (C) 2010-2019 Andreas Rönnquist .\" This file is distributed under the same license .\" as the sciteproj package, see COPYING file. .\" .TH sciteproj 1 "" "" .SH NAME SciteProj - a Project Manager for the SciTE editor .SH DESCRIPTION .B SciteProj is a Project Manager for the SciTE editor - It is used to group a bunch of files into a project for easy access in SciTE giving the possibility to group files in folders, and saves the project to disc in XML format. It is based on the program ScitePM by Roy Wood. It uses the director interface of SciTE to communicate between SciTE and SciteProj. .SH OPTIONS .IP "-s, --scite FILENAME" Sets the filename for the instance of SciTE to open. .IP "-v, --version" Displays the version number of SciteProj .IP "-h, --help" Display a short help .SH CONFIG FILE The config file that SciteProj is using is named sciteprojrc.lua, and is loaded from the directory where sciteproj is started in. - If this file isn't found, sciteproj searches for the file in the users $HOME/.config/ directory. It is loaded on every program start. There is a menuitem in the program to open the file directly in SciTE for editing. If there isn't a .sciteproj in the user home when starting SciteProj, one will be created filled with default values. The following options are supported in the config file: .IP "xpos, ypos, width and height" Specifies the position and size of the program window on start .IP "give_scite_focus" .SH AUTHOR .B SciteProj was written by Andreas Rönnquist . sciteproj-1.14/graphics/0000755000175000017500000000000013542152470014614 5ustar gusnangusnansciteproj-1.14/graphics/dir-open.xpm0000644000175000017500000000234713542152470017065 0ustar gusnangusnan/* XPM */ static char * dir_open_xpm[] = { "16 12 64 1", " c None", ". c #000000", "+ c #7EA4D8", "@ c #93B7E5", "# c #97BAE6", "$ c #779CD5", "% c #83A9DE", "& c #8EB5E4", "* c #8DB4E3", "= c #7FA4DC", "- c #7297D4", "; c #9BBCE8", "> c #87AEE2", ", c #8CB1E4", "' c #8BAFE2", ") c #7FA3DE", "! c #8DB2E3", "~ c #7DA1DD", "{ c #7598D9", "] c #789DDA", "^ c #80A4DF", "/ c #4F679E", "( c #5874B3", "_ c #6485CA", ": c #DFEDF7", "< c #DBECF7", "[ c #D5E8F6", "} c #D4E7F5", "| c #D2E7F5", "1 c #CBE0F3", "2 c #A0C3E4", "3 c #485D8C", "4 c #546DA8", "5 c #BFD9EE", "6 c #C0D9EF", "7 c #C2DBF1", "8 c #BED9F1", "9 c #BDD9F0", "0 c #B7D3EE", "a c #8CB3DC", "b c #465883", "c c #4C6293", "d c #B4D2EE", "e c #B3D1ED", "f c #AECDEB", "g c #93B9E0", "h c #6185BD", "i c #475B8A", "j c #AFCFED", "k c #AFCEEC", "l c #A0C4E7", "m c #8EB7DD", "n c #455684", "o c #A6C8EA", "p c #A5C7E9", "q c #A3C6E9", "r c #85ABDA", "s c #5C7CB6", "t c #98BCE5", "u c #97BCE6", "v c #93B9E4", "w c #8CB4E0", "x c #8BB2DF", "y c #759ED5", " .... ", " .+@#$. ", " .$%&*=-...... ", " .;>,>')!~{{]^.", " .........../(_.", ".:<[}}}}}|12.34.", ".5678989890a.bc.", " .5ddeeeeefgh.i.", " .5jjkkkkkflm.n.", " .dopppppqlrs..", " .tuvvvvvvwxy..", " ............ "}; sciteproj-1.14/graphics/dir-close.xpm0000644000175000017500000000274713542152470017235 0ustar gusnangusnan/* XPM */ static char * dir_close_xpm[] = { "16 12 81 1", " c None", ". c #000000", "+ c #79A0D4", "@ c #92B8E3", "# c #7599D1", "$ c #8CB3DF", "% c #8AB0DF", "& c #9BBEE6", "* c #93B7E4", "= c #8BB1DF", "- c #789ED7", "; c #E6F2FA", "> c #E2EFF9", ", c #E0EEF9", "' c #DFEDF8", ") c #DAE9F6", "! c #CBDFF4", "~ c #C7DDF3", "{ c #C0D8F1", "] c #AFCCED", "^ c #DCECF8", "/ c #D1E6F5", "( c #CBE2F4", "_ c #CBE1F4", ": c #C9DFF3", "< c #BFD8F0", "[ c #B2D0ED", "} c #ACCAED", "| c #A0C3E9", "1 c #8AAEDF", "2 c #DAEAF6", "3 c #C1DAF0", "4 c #BFD9F0", "5 c #BCD7F0", "6 c #B5D1ED", "7 c #ABCAEC", "8 c #A2C4EA", "9 c #9DBEE8", "0 c #8CB0E0", "a c #7397D3", "b c #D8E9F6", "c c #CAE0F3", "d c #BBD6EF", "e c #B0CFED", "f c #A8C8EB", "g c #9FC0E8", "h c #95B9E6", "i c #81A6DC", "j c #6788CC", "k c #D8EAF6", "l c #98BBE6", "m c #8CB0E2", "n c #799DD8", "o c #6484C4", "p c #C5DCF1", "q c #B8D4EE", "r c #AECDEC", "s c #A6C8EA", "t c #9BBDE8", "u c #80A3DD", "v c #7095D2", "w c #5E7DBE", "x c #D1E5F5", "y c #A0C2E7", "z c #97BAE6", "A c #91B4E3", "B c #8AAEE1", "C c #83A5DE", "D c #6F92D1", "E c #6384C7", "F c #5874B3", "G c #C0D9F1", "H c #94B7E3", "I c #7DA0DA", "J c #7B9ED8", "K c #7B9FD9", "L c #779BD8", "M c #7398D5", "N c #6E8ED0", "O c #6585C7", "P c #536BA3", " .... ", " .+@@#. ", " .$%&*=-...... ", " .;>,',',)!~{].", " .^/(_(_:<[}|1.", " .2_344567890a.", " .bc45def8ghij.", " .kc c #2A0E10", ", c #100506", "' c #3D1418", ") c #3C1417", "! c #331114", "~ c #371216", "{ c #290D10", "] c #1F0A0C", "^ c #230B0E", "/ c #180809", "( c #531B21", "_ c #73353B", ": c #050102", "< c #8A5056", "[ c #080203", "} c #5D1F25", "| c #351115", "1 c #2D0F12", "2 c #1A080A", "3 c #301013", "4 c #060202", "5 c #1E0A0C", "6 c #571D22", "7 c #0C0405", "8 c #7C3F45", "9 c #1D090B", "0 c #6B2C32", "a c #040101", "b c #B3898D", "c c #200A0C", "d c #8E565C", "e c #4D191F", "f c #0F0506", "g c #49181D", "h c #130607", "i c #1B090A", "j c #030101", "k c #4C191E", "l c #110507", "m c #76383E", "n c #321014", "o c #84494F", "p c #90585D", "q c #67272D", "r c #020000", "s c #83474D", "t c #692930", "u c #581D23", "v c #070203", "w c #3A1317", "x c #7B3E44", "y c #3E1418", "z c #2E0F12", "A c #4B191D", "B c #070202", "C c #A37176", "D c #501A20", "E c #8B5257", "F c #874D53", "G c #E8DADC", "H c #72343A", "I c #A97A7F", "J c #0C0404", "K c #66262C", "L c #91595F", "M c #210B0D", "N c #D5BBBD", "O c #090303", "P c #F4EDEE", "Q c #793B41", "R c #E6D6D7", "S c #8D555A", "T c #E1CFD1", "U c #BF9A9E", "V c #42161A", "W c #0E0405", "X c #6D2E34", "Y c #64242A", "Z c #2F0F13", "` c #311013", " . c #5A1E24", ".. c #A8787D", "+. c #BE989C", "@. c #FDFCFC", "#. c #44161B", "$. c #5B1E24", "%. c #B58B8F", "&. c #B68C90", "*. c #260C0F", "=. c #240C0E", "-. c #77393F", ";. c #0A0304", ">. c #541C21", ",. c #361215", "'. c #220B0D", "). c #7A3D43", "!. c #996469", "~. c #F9F5F5", "{. c #976166", "]. c #CAAAAD", "^. c #E4D3D5", "/. c #010000", "(. c #170709", "_. c #CCAEB1", ":. c #CBACAF", "<. c #955F65", "[. c #401519", "}. c #4F1A1F", "|. c #0D0405", "1. c #020001", "2. c #AC7E82", "3. c #A06E73", "4. c #C6A4A7", "5. c #C4A2A5", "6. c #250C0F", "7. c #F7F2F3", "8. c #A5757A", "9. c #BC969A", "0. c #D3B9BB", "a. c #3F1519", "b. c #A47378", "c. c #381216", "d. c #74363C", "e. c #A7777B", "f. c #602026", "g. c #511B20", "h. c #6F3036", "i. c #F0E6E7", "j. c #E3D1D3", "k. c #6C2D33", "l. c #81454B", "m. c #E0CDCE", "n. c #945E63", "o. c #65252B", "p. c #612127", "q. c #48181C", "r. c #C7A6A9", "s. c #7E4248", "t. c #D1B5B7", "u. c #B2878B", "v. c #BA9296", "w. c #6E2F35", "x. c #854A50", "y. c #EBDFE0", "z. c #C29EA1", "A. c #DECACC", "B. c #FAF7F7", "C. c #7F4349", "D. c #47171C", "E. c #925B60", "F. c #632329", "G. c #622228", "H. c #8C5359", "I. c #AA7C80", "J. c #9B676C", "K. c #9D696E", "L. c #DDC8CA", "M. c #280D10", "N. c #DCC6C8", "O. c #9E6B70", "P. c #B78E92", "Q. c #986268", "R. c #43161A", "S. c #EEE4E5", "T. c #FCFAFA", "U. c #C3A0A3", "V. c #82464C", "W. c #894F54", "X. c #E7D8D9", "Y. c #561C22", "Z. c #9A666B", "`. c #5E1F25", " + c #F6F0F0", ".+ c #EADDDE", "++ c #D7BFC2", "@+ c #864C51", "#+ c #AD7F84", "$+ c #6A2B31", "%+ c #703138", "&+ c #D2B7B9", "*+ c #391316", "=+ c #7D4147", "-+ c #DAC4C6", ";+ c #68282F", ">+ c #D6BDC0", ",+ c #B18589", "'+ c #AE8186", ")+ c #BB9498", "!+ c #935C62", "~+ c #EDE1E2", "{+ c #A27075", "]+ c #F3EBEC", "^+ c #B89094", "/+ c #C8A8AB", "(+ c #C09C9F", "_+ c #CFB2B5", ":+ c #2B0E11", "<+ c #9F6C71", "[+ c #D9C1C4", "}+ c #713339", "|+ c #783A40", " . + @ + + # $ + $ % ", " & * = - ; > , ' ) * ! ~ { ] ^ , ", " $ . ) / ( - _ : < [ _ [ } = | 1 2 = 3 % / 4 ", " 5 - 6 7 8 9 ~ 0 a b [ c d a e ; f g | h # { i . ", " j k l m @ n o j p q r s t . u o v w x * [ y g 7 & z * a ", " a A / A _ B C D 4 E F h z G % : H I J : K L n 4 ! D { f > & ", " 4 M u : N O 4 P n j Q R 4 r S T / r ~ U V @ W X Y - Z ` .M O a ", " i a ..4 y +.a [ @.#.c 9 @.$.* h %.&.* *.=.b -.;.$ $.s >.$ j > } ,.a ", " '.2 ; Q j ).!.4 : ~.{.: [ ].^.;./.(._.:.f /.[ <.&.[.r r M o }.i |.h }., ", " j _ 1.2.*.a 3.L v 3 4.5.[ n 6.7.8.@ h - 9.0.a.c / 6.b.).M { c.,.-.A O + f B ", " O 1 c.B 7.] ;.I &.- j d.@.u r j E @._ /.a = U G y /.B > p e.f.4 r B g.h.}.M r : ", " W E $ M i.O 1.!.j.j : g ~.%.j M , e.@.k.& J : l.m.n.V W r , d.S o.p.q.;.{ k.c.: ", " a.a e.j ~ R 1.$ d @.6.(.v b.@.p j /.f m.@.u /.|.| Q r.2.M 4 (.[.g.l.s.^ r r , ` t [ ", " 4 a.i L r q @.J ~ | @.C j j ) @.^.+ & '.% t.P S w B /., u.v.{.Z O r j ` s w.t ).n ;.9 [ ", " c i g x.: a.@.#.j % y.j.[ X |.H @.z.y r /.= A.B.C.: . D.k.o...E.*.$ =.6 #.$.8 F.+ r r : ", " g.O G.H.: / @.( j w s @.x f /.'.t.@.E 7 ! h ;.I.i.U D 7 /.r i J.K.<.D.W r r O [.-.>.W 1. ", " + Q a u E.r 3 y.3.% $ ] ~.L.O c M.5 N.@.O.[ /.B #.8.L.&.> $ q.D.Z z F H.q.;.@ ` g.Z k 8 ; : ", " 2 s r A P.J 9 Q.B.h r 6 8.@.b.5 r a R.S.T.-.% a.f r V :.U.O.. r /.1.f V.W.x.n.Z *.4 r l K 3 ", " ^ E.1.D.^.c.j .@.u / . $ X.7.V 4 > = =.i.T.C a /.- g.Y.Z.%.d 5 ` f.f.=.9 `.l.H M.j r a W z ", "{ h %.: (. +3 j c..+++y 1.v W.@..+>.(./.7 V..+ +@+f.' 4 r O p e.J.F $ r /.r a ^ Q s.H c.S Y - j ", "M.;.3.h r 0.h.c - _ @.`.j t [ p @.r.[ & G.: 5 j.^.#+W j 1 Q y # x.{.s ,.Z G.).q Y.e $+x.H.a.4 j ", "M.f Z.> j e._.[.r > 7..+g (./.}.N @.z.%+v /.} u 2.&+b Z.Z j /.a # p {.S L *+[ r r r 1.5 =+-+5.@ ", "*.* t $+W | ~.A 1.g.%+@.0.j '.;+f &+T.8.[ ' i /.@ 3.z.P.g.+ p.L F./ @ p.< W.`.i / *.{ M * ~ v.a.", "M *.q.%.i j ++8.* R.a N B.k f.4 : X >+P _.^ r @ D.% g ,+'+)+u a /.1.h ' <.8.!+!.%.O.F.k h % A c ", "[ f.M ~+c.j )+@.,++ O =+P B.>./.c.] & A.G I.# a.4 j Z W.L I.{+u p.O.a.[.M , 3 {+R ]+b.{ a 1.r r ", "[ m l !+$+. Y.N.j.a / l f.@.N > R./.] Y.z.^.-+i $ ; z 1.;.S 9.)+^+[.j r /.j ;.f $+/+(+,+d ` B 1.", "- $+5 3 _+! ! Y.@.q >.a , (+@.G / a g j c N. +y.{+7 /.Z l.1 ! U ~+G P.=+X E V.%+o S O.Q.S < Q h ", "5 M.M.[ &.)., - 4.P -.r i + 8.T.9.[.f a ( |.Z.]+i.{.x q.: j :+-.x.&.+.P.s.i 1.1.r r r j 7 ^ A . ", "] [ w.W ) v., . 3 A.].[ } a 5 5.P N.|.M.h : t D :.0.,+^ { <+6 ;.r 4 g O.!.p Y M.* J a r r r 1.a ", " & f.M j n.Y.. W w [+F g.r =.+ K.N ..Y r ~ h W =+H.2.I p |.: = D < {+@+Y X }+X t o <.* @ j r ", " M / ;+4 * I.= , $ <+4.o r M.a 1 {.v.3.| g a =.[ =.x.F F ).K.c.* 1.r /.r a / #. .6 >.>.R.l ;. ", " / ;.$.& r $.Q.c 4 y m %.( ` r = [ G.{+<+e | + 5 $+j G.$+H w.Y.~ g V.Q q f.A n ^ 5 ,.R.; D.W ", " :+f o.1.: C.H j ` : W.3.V.: % 4 :+1 @+F l.- k 4 _ '.W X q `.u t *+h |.& :+a.H.z h f |.@ ", " (.7 ~ 6.r , H.c.> a :+s !+Y.'.f { j q o.d.C.3 Y |.Z z : : ,.;+q.#.c.2 O 1.r 1.O c { B 1. ", " 4 6.a $.$ r { < #.- ;.a.6 o o.:+% @ :+/ g 0 G.#.,.W k 0 e A ,.c M.,.,.~ = % O a r a % : ", " |.+ h $.a j $+Q.k.j ' B g.|+}+. '.& / ^ = u }.k 6 M 4 | k ) + f 4 l '.:+:+:+:+^ M $ ", " ] B ^ ' j % ;+'+f.: ,.: `.w.} #./ 5 6.R.'.=.6 ) [.q.^ |.* 6.Y.m g.[ a ;.. M.=.. ", " : ^ v ] ! j { #.9.%+f M.4 e k ( e =.5 & '.Z c % { 3 1 = ^ . r : l 5 , a r [ 4 a ", " 4 ^ O =.~ j Z *+#+x.h =.7 2 D.R.V q.h A @ M.5 = g.e 6.'.:+! W a j > Z 1.r 1. ", " [ 2 @ i ` : |.f }+C.% W * @ & ` Z 3 Z :+9 M.:+|./ K a.- * * * & % > f 4 ", " $ M 4 . 3 B r a > .k / * . @ '.{ =.*.2 ` $ ' 5 1.> M j 4 = % W l : ", " : i ;.O :+W 1.r - > *.& / ^ (.$ M 1 2 2 * ;.g % r / l r W |.r r ", " v h f , & / (.M [ . 5 / M O > [ ~ @ M f h - - |.h h 4 ;.j j ", " : O f : f > c + h / $ - - f 4 [ l W : * 4 * f f h |.4 a ", " B |.[ a f % $ * h 4 4 , . |.;.: |.O r c r j : 1. ", " 4 B W 4 r |.h |.v Z [ 4 / [ W - l f ;.a j : ", " a B a 1.j $ / + 2 4 a 4 r a B j ", " : : a a j a : a : : "}; sciteproj-1.14/src/0000755000175000017500000000000013542152470013603 5ustar gusnangusnansciteproj-1.14/src/expand.h0000644000175000017500000000204413542152470015233 0ustar gusnangusnan/** * expand.h - expand a folder in the treeview * * Copyright 2012-2017 Andreas Rönnquist * * This file is part of SciteProj. * * devilspie2 is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * devilspie2 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 devilspie2. * If not, see . */ #ifndef __HEADER_EXPAND_ #define __HEADER_EXPAND_ /** * */ void expand_tree(GtkTreeModel *tree_model, GtkTreeIter *start_iter); void start_expand_tree(GtkTreeModel *tree_model, GtkTreeIter *iter); gboolean get_expand_folder(gchar *folder_name); #endif /*__HEADER_EXPAND_*/ sciteproj-1.14/src/tree_manipulation.h0000644000175000017500000000762113542152470017501 0ustar gusnangusnan/** * tree_manipulation.h - GtkTreeView manipulation code for SciteProj * * Copyright 2006 Roy Wood, 2009-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. * If not, see . * */ #ifndef __HEADER_TREE_MANIPULATION_ #define __HEADER_TREE_MANIPULATION_ // Node relative-position indicators enum NodePosition { ADD_BEFORE, ADD_AFTER, ADD_CHILD }; // Mnemonic identifiers for the columns in the GtkTreeStore enum { COLUMN_ITEMTYPE = 0, COLUMN_FILEPATH, COLUMN_FILENAME, COLUMN_FILESIZE, COLUMN_FONTWEIGHT, COLUMN_FONTWEIGHTSET, COLUMN_ICON, COLUMN_EXPANDED, COLUMN_FOLDER_CONTENT_LOADED, COLUMN_EOL }; // The type of each row in the tree datamodel enum { ITEMTYPE_GROUP, ITEMTYPE_FILE }; // The types for each column in the tree datamodel #define TYPE_ITEMTYPE G_TYPE_UINT #define TYPE_FILEPATH G_TYPE_STRING #define TYPE_FILENAME G_TYPE_STRING #define TYPE_FILESIZE G_TYPE_STRING #define TYPE_FONTWEIGHT G_TYPE_INT #define TYPE_FONTWEIGHTSET G_TYPE_BOOLEAN #define TYPE_ICON GDK_TYPE_PIXBUF #define TYPE_EXPANDED G_TYPE_BOOLEAN #define TYPE_FOLDER_CONTENT_LOADED G_TYPE_BOOLEAN typedef gint(*StringCompareFunction)(gconstpointer,gconstpointer); // Set the Project filepath gboolean set_project_filepath(const gchar *filepath, GError **err); // Get the GTKTreeStore GtkTreeStore* create_treestore(GError **err); // Get the project file directory const gchar* get_project_directory(); gchar* get_project_filepath(); // Allow user to select and add files to the project gboolean add_files_to_project(GtkTreeIter *parentIter, GError **err); // Add a file node to a GtkTreeModel gboolean add_tree_file(GtkTreeIter *currentIter, enum NodePosition position, const gchar* filepath, GtkTreeIter *newIter, gboolean makeRelative, GError **err); //gboolean add_tree_filelist(GtkTreeIter *parentIter, GSList *fileList, GError **err); gboolean add_tree_filelist(GtkTreeIter *parentIter, GSList *fileList, GError **err); // Add a group node to a GtkTreeModel gboolean add_tree_group(GtkTreeIter *parentIter, enum NodePosition position, const gchar* groupname, const gchar* full_name, gboolean expanded, GtkTreeIter *newIter, GError **err); // Remove a node from a GtkTreeModel gboolean remove_tree_node(GtkTreeIter *iter, GError **err); gboolean set_tree_node_expanded(GtkTreeIter *iter, gboolean expanded, GError **err); gboolean set_tree_node_icon(GtkTreeIter *iter, GdkPixbuf *pixbuf, GError **err); gboolean set_tree_node_loaded(GtkTreeIter *iter, gboolean loaded, GError **err); // Copy a node in the tree (including children) gboolean copy_tree_node(GtkTreeIter *srcIter, GtkTreeIter *dstIter, enum NodePosition position, GtkTreeIter *newIter, GError **err); gchar *get_path_string(GtkTreeIter *iter); void sort_children(GtkTreeIter *node,GError **err,StringCompareFunction compare_func); gboolean add_tree_folderlist(GtkTreeIter *iter, GSList *folder_list, gchar *folder_path); #endif /*__HEADER_TREE_MANIPULATION_*/ sciteproj-1.14/src/prefs.h0000644000175000017500000000271013542152470015073 0ustar gusnangusnan/** * prefs.h - prefs for SciteProj * * Copyright 2006 Roy Wood, 2009-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #ifndef __HEADER_PREFS_ #define __HEADER_PREFS_ #define PREFS_BUFSIZE 256 /** * */ typedef struct { int lhs; int width, height; int verbosity; int last_file_filter; int xpos,ypos; int search_xpos,search_ypos; int search_width,search_height; gboolean give_scite_focus; gboolean search_give_scite_focus; gchar *scite_path; gboolean show_recent; gboolean recent_add_to_bottom; gboolean hide_statusbar; gboolean use_stock_folder_icon; gboolean write_protect; gboolean start_scite; } sciteproj_prefs; extern sciteproj_prefs prefs; extern gchar *prefs_filename; gboolean init_prefs(gchar *target_directory, GError **error); void done_prefs(); #endif /*__HEADER_PREFS_*/ sciteproj-1.14/src/main.c0000644000175000017500000001467513542152470014710 0ustar gusnangusnan/** * main.c - main for SciteProj * * Copyright 2006 Roy Wood, 2009-2018 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #include #include #include #include #include #include #include #include #include #include "clicked_node.h" #include "gui.h" #include "tree_manipulation.h" #include "prefs.h" #include "graphics.h" #include "scite_utils.h" #include "about.h" #include "file_utils.h" #include "string_utils.h" #include "load_folder.h" #include "script.h" static struct CommandLineIndata { const gchar *scite_filename; } cmd; /* * Program main entry */ int main(int argc, char *argv[]) { int returnCode = EXIT_FAILURE; GError *err = NULL; GOptionContext *context = NULL; static gboolean version = FALSE; static gchar *scite_instance = NULL; static gboolean load_a_folder = FALSE; static gboolean start_scite = FALSE; static const GOptionEntry options[] = { { "version", 'v', 0, G_OPTION_ARG_NONE, &version, N_("Show program version and quit") }, { "scite", 's', 0, G_OPTION_ARG_STRING, &scite_instance, N_("Set a filename for the instance of SciTE to open"), N_("SCITE_FILENAME") }, { "load_folder", 'l', 0, G_OPTION_ARG_NONE, &load_a_folder, N_("Load a folder") }, { "start_scite", 't', 0, G_OPTION_ARG_NONE, &start_scite, N_("Start SciTE automatically with SciteProj") }, { NULL } }; // Init gettext stuff setlocale(LC_ALL,""); bindtextdomain(PACKAGE, LOCALEDIR); bind_textdomain_codeset(PACKAGE, ""); textdomain(PACKAGE); gchar *sciteproj_description = g_strdup_printf(_("SciTE Project Manager")); gchar *full_desc_string = g_strdup_printf("- %s",sciteproj_description); context=g_option_context_new(full_desc_string); g_option_context_add_main_entries(context, options, NULL); if (!g_option_context_parse(context, &argc, &argv, &err)) { g_print(_("option parsing failed: %s"), err->message); printf("\n"); exit(EXIT_FAILURE); } g_free(sciteproj_description); g_free(full_desc_string); /* Interpret the options */ /* set instance of SciTE to run */ if (scite_instance) { cmd.scite_filename = scite_instance; } init_version_string(); /* Show SciteProj version */ if (version) { show_version(); printf("\n"); done_version_string(); exit(EXIT_SUCCESS); } // Init gtk gtk_init(&argc, &argv); // Since glib 2.36, this isn't needed /* #if GLIB_MAJOR_VERSION<=2 && GLIB_MINOR_VERSION<36 g_type_init(); #endif */ init_file_utils(); gchar *current_dir = g_get_current_dir(); if (argc > 2) { printf(_("A folder is expected as parameter to sciteproj...")); printf("\n"); return EXIT_FAILURE; } gchar *dir_to_load; if (argc == 1) { // only "sciteproj" on the command-line dir_to_load = current_dir; } else { // "sciteproj " on the command-line dir_to_load = argv[1]; gchar *newpath; if (relative_path_to_abs_path(dir_to_load, &newpath, current_dir, NULL)) { dir_to_load = newpath; } } // Init preferences if (!init_prefs(dir_to_load, &err)) { /* g_print(_("Error initing preferences: %s"), err->message); done_version_string(); return EXIT_FAILURE; */ } // check environment variable gchar *scite_path_env = getenv("SciTE_HOME"); // test for scite if (scite_path_env != NULL) { gchar *env_filename = g_build_filename(scite_path_env, "scite", NULL); if (g_file_test(env_filename, G_FILE_TEST_EXISTS)) { if (cmd.scite_filename == NULL) { cmd.scite_filename = g_strdup(env_filename); } } else { g_warning(_("Environment variable exists, but doesn't point to a folder containing scite.")); } if (env_filename != NULL) g_free(env_filename); env_filename = g_build_filename(scite_path_env,"SciTE",NULL); if (g_file_test(env_filename, G_FILE_TEST_EXISTS)) { if (cmd.scite_filename == NULL) { cmd.scite_filename = g_strdup(env_filename); } } else { g_warning(_("Environment variable exists, but doesn't point to a folder containing scite.")); } } // do we have a custom scite executable string as command line option? if (cmd.scite_filename != NULL) { // Does SciTE exist at that location? if (g_file_test(cmd.scite_filename, G_FILE_TEST_IS_REGULAR)) { // If we have already allocated memory for scite path, free it if (prefs.scite_path != NULL) g_free(prefs.scite_path); // Set the new one prefs.scite_path=g_strdup(cmd.scite_filename); } else { g_print(_("Couldn't find a SciTE executable named '%s'!\n"), cmd.scite_filename); g_print(_("Checking for SciTE in the standard locations instead.\n")); } } //g_option_context_free(context); /* * Any "used" options has been removed from the argv/argc array here. */ // Check for SciTE if (!check_if_scite_exists()) { GtkWidget *warningDialog = gtk_message_dialog_new(get_main_window(), GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, _("Warning! Couldn't locate SciTE!\n" "Program will start, but you won't be able to open SciTE to edit files.")); gtk_dialog_run(GTK_DIALOG(warningDialog)); gtk_widget_destroy(warningDialog); } // Set up the GUI if (!setup_gui(&err)) { g_print(_("Could not setup the gui: %s"), err->message); g_print("\n"); goto EXITPOINT; } if (!is_string_folder(dir_to_load)) { printf(_("Not a valid folder!")); printf("\n"); return EXIT_FAILURE; } // Should we load a folder? set_project_filepath(dir_to_load, NULL); load_folder(dir_to_load, NULL); init_scite_connection(); // open scite, if prefs says we should if (prefs.start_scite == TRUE || start_scite) { launch_scite("", NULL); } // Run the app gtk_main(); returnCode = EXIT_SUCCESS; EXITPOINT: gui_close(); done_prefs(); done_version_string(); g_free(current_dir); if (err) g_error_free(err); return returnCode; } sciteproj-1.14/src/remove.h0000644000175000017500000000167713542152470015264 0ustar gusnangusnan/** * remove.h - code for removing nodes * * Copyright 2011-2017 Andreas Rönnquist * * This file is part of SciteProj * * SciteProj is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. * If not, see . */ #ifndef __HEADER_REMOVE_ #define __HEADER_REMOVE_ void do_remove_node(gboolean ignore_clicked_node); void popup_remove_node_cb(); void removeitem_menu_cb(); #endif /*__HEADER_REMOVE_*/ sciteproj-1.14/src/script.c0000644000175000017500000001111013542152470015245 0ustar gusnangusnan/** * script.c - Script code for sciteproj * * Copyright 2012-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #include #include #include #include #include #include #include #include "prefs.h" #include "script.h" #include "tree_manipulation.h" /** * */ lua_State * init_script() { lua_State *lua = luaL_newstate(); if (!lua) { printf("ERROR!\n"); return NULL; } luaL_openlibs(lua); register_cfunctions(lua); return lua; } /** * */ void register_cfunctions(lua_State *lua) { } /** * */ int load_script(lua_State *lua, char *filename) { if (lua) { int result = luaL_loadfile(lua, filename); if (result) { // We got an error, print it printf("%s\n", lua_tostring(lua, -1)); lua_pop(lua, 1); return -1; } } else { return -1; } return 0; } /** * */ int load_script_buffer(lua_State *lua, const char *buffer) { if (lua) { int err = luaL_loadbuffer(lua, buffer, strlen(buffer), "script_buffer"); if (err) { //printf("\n\n\nERROR!\n\n\n"); fprintf(stderr, "%s\n", lua_tostring(lua, -1)); lua_pop(lua, -1); return -1; } } else { printf("invalid lua state...\n"); return -1; } return 0; } /** * */ void run_script(lua_State *lua) { int s = lua_pcall( lua, 0, LUA_MULTRET, 0 ); if (s > 0) { char *error_msg; error_msg=(char*)lua_tostring( lua, -1 ); //std::string luaErrorString=getLuaErrorString(s); /* mssOut.str( "" ); mssOut << "Script::runScript : Error caught running script " << sScriptName << "\n" << " Error code is " << luaErrorString << ".\n" << " Error msg is: " << errorMsg; throw( ScriptException( mssOut.str().c_str(), errorMsg ) ); */ printf(_("Error: %s"), error_msg); printf("\n"); } } /** * */ void done_script(lua_State *lua) { if (lua) lua_close(lua); } /** * */ GSList *load_filter_from_lua() { gchar *script_filename = g_build_filename(get_project_directory(), "sciteprojrc.lua", NULL); lua_State *lua = NULL; GSList *list = NULL; if (g_file_test(script_filename, G_FILE_TEST_EXISTS)) { lua = init_script(); if (load_script(lua, script_filename) != 0) { printf("Error loading script: %s\n", script_filename); goto EXITPOINT; } run_script(lua); lua_getglobal(lua, "hide_filter"); // Make sure we got a value at all if (lua_isnil(lua, -1)) { goto EXITPOINT; } // Make sure it is a table if (!lua_istable(lua, -1)) { // We didn't find a table with the required name, then just exit goto EXITPOINT; } lua_pushnil(lua); while(lua_next(lua, -2)) { if (lua_isstring(lua, -1)) { char *temp = (char *)lua_tostring(lua, -1); list = g_slist_append(list,g_strdup(temp)); } lua_pop(lua,1); } lua_pop(lua,1); } EXITPOINT: g_free(script_filename); if (lua) done_script(lua); return list; } /** * */ int lua_get_boolean(lua_State *lua, char *variable_name) { lua_getglobal(lua, variable_name); int temp = 0; gboolean result = FALSE; //if (lua_type(lua,-1)==LUA_TBOOLEAN) { if (lua_isboolean(lua, -1)!=0) { temp = (int)lua_toboolean(lua, -1); } else { printf("%s isn't a bool!\n", variable_name); } lua_pop(lua, 1); if (temp != 0) result = TRUE; return result; } /** * */ double lua_get_number(lua_State *lua, char *variable_name) { int result = -1; lua_getglobal(lua, variable_name); if (lua_isnumber(lua, -1) != 0) { result = (int)lua_tonumber(lua, -1); } else { printf("%s isn't a number!\n", variable_name); } lua_pop(lua, 1); return result; } /** * */ int error(lua_State *L, const char *fmt, ...) { va_list argp; va_start(argp, fmt); vfprintf(stderr, fmt, argp); va_end(argp); lua_close(L); return 0; } /** * */ gboolean lua_global_exists(lua_State *lua, char *variable_name) { gboolean result = TRUE; lua_getglobal(lua, variable_name); if (lua_isnil(lua, -1) != 0) { result = FALSE; } else { lua_pop(lua, 1); } return result; } sciteproj-1.14/src/recent_files.c0000644000175000017500000004072513542152470016421 0ustar gusnangusnan/** * recent_files.c - list of recently opened files * * Copyright 2011-2018 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #include #include #include #include #include "recent_files.h" #include "prefs.h" #include "graphics.h" #include "tree_manipulation.h" #include "string_utils.h" #include "clicked_node.h" #include "file_utils.h" #include "statusbar.h" #include "scite_utils.h" #include "clipboard.h" #include "properties_dialog.h" #include "menus.h" #include "icon.h" #define APP_SCITEPROJ_ERROR g_quark_from_static_string("APP_GUI_ERROR") /** * */ GtkCellRenderer *recentPixbuffCellRenderer = NULL; GtkWidget *recentTreeView = NULL; GtkTreeStore *recentTreeStore = NULL; ClickedNode recent_clicked_node; //GtkWidget *recentPopupMenu=NULL; /** * forward declarations */ static gboolean recent_mouse_button_pressed_cb(GtkWidget *treeView, GdkEventButton *event, gpointer userData); static void recent_tree_row_activated_cb(GtkTreeView *treeView, GtkTreePath *path, GtkTreeViewColumn *column, gpointer userData); /** * Get the GTKTreeStore (evil, but necessary for setup_gui). * * @return the GtkTreeStore* for the project or NULL if a GtkTreeStore could not be allocate * * @param err returns any error information */ GtkTreeStore* create_treestore_recent(GError **err) { GtkTreeStore *result = gtk_tree_store_new(COLUMN_EOL, TYPE_ITEMTYPE, TYPE_FILEPATH, TYPE_FILENAME, TYPE_FILESIZE, TYPE_FONTWEIGHT, TYPE_FONTWEIGHTSET, TYPE_ICON, TYPE_EXPANDED, TYPE_FOLDER_CONTENT_LOADED); if (result == NULL) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: %s, gtk_tree_store_new() = NULL", __func__, "Couldn't init treestore" ); } return result; } /** * */ GtkWidget *init_recent_files(GError **err) { GtkCellRenderer *recentCellRenderer = NULL; GtkTreeViewColumn *recentColumn1 = NULL; GtkWidget *recentScrolledWindow = NULL; GError *tempErr = NULL; // add a scrolledwindow for recent files if (!(recentScrolledWindow = gtk_scrolled_window_new(NULL,NULL))) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: %s, gtk_scrolled_window_new() = NULL", __func__, "Couldn't init recent scrolled window" ); goto EXITPOINT; } gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(recentScrolledWindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); if ((recentTreeStore = create_treestore_recent(&tempErr)) == NULL) { if (tempErr) { g_set_error(err, APP_SCITEPROJ_ERROR, -1 , "%s: %s", tempErr->message, "Couldn't init recent treestore" ); } goto EXITPOINT; } if (!(recentTreeView = gtk_tree_view_new_with_model(GTK_TREE_MODEL(recentTreeStore)))) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: %s, gtk_tree_view_new_with_model() = NULL", __func__, "Couldn't init recent gtk_tree_view" ); goto EXITPOINT; } gtk_widget_show(recentScrolledWindow); gtk_container_add(GTK_CONTAINER(recentScrolledWindow), recentTreeView); if (!(recentCellRenderer = gtk_cell_renderer_text_new())) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: %s, gtk_cell_renderer_text_new() = NULL", __func__, "Couldn't init recent gtk_cell_renderer" ); goto EXITPOINT; } if (!(recentColumn1 = gtk_tree_view_column_new())) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: %s, gtk_tree_view_column_new() = NULL", __func__, "Couldn't init recent gtk_tree_view_column" ); goto EXITPOINT; } g_object_set(recentColumn1, "title", _("Recently opened files:"), NULL); if (!(recentPixbuffCellRenderer = gtk_cell_renderer_pixbuf_new())) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: %s, gtk_cell_renderer_pixbuf_new() = NULL", __func__, "Couldn't init recent gtk_cell_renderer_pixbuf" ); goto EXITPOINT; } gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(recentTreeView), TRUE); gtk_tree_view_column_set_resizable(recentColumn1, TRUE); gtk_tree_view_column_set_min_width(recentColumn1, (int)(prefs.width*.75)); gtk_tree_view_column_pack_start(recentColumn1, recentPixbuffCellRenderer , FALSE); gtk_tree_view_column_add_attribute(recentColumn1, recentPixbuffCellRenderer , "pixbuf", COLUMN_ICON); gtk_tree_view_column_pack_start(recentColumn1, recentCellRenderer, TRUE); gtk_tree_view_column_add_attribute(recentColumn1, recentCellRenderer, "text", COLUMN_FILENAME); gtk_tree_view_column_add_attribute(recentColumn1, recentCellRenderer, "weight", COLUMN_FONTWEIGHT); gtk_tree_view_column_add_attribute(recentColumn1, recentCellRenderer, "weight-set", COLUMN_FONTWEIGHTSET); g_signal_connect(G_OBJECT(recentTreeView), "button-press-event", G_CALLBACK(recent_mouse_button_pressed_cb), recentTreeView); g_signal_connect(G_OBJECT(recentTreeView), "row-activated", G_CALLBACK(recent_tree_row_activated_cb), NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(recentTreeView), recentColumn1); gtk_widget_show(recentTreeView); EXITPOINT: return recentScrolledWindow; } /** * GtkTreeModelForeachFunc */ gboolean tree_for_each(GtkTreeModel *model,GtkTreePath *path,GtkTreeIter *iter,gpointer data) { gchar *filepath,*filename; gchar *inFile = (gchar*)(data); gtk_tree_model_get(model, iter, COLUMN_FILEPATH, &filename, -1); filepath = get_filename_from_full_path((gchar*)filename); if (g_strcmp0(filepath,inFile) == 0) { //savedIter=iter; gtk_tree_store_remove(recentTreeStore, iter); return TRUE; } return FALSE; } /** * */ void remove_if_already_exists(const gchar *filepath) { gtk_tree_model_foreach(gtk_tree_view_get_model(GTK_TREE_VIEW(recentTreeView)), tree_for_each, (gpointer)(filepath)); } /** * add_file * @returns TRUE if added the file successfully, FALSE otherwise */ gboolean add_file_to_recent(gchar *filepath, GError **err) { g_assert(recentTreeStore != NULL); g_assert(filepath != NULL); //g_assert(position == ADD_BEFORE || position == ADD_AFTER || position == ADD_CHILD); gboolean finalResult = FALSE; GtkTreeIter iter; const gchar* fileName = NULL; gchar *fileExt = NULL; gchar *relFilename = NULL; //g_strdup(filepath); /* if (!makeRelative) { relFilename = g_strdup(filepath); } else */ if (!abs_path_to_relative_path(filepath, &relFilename, get_project_directory(), err)) { printf("--- abs_path_to_relative_path FAILED!\n"); goto EXITPOINT; } // Extract filename from filepath fileName = get_filename_from_full_path((gchar*)filepath); remove_if_already_exists(fileName); // Append to root, or before/after/within an existing node? //if (currentIter == NULL) { if (!prefs.recent_add_to_bottom) { gtk_tree_store_insert_after(recentTreeStore, &iter, NULL, NULL); } else { // get the iter of the last item gtk_tree_store_append(recentTreeStore, &iter, NULL); } //} /* else if (position == ADD_BEFORE) { gtk_tree_store_insert_before(recentTreeStore, &iter, NULL, currentIter); } else if (position == ADD_AFTER) { gtk_tree_store_insert_after(recentTreeStore, &iter, NULL, currentIter); } else if (position == ADD_CHILD) { gtk_tree_store_insert(recentTreeStore,&iter,currentIter,1000); } */ fileExt = strrchr(fileName, '.'); if (fileExt != NULL) { ++fileExt; } if (fileExt == NULL || (int)strlen(fileExt) <= 0) { fileExt = (gchar*)fileName; } gtk_tree_store_set(recentTreeStore, &iter, COLUMN_ITEMTYPE, ITEMTYPE_FILE, -1); gtk_tree_store_set(recentTreeStore, &iter, COLUMN_FILEPATH, relFilename, -1); gtk_tree_store_set(recentTreeStore, &iter, COLUMN_FILENAME, fileName, -1); gtk_tree_store_set(recentTreeStore, &iter, COLUMN_EXPANDED, FALSE, -1); GdkPixbuf *icon_pixbuf = get_pixbuf_from_filename((gchar*)(filepath), GTK_ICON_SIZE_MENU); gtk_tree_store_set(recentTreeStore, &iter, COLUMN_ICON, icon_pixbuf, -1); finalResult = TRUE; EXITPOINT: if (relFilename) g_free(relFilename); return finalResult; } /** * Respond to a Gtk "button-press-event" message. * * @param treeView is the GTKTreeView widget in which the mouse-button event occurred * @param event is the GdkEventButton event object * @param userData is not currently used */ static gboolean recent_mouse_button_pressed_cb(GtkWidget *treeView, GdkEventButton *event, gpointer userData) { gboolean eventHandled = FALSE; GtkTreePath *path = NULL; GtkTreeModel *treeModel = NULL; gchar *nodeName = NULL; gint nodeItemType; GtkTreeIter iter; GtkTreeSelection *tree_selection = NULL; g_assert(treeView != NULL); g_assert(event != NULL); // Until we know for sure, assume that the user has not clicked on a node recent_clicked_node.valid = FALSE; // If it is not a right-click, then ignore it if (event->type != GDK_BUTTON_PRESS || event->button != 3) { goto EXITPOINT; } // Find if the user has clicked on a node if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(treeView), (gint) event->x, (gint) event->y, &path, NULL, NULL, NULL)) { // Nope-- user clicked in the GtkTreeView, but not on a node goto EXITPOINT; } // User clicked on a node, so retrieve the particulars treeModel = gtk_tree_view_get_model(GTK_TREE_VIEW(treeView)); if (!gtk_tree_model_get_iter(treeModel, &iter, path)) { goto EXITPOINT; } gtk_tree_model_get(treeModel, &iter, COLUMN_ITEMTYPE, &nodeItemType, COLUMN_FILEPATH, &nodeName, -1); // Save the node info for use by the popup menu callbacks if (recent_clicked_node.name) g_free(recent_clicked_node.name); recent_clicked_node.valid = TRUE; recent_clicked_node.iter = iter; recent_clicked_node.type = nodeItemType; recent_clicked_node.name = nodeName; nodeName = NULL; // Check if something is selected tree_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeView)); if (tree_selection != NULL) { // Check if clicked on something in the selection, otherwise make the clicked one the selection. if (gtk_tree_selection_path_is_selected(tree_selection, path) == FALSE) { // clear selection and make current line selected gtk_tree_selection_unselect_all(tree_selection); gtk_tree_selection_select_path(tree_selection, path); } } // Pop up the appropriate menu for the node type //if (nodeItemType == ITEMTYPE_FILE) { if (recentPopupMenu) { gtk_menu_popup_at_pointer(GTK_MENU(recentPopupMenu), (GdkEvent*)event); } /* } else if (nodeItemType == ITEMTYPE_GROUP) { gtk_menu_popup(GTK_MENU(sGroupPopupMenu), NULL, NULL, NULL, NULL, event->button, gdk_event_get_time((GdkEvent*) event)); } */ // We took care of the event, so no need to propogate it eventHandled = TRUE; EXITPOINT: if (path) gtk_tree_path_free(path); if (nodeName) g_free(nodeName); return eventHandled; } /** * Open the selected file. * This is called when a file is rightclicked and open is selected in the menu */ void popup_open_recent_file_cb() { gchar *command = NULL; GError *err = NULL; GtkWidget *dialog = NULL; gchar *absFilePath = NULL; // We can only open files if (!recent_clicked_node.valid || recent_clicked_node.type != ITEMTYPE_FILE) { goto EXITPOINT; } //debug_printf("name:%s\n",recent_clicked_node.name); if (!open_filename(recent_clicked_node.name, (gchar*)get_project_directory(), &err)) { goto EXITPOINT; } EXITPOINT: if (err != NULL) { dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Could not open selected file: \n\n%s", err->message); gtk_dialog_run(GTK_DIALOG (dialog)); } if (command) g_free(command); if (absFilePath) g_free(absFilePath); if (err) g_error_free(err); if (dialog) gtk_widget_destroy(dialog); } /** * Callback handler for Gtk "row-activated" event. * * @param treeView is the GtkTreeView * @param path is the GtkTreePath of the activated row * @param column is not used * @param userData is not used */ static void recent_tree_row_activated_cb(GtkTreeView *treeView, GtkTreePath *path, GtkTreeViewColumn *column, gpointer userData) { GtkTreeIter iter; gchar *relFilePath = NULL; gchar *command = NULL; GError *err = NULL; GtkWidget *dialog = NULL; gint nodeItemType; // Get the data from the row that was activated GtkTreeModel *treeModel = gtk_tree_view_get_model(treeView); gtk_tree_model_get_iter(treeModel, &iter, path); gtk_tree_model_get(treeModel, &iter, COLUMN_ITEMTYPE, &nodeItemType, COLUMN_FILEPATH, &relFilePath, -1); gchar *absFilePath = fix_path((gchar*)get_project_directory(),relFilePath); gchar *fixed = fix_path((gchar*)get_project_directory(),relFilePath); if ((command = g_strdup_printf("open:%s\n", fixed)) == NULL) { g_set_error(&err, APP_SCITEPROJ_ERROR, -1, "%s: %s, g_strdup_printf() = NULL", __func__, "Error formatting SciTE command" ); } else { if (send_scite_command(command, &err)) { // Try to activate SciTE; ignore errors activate_scite(NULL); if (prefs.give_scite_focus == TRUE) { send_scite_command((gchar*)"focus:0", NULL); } add_file_to_recent(fixed, NULL); gchar *statusbar_text = g_strdup_printf(_("Opened %s"), remove_newline(get_filename_from_full_path(command))); set_statusbar_text(statusbar_text); g_free(statusbar_text); } } //EXITPOINT: if (err != NULL) { dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Could not open selected file: \n\n%s"), err->message ); gtk_dialog_run(GTK_DIALOG (dialog)); } if (relFilePath) g_free(relFilePath); if (absFilePath) g_free(absFilePath); if (command) g_free(command); if (err) g_error_free(err); if (dialog) gtk_widget_destroy(dialog); if (fixed) g_free(fixed); } /** * */ void popup_remove_recent_file_cb() { gchar *command = NULL; GError *err = NULL; GtkWidget *dialog = NULL; gchar *absFilePath = NULL; gchar *fileName = NULL; // There are only files in this list if (!recent_clicked_node.valid || recent_clicked_node.type != ITEMTYPE_FILE) { goto EXITPOINT; } fileName = get_filename_from_full_path((gchar*)recent_clicked_node.name); remove_if_already_exists(fileName); EXITPOINT: if (err != NULL) { dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Could not open selected file: \n\n%s"), err->message ); gtk_dialog_run(GTK_DIALOG (dialog)); } if (command) g_free(command); if (absFilePath) g_free(absFilePath); if (err) g_error_free(err); if (dialog) gtk_widget_destroy(dialog); } /** * Callback for the menu item */ void copy_recent_filename_to_clipboard_cb() { if (!recent_clicked_node.valid || recent_clicked_node.type != ITEMTYPE_FILE) { //goto EXITPOINT; } else { copy_filename_to_clipboard(gtk_tree_view_get_model(GTK_TREE_VIEW(recentTreeView)), &(recent_clicked_node.iter)); } } /** * */ void properties_recent_file_cb() { if (!recent_clicked_node.valid || recent_clicked_node.type != ITEMTYPE_FILE) { //goto EXITPOINT; } else { file_properties_gui(gtk_tree_view_get_model(GTK_TREE_VIEW(recentTreeView)), &(recent_clicked_node.iter)); } } sciteproj-1.14/src/prefs.c0000644000175000017500000002434113542152470015072 0ustar gusnangusnan/** * prefs.c - prefs for SciteProj * * Copyright 2006 Roy Wood, 2009-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #include #include #include #include #include #include "prefs.h" #include "string_utils.h" #include "script.h" #include "file_utils.h" /** * */ gboolean check_for_old_style_config(); int load_lua_config(gchar *filename, gchar *full_string); /** * */ sciteproj_prefs prefs; gchar *prefs_filename; gchar *default_config_string = (gchar*)"" \ "-----------------------------\n" "-- Configuration for SciteProj\n" "-----------------------------\n" "\n" "-- Window geometry:\n" "xpos=40\n" "ypos=40\n" "width=200\n" "height=400\n" "\n" "-- Search window geometry (-1 on xpos and ypos means default center screen):\n" "search_xpos=-1\n" "search_ypos=-1\n" "search_width=500\n" "search_height=400\n" "\n" "search_alert_file_warnings=TRUE\n" "search_match_case=FALSE\n" "search_match_whole_words=FALSE\n" "search_trim_results=TRUE\n" "\n" "-- other:\n" "give_scite_focus=FALSE\n" "search_give_scite_focus=TRUE\n" "\n" "show_recent=FALSE\n" "recent_add_to_bottom=FALSE\n" "\n" "hide_statusbar=FALSE\n" "\n" "\n"; /** * Check config string - is it valid? */ gboolean check_config_string(gchar *in_config) { gboolean result = FALSE; int co = 0; gdouble tempdouble; gchar *tempstring = NULL; int pos = -1; gchar *value = in_config; // clear scite Path prefs.scite_path = NULL; for (co = 0; co < (int)strlen(in_config); co++) { if (in_config[co] == '=') pos=co; if (pos == -1) { value++; } } if (pos != -1) { tempstring = g_strndup(in_config, pos); value++; } if ((tempstring != NULL) && (value != NULL)) { tempstring = g_strchug(tempstring); tempstring = g_strchomp(tempstring); value = g_strchug(value); value = g_strchomp(value); if (g_ascii_strcasecmp(tempstring, "xpos") == 0) { tempdouble = g_ascii_strtod(value, NULL); prefs.xpos = (int) tempdouble; } if (g_ascii_strcasecmp(tempstring, "ypos") == 0) { tempdouble = g_ascii_strtod(value, NULL); prefs.ypos = (int)tempdouble; } if (g_ascii_strcasecmp(tempstring, "width") == 0) { tempdouble = g_ascii_strtod(value, NULL); prefs.width = (int)tempdouble; } if (g_ascii_strcasecmp(tempstring, "height") == 0) { tempdouble = g_ascii_strtod(value, NULL); prefs.height = (int)tempdouble; } if (g_ascii_strcasecmp(tempstring, "give_scite_focus") == 0) { if (g_ascii_strcasecmp(value, "TRUE") == 0) { prefs.give_scite_focus = TRUE; } } if (g_ascii_strcasecmp(tempstring, "scite_path") == 0) { prefs.scite_path = g_strdup_printf("%s", value); } if (g_ascii_strcasecmp(tempstring, "show_recent") == 0) { if (g_ascii_strcasecmp(value, "TRUE") == 0) { prefs.show_recent = TRUE; } } if (g_ascii_strcasecmp(tempstring, "recent_add_to_bottom") == 0) { if (g_ascii_strcasecmp(value, "TRUE") == 0) { prefs.recent_add_to_bottom = TRUE; } } if (g_ascii_strcasecmp(tempstring, "hide_statusbar") == 0) { if (g_ascii_strcasecmp(value, "TRUE") == 0) { prefs.hide_statusbar = TRUE; } } if (g_ascii_strcasecmp(tempstring, "start_scite") == 0) { if (g_ascii_strcasecmp(value, "TRUE") == 0) { prefs.start_scite = TRUE; } } } if (tempstring != NULL) g_free(tempstring); return result; } /** * init_prefs */ gboolean init_prefs(gchar *target_directory, GError **err) { //FILE *fp; //gchar buf[PREFS_BUFSIZE]; gchar *config_string = NULL; gboolean result = TRUE; // the list of strings gchar **list = NULL; // Set default values prefs.lhs = 1; prefs.width = 200; prefs.height = 600; prefs.verbosity = 0; // No informational messages prefs.last_file_filter = -1; // All files (my choice) prefs.give_scite_focus = FALSE; prefs.show_recent = FALSE; prefs.recent_add_to_bottom = FALSE; prefs.scite_path = NULL; prefs.hide_statusbar = FALSE; prefs.start_scite = FALSE; // First, check the file ~/.config/sciteprojrc.lua gchar *test_prefs_filename = g_build_filename(g_get_user_config_dir(), "sciteprojrc.lua", NULL); if (g_file_test(test_prefs_filename, G_FILE_TEST_IS_REGULAR)) { // the file exists, load it: if (!g_file_get_contents(test_prefs_filename, &config_string, NULL, err)) { result = FALSE; goto ERROR; } if (load_lua_config(test_prefs_filename, config_string) != 0) { printf("error loading LUA config!\n"); } g_free(config_string); } g_free(test_prefs_filename); // Otherwise, check current directory, and the directories that the previous // versions used test_prefs_filename = g_build_filename(target_directory, "sciteprojrc.lua", NULL); if (!g_file_test(test_prefs_filename, G_FILE_TEST_IS_REGULAR)) { // the result of g_get_user_config_dir doesn't need to be freed, so we // dont need to put it in a pointer of its own. prefs_filename = g_build_filename(g_get_user_config_dir(), "sciteprojrc", NULL); // Check if a config-file exists if (!g_file_test(prefs_filename, G_FILE_TEST_IS_REGULAR)) { // First, check if ~/.sciteproj exists. gchar *old_configfilename = g_build_filename(g_get_home_dir(), ".sciteproj", NULL); if (!g_file_test(old_configfilename, G_FILE_TEST_IS_REGULAR)) { // No config-file exists, default to sciteprojrc.lua prefs_filename = g_strdup(test_prefs_filename); } } } else { prefs_filename = g_strdup(test_prefs_filename); } g_free(test_prefs_filename); // Load preferences from config if (!g_file_get_contents(prefs_filename, &config_string, NULL, err)) { result = FALSE; goto ERROR; } // Check if it is an old-style config, or a new LUA one if (check_for_old_style_config(config_string)) { gchar **savedlist; debug_printf("Old style config\n"); // split out the lines, and add each to the list of strings list = g_strsplit(config_string, "\n", -1); savedlist = list; gchar *temp = NULL; do { temp = *list; if (temp != NULL) { if ((temp[0] != '#') && (strcmp(temp, "") != 0)) { // We got a valid string: // no starting #, and not an empty string. check_config_string(temp); } list++; } } while (temp != NULL); g_strfreev(savedlist); } else { // ----- New style (LUA) config //if (!load_lua_config(config_string)) { if (load_lua_config(prefs_filename, config_string) != 0) { printf("error loading LUA config!\n"); } } ERROR: g_free(config_string); return result; } /** * */ void done_prefs() { g_free(prefs_filename); } /** * */ gboolean check_for_old_style_config(const gchar *teststring) { gboolean result = FALSE; int co = 0; // We satisfy it by checking for the default header and assume that if // that is there, we have an old-styled (non-LUA) config file if (g_str_has_prefix(teststring, "# ---------------------------\n" "# Configuration for SciteProj\n" "# ---------------------------\n") ) { result = TRUE; } // Another way to check is to check for lines starting with # - as a comment // LUA uses "--", so this is should work to identify oldstyle config. for (co = 0; co < strlen(teststring); co++) { if (teststring[co] == '\n') { //printf("Tecken: %c\n", teststring[co+1]); if (teststring[co+1] == '#') { result = TRUE; } } } return result; } /** * */ int load_lua_config(gchar *filename, gchar *full_string) { lua_State *lua; lua = init_script(); //if (load_script_buffer(lua, config_string)!=0) { if (load_script_buffer(lua, full_string) != 0) { printf("Error loading file: %s\n", filename); return FALSE; } run_script(lua); if (lua_global_exists(lua, "xpos")) prefs.xpos = lua_get_number(lua, "xpos"); if (lua_global_exists(lua, "ypos")) prefs.ypos = lua_get_number(lua, "ypos"); if (lua_global_exists(lua, "width")) prefs.width = lua_get_number(lua, "width"); if (lua_global_exists(lua, "height")) prefs.height = lua_get_number(lua, "height"); if (lua_global_exists(lua, "give_scite_focus")) prefs.give_scite_focus = lua_get_boolean(lua, "give_scite_focus"); if (lua_global_exists(lua, "show_recent")) prefs.show_recent = (gboolean)lua_get_boolean(lua, "show_recent"); if (lua_global_exists(lua, "recent_add_to_bottom")) prefs.recent_add_to_bottom = (gboolean)lua_get_boolean(lua, "recent_add_to_bottom"); if (lua_global_exists(lua, "hide_statusbar")) prefs.hide_statusbar = lua_get_boolean(lua, "hide_statusbar"); if (lua_global_exists(lua, "use_stock_folder_icon")) prefs.use_stock_folder_icon = lua_get_boolean(lua, "use_stock_folder_icon"); if (lua_global_exists(lua, "write_protect")) prefs.write_protect = lua_get_boolean(lua, "write_protect"); if (lua_global_exists(lua, "start_scite")) prefs.start_scite = lua_get_boolean(lua, "start_scite"); done_script(lua); return 0; } sciteproj-1.14/src/tree_manipulation.c0000644000175000017500000004466213542152470017502 0ustar gusnangusnan/** * tree_manipulation.c - GtkTreeView manipulation code for SciteProj * * Copyright 2006 Roy Wood, 2009-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #include #include #include #include #include #include #include "tree_manipulation.h" #include "string_utils.h" #include "graphics.h" #include "prefs.h" #include "clicked_node.h" #include "gui.h" #include "icon.h" #include "file_utils.h" #define APP_SCITEPROJ_ERROR g_quark_from_static_string("APP_TREEMANIPULATION_ERROR") GtkTreeStore *sTreeStore = NULL; static gchar *sProjectFilepath = NULL; static gchar *sProjectDir = NULL; gchar *saved_file_folder = NULL; // Predeclare static functions gboolean add_tree_filelist(GtkTreeIter *parentIter, GSList *fileList, GError **err); gboolean set_project_filepath(const gchar *filepath, GError **err); /** * Set the project filepath * * @param filepath is the new project filepath * @param err returns any error information */ gboolean set_project_filepath(const gchar *filepath, GError **err) { gboolean finalResult = FALSE; gchar *windowTitle = NULL; // Clear old data if (sProjectFilepath) g_free(sProjectFilepath); sProjectFilepath = NULL; if (sProjectDir) g_free(sProjectDir); sProjectDir = NULL; // Copy the filepath sProjectFilepath = g_strdup(filepath); /* // Is filepath a directory and not a file - then leave it be if (g_file_test(filepath, G_FILE_TEST_IS_DIR)) { sProjectDir = g_strdup(sProjectFilepath); } else { */ // Extract the project's base directory if (sProjectFilepath) { // Check for absolut path if (g_path_is_absolute(sProjectFilepath) == TRUE) { sProjectDir = g_strdup(sProjectFilepath); } else { if (!relative_path_to_abs_path(sProjectFilepath, &sProjectDir, NULL, err)) { goto EXITPOINT; } } if (sProjectDir[strlen(sProjectDir)-1] == G_DIR_SEPARATOR) { gchar *finalSlash = strrchr(sProjectDir, G_DIR_SEPARATOR); if (finalSlash != NULL) { *finalSlash = '\0'; }; } } //} windowTitle=g_strdup_printf("%s", get_filename_from_full_path(sProjectFilepath)); set_window_title(windowTitle); finalResult = TRUE; goto EXITPOINT; EXITPOINT: if (windowTitle) g_free(windowTitle); return finalResult; } /** * Get the project file directory. * * @return the project file's directory (pointer to static global-- do not modify!) */ const gchar* get_project_directory() { return sProjectDir; } /** * Get the GTKTreeStore (evil, but necessary for setup_gui). * * @return the GtkTreeStore* for the project or NULL if a GtkTreeStore could not be allocate * * @param err returns any error information */ GtkTreeStore* create_treestore(GError **err) { if (sTreeStore == NULL) { sTreeStore = gtk_tree_store_new(COLUMN_EOL, TYPE_ITEMTYPE, TYPE_FILEPATH, TYPE_FILENAME, TYPE_FILESIZE, TYPE_FONTWEIGHT, TYPE_FONTWEIGHTSET, TYPE_ICON, TYPE_EXPANDED, TYPE_FOLDER_CONTENT_LOADED); if (sTreeStore == NULL) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not create GtkTreeStore, gtk_tree_store_new() = NULL", __func__); } } return sTreeStore; } /** * Add a list of files to a GtkTreeStore. * * @return TRUE on success, FALSE on failure (further details returned in err) * * @param parentIter is a pointer to the parent GtkTreeIter to add to, or NULL to add to the root of the tree * @param fileList is the list of files to add to the tree * @param number_of_errors returns the number of files that couldn't be added due to duplicates * @param err returns any errors */ gboolean add_tree_filelist(GtkTreeIter *parentIter, GSList *fileList, GError **err) { g_assert(sTreeStore != NULL); g_assert(fileList != NULL); gboolean finalResult = FALSE; GtkTreeIter newIter; GSList *listIter; // Reverse the list fileList = g_slist_reverse(fileList); for (listIter = fileList; listIter != NULL; listIter = g_slist_next(listIter)) { gchar *absFilename = (gchar *) (listIter->data); if (!absFilename) { continue; } if (listIter == fileList) { add_tree_file(parentIter, ADD_CHILD, absFilename, &newIter, TRUE, err); } else { add_tree_file(&newIter, ADD_AFTER, absFilename, &newIter, TRUE, err); } } finalResult = TRUE; return finalResult; } /** * Add a group node to an existing parent node, or to the root of the GtkTreeStore. * * @return TRUE on success, FALSE on failure (further details returned in err) * * @param parentIter is a pointer to the parent GtkTreeIter to add to, * or NULL to add to the root of the tree * @param position indicates the relative position to add the file node * @param newIter returns the new GtkTreeIter (pass NULL if this result is not needed) * @param groupname is the name of the group to add to the tree * @param err returns any errors */ gboolean add_tree_group(GtkTreeIter *parentIter, enum NodePosition position, const gchar* groupname, const gchar* full_name, gboolean expanded, GtkTreeIter *newIter, GError **err) { g_assert(sTreeStore != NULL); g_assert(groupname != NULL); gboolean finalResult = FALSE; GtkTreeIter iter; // Append to root, or before/after/within an existing node? // swap before and after if (parentIter == NULL) { gtk_tree_store_insert_before(sTreeStore, &iter, NULL, NULL); } else if (position == ADD_BEFORE) { gtk_tree_store_insert_before(sTreeStore, &iter, NULL, parentIter); } else if (position == ADD_AFTER) { gtk_tree_store_insert_after(sTreeStore, &iter, NULL, parentIter); } else if (position == ADD_CHILD) { gtk_tree_store_insert(sTreeStore,&iter,parentIter,1000); } if (newIter) { *newIter = iter; } gtk_tree_store_set(sTreeStore, &iter, COLUMN_ITEMTYPE, ITEMTYPE_GROUP, -1); gtk_tree_store_set(sTreeStore, &iter, COLUMN_FILENAME, groupname, -1); gtk_tree_store_set(sTreeStore, &iter, COLUMN_FILEPATH, full_name, -1); gtk_tree_store_set(sTreeStore, &iter, COLUMN_FONTWEIGHT, PANGO_WEIGHT_BOLD, -1); gtk_tree_store_set(sTreeStore, &iter, COLUMN_FONTWEIGHTSET, TRUE, -1); gtk_tree_store_set(sTreeStore, &iter, COLUMN_FOLDER_CONTENT_LOADED, FALSE, -1); gtk_tree_store_set(sTreeStore, &iter, COLUMN_ICON, directory_closed_pixbuf, -1); gtk_tree_store_set(sTreeStore, &iter, COLUMN_EXPANDED, expanded, -1); finalResult = TRUE; return finalResult; } /** * Add a file node to an existing parent node, or to the root of the GtkTreeStore. * * @return TRUE on success, FALSE on failure (further details returned in err) * * @param currentIter is a pointer to the parent GtkTreeIter to add to, or NULL to add to the root of the tree * @param position indicates the relative position to add the file node * @param filepath is the filepath to add to the tree * @param newIter returns the GtkTreeIter that refers to the new node * @param makeRelative indicates whether the filepath should be converted to a relative path before being added to the tree * @param err returns any errors */ gboolean add_tree_file(GtkTreeIter *currentIter, enum NodePosition position, const gchar* filepath, GtkTreeIter *newIter, gboolean makeRelative, GError **err) { g_assert(sTreeStore != NULL); g_assert(filepath != NULL); g_assert(position == ADD_BEFORE || position == ADD_AFTER || position == ADD_CHILD); gboolean finalResult = FALSE; GtkTreeIter iter; const gchar* fileName = NULL; gchar *relFilename = NULL; gchar *fileExt=NULL; if (!makeRelative) { relFilename = g_strdup(filepath); } else if (!abs_path_to_relative_path(filepath, &relFilename, sProjectDir, err)) { printf("abs_path_to_relative_path FAILED!\n"); goto EXITPOINT; } // Extract filename from filepath fileName = get_filename_from_full_path((gchar*)filepath); // Append to root, or before/after/within an existing node? if (currentIter == NULL) { gtk_tree_store_insert_before(sTreeStore, &iter, NULL, NULL); } else if (position == ADD_BEFORE) { gtk_tree_store_insert_before(sTreeStore, &iter, NULL, currentIter); } else if (position == ADD_AFTER) { gtk_tree_store_insert_after(sTreeStore, &iter, NULL, currentIter); } else if (position == ADD_CHILD) { gtk_tree_store_insert(sTreeStore,&iter,currentIter,1000); } fileExt=strrchr(fileName, '.'); if (fileExt != NULL) { ++fileExt; } if (fileExt == NULL || strlen(fileExt) == 0) { fileExt = (gchar*)fileName; } gtk_tree_store_set(sTreeStore, &iter, COLUMN_ITEMTYPE, ITEMTYPE_FILE, -1); gtk_tree_store_set(sTreeStore, &iter, COLUMN_FILEPATH, relFilename, -1); gtk_tree_store_set(sTreeStore, &iter, COLUMN_FILENAME, fileName, -1); gtk_tree_store_set(sTreeStore, &iter, COLUMN_EXPANDED, FALSE, -1); gtk_tree_store_set(sTreeStore, &iter, COLUMN_FOLDER_CONTENT_LOADED, FALSE, -1); /* if ( (strcmp(fileExt,"cc")==0) || (strcmp(fileExt,"c++")==0) || (strcmp(fileExt,"c")==0) || (strcmp(fileExt,"cpp")==0) ) { gtk_tree_store_set(sTreeStore, &iter, COLUMN_ICON, cpp_file_pixbuf, -1); } else if ( (strcmp(fileExt,"hh")==0) || (strcmp(fileExt,"h++")==0) || (strcmp(fileExt,"h")==0) || (strcmp(fileExt,"hpp")==0) ) { gtk_tree_store_set(sTreeStore, &iter, COLUMN_ICON, header_file_pixbuf, -1); } else if ( (strcmp(fileExt,"lua")==0) ) { gtk_tree_store_set(sTreeStore, &iter, COLUMN_ICON, lua_file_pixbuf, -1); } else if ( (strcmp(fileExt,"java")==0) ) { gtk_tree_store_set(sTreeStore, &iter, COLUMN_ICON, java_file_pixbuf, -1); } else { gtk_tree_store_set(sTreeStore, &iter, COLUMN_ICON, txt_file_pixbuf, -1); } */ GdkPixbuf *icon_pixbuf = get_pixbuf_from_filename((gchar*)(filepath), GTK_ICON_SIZE_MENU); gtk_tree_store_set(sTreeStore, &iter, COLUMN_ICON, icon_pixbuf, -1); if (newIter) { *newIter = iter; } finalResult = TRUE; EXITPOINT: if (relFilename) g_free(relFilename); return finalResult; } /** * */ void helper_remove(GtkTreeIter *iter) { GtkTreeIter *tempIter = gtk_tree_iter_copy(iter); GtkTreeIter newIter; if (gtk_tree_model_iter_children(GTK_TREE_MODEL(sTreeStore),&newIter,tempIter)) { gboolean next_valid = TRUE; do { if (next_valid) { gchar *nodeContents; int itemType; gtk_tree_model_get(GTK_TREE_MODEL(sTreeStore), &newIter, COLUMN_ITEMTYPE, &itemType, COLUMN_FILEPATH, &nodeContents, -1); //gchar *fileName = get_filename_from_full_path((gchar*)nodeContents); if (itemType == ITEMTYPE_GROUP) { helper_remove(&newIter); } else { //printf("Removed: %s, %s\n",fileName,nodeContents); //remove_item(fileName,nodeContents); } } next_valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(sTreeStore), &newIter); } while(next_valid); } } /** * Remove a node from the GtkTreeStore. * * @return TRUE on success, FALSE on failure (further details returned in err) * * @param iter references the node to remove * @param err returns any errors */ extern gboolean remove_tree_node(GtkTreeIter *iter, GError **err) { gchar *file_path; int itemType; // Get the node type and content gtk_tree_model_get(GTK_TREE_MODEL(sTreeStore), iter, COLUMN_ITEMTYPE, &itemType, COLUMN_FILEPATH, &file_path, -1); if (itemType == ITEMTYPE_GROUP) { helper_remove(iter); } else { //gchar *fileName = get_filename_from_full_path((gchar*)file_path); //remove_item(fileName,file_path); } gtk_tree_store_remove(sTreeStore, iter); return TRUE; } /** * Set the icon of a node * * @return TRUE on success, FALSE on error * * @param iter is a reference to the node who's icon we want to change * @param pixbuf is the pixbuf we want as icon * @param err to return any error details * */ gboolean set_tree_node_icon(GtkTreeIter *iter, GdkPixbuf *pixbuf, GError **err) { g_assert(iter != NULL); g_assert(pixbuf != NULL); /* What is saved on disk */ gtk_tree_store_set(sTreeStore, iter, COLUMN_ICON, pixbuf, -1); g_object_ref(pixbuf); return TRUE; } /** * set_tree_node_expanded */ gboolean set_tree_node_expanded(GtkTreeIter *iter, gboolean expanded, GError **err) { g_assert(iter != NULL); gtk_tree_store_set(sTreeStore, iter, COLUMN_EXPANDED, expanded, -1); return TRUE; } /** * */ gboolean set_tree_node_loaded(GtkTreeIter *iter, gboolean loaded, GError **err) { g_assert(iter != NULL); gtk_tree_store_set(sTreeStore, iter, COLUMN_FOLDER_CONTENT_LOADED, loaded, -1); return TRUE; } /** * Copy a node (and children) within the tree. * * @return TRUE on success, FALSE on failure (further details returned in err) * * @param srcIter is a reference to the node to move * @param dstIter is a reference to the destination node; NULL if the root of the tree * @param newIter returns the iter of the copy * @param position indicates where copy the node, relative to srcIter * @param err returns any errors */ gboolean copy_tree_node(GtkTreeIter *srcIter, GtkTreeIter *dstIter, enum NodePosition position, GtkTreeIter *newIter, GError **err) { g_assert(srcIter != NULL); g_assert(position == ADD_BEFORE || position == ADD_AFTER || position == ADD_CHILD); gchar *nodeContents = NULL; gboolean finalResult = FALSE; gint itemType; GtkTreeIter srcChildIter; GtkTreeIter dstChildIter; GtkTreePath *srcPath = NULL; GtkTreePath *newPath = NULL; gboolean groupIsExpanded = FALSE; GtkTreeIter newGroupIter; // Get the node type and content gtk_tree_model_get(GTK_TREE_MODEL(sTreeStore), srcIter, COLUMN_ITEMTYPE, &itemType, COLUMN_FILEPATH, &nodeContents, -1); // Add a file or group? if (itemType == ITEMTYPE_FILE) { if (!add_tree_file(dstIter, position, nodeContents, newIter, FALSE, err)) { goto EXITPOINT; } } else { // Is the source group currently expanded? srcPath = gtk_tree_model_get_path(GTK_TREE_MODEL(sTreeStore), srcIter); groupIsExpanded = tree_row_is_expanded(srcPath); // Add the copy of the group if (!add_tree_group(dstIter, position, nodeContents, nodeContents, groupIsExpanded, &newGroupIter, err)) { goto EXITPOINT; } if (newIter) { *newIter = newGroupIter; } // Recursively copy the group's contents, too if (gtk_tree_model_iter_children(GTK_TREE_MODEL(sTreeStore), &srcChildIter, srcIter)) { // Copy the first child as ADD_CHILD if (!copy_tree_node(&srcChildIter, &newGroupIter, ADD_CHILD, &dstChildIter, err)) { goto EXITPOINT; } // Copy each subsequent child ADD_AFTER its prior sibling while (gtk_tree_model_iter_next(GTK_TREE_MODEL(sTreeStore), &srcChildIter)) { if (!copy_tree_node(&srcChildIter, &dstChildIter, ADD_AFTER, &dstChildIter, err)) { goto EXITPOINT; } } } // Expand the new group? if (groupIsExpanded) { newPath = gtk_tree_model_get_path(GTK_TREE_MODEL(sTreeStore), &newGroupIter); expand_tree_row(newPath, FALSE); } } finalResult = TRUE; EXITPOINT: if (nodeContents) g_free(nodeContents); if (srcPath) gtk_tree_path_free(srcPath); if (newPath) gtk_tree_path_free(newPath); return finalResult; } /** * */ void sort_children(GtkTreeIter *node,GError **err,StringCompareFunction compare_func) { GtkTreeIter *saved_iter=node; GtkTreeIter childIter; GtkTreeModel *tree_model = GTK_TREE_MODEL(sTreeStore); gint nodeType = -1; GSList *itemList=NULL; if (gtk_tree_model_iter_children(tree_model,&childIter,node)) { int q = gtk_tree_model_iter_n_children(tree_model,node); while (q > 0) { gchar *nodeContents; gtk_tree_model_get(tree_model, &childIter, COLUMN_ITEMTYPE, &nodeType, COLUMN_FILEPATH, &nodeContents, -1); if (nodeType == ITEMTYPE_FILE) { gchar *newAbsPath = NULL; relative_path_to_abs_path(nodeContents, &newAbsPath, get_project_directory(),err); if (itemList == NULL) { itemList = g_slist_append(itemList, newAbsPath); } else { itemList = g_slist_insert_sorted(itemList, newAbsPath, compare_func); } gtk_tree_store_remove(sTreeStore,&childIter); } else { gtk_tree_model_iter_next(tree_model,&childIter); } q--; } } if (itemList != NULL) add_tree_filelist(saved_iter, itemList, err); GtkTreePath *path = gtk_tree_model_get_path(tree_model,saved_iter); expand_tree_row(path, TRUE); } /* struct TestStruct { gchar *string_to_check_for; gboolean found; }; typedef struct TestStruct TestStruct; gboolean foreach_finder(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { gint nodeType=-1; gchar *node_contents; gtk_tree_model_get(model, iter, COLUMN_ITEMTYPE, &nodeType, COLUMN_FILENAME, &node_contents, -1); TestStruct *test=(TestStruct*)(data); gboolean res=FALSE; if (g_ascii_strcasecmp(node_contents,test->string_to_check_for)==0) { test->found=TRUE; res=TRUE; } g_free(node_contents); return res; } */ /** * */ gboolean add_tree_folderlist(GtkTreeIter *iter, GSList *folder_list, gchar *folder_path) { if (folder_list) { while(folder_list != NULL) { gchar *short_filename; gchar *current_file; short_filename = (gchar*)(folder_list->data); current_file=g_build_filename(folder_path, short_filename, NULL); if (g_file_test(current_file, G_FILE_TEST_IS_DIR)) { GtkTreeIter *new_iter = gtk_tree_iter_copy(iter); add_tree_group(new_iter, ADD_CHILD, short_filename, current_file, TRUE, new_iter, NULL); if (get_number_of_files_in_folder(current_file) > 0) { add_tree_file(new_iter, ADD_CHILD, "", new_iter, FALSE, NULL); } } folder_list = folder_list->next; } } return TRUE; } sciteproj-1.14/src/graphics.c0000644000175000017500000000540713542152470015555 0ustar gusnangusnan/** * graphics.c - graphics code for SciteProj * * Copyright 2009-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #include #include "string_utils.h" #include "graphics.h" #include "about.h" #include "../graphics/dir-close.xpm" #include "../graphics/dir-open.xpm" #include "../graphics/sciteproj.xpm" #include "prefs.h" GdkPixbuf *header_file_pixbuf = NULL; GdkPixbuf *cpp_file_pixbuf = NULL; GdkPixbuf *txt_file_pixbuf = NULL; GdkPixbuf *java_file_pixbuf = NULL; GdkPixbuf *lua_file_pixbuf = NULL; GdkPixbuf *directory_closed_pixbuf = NULL; GdkPixbuf *directory_open_pixbuf = NULL; GdkPixbuf *program_icon_pixbuf = NULL; GdkCursor *standard_cursor = NULL; GdkCursor *busy_cursor = NULL; #define APP_SCITEPROJ_ERROR g_quark_from_static_string("APP_GRAPHICS_ERROR") /** * Loads all graphics required by the program * @return TRUE on success, FALSE on failure * @param err returns any errors * @param widget - we need a widget for the gtk_widget_render_icon function * */ gboolean load_graphics(GtkWidget *widget, GError **err) { GtkIconTheme *icon_theme; icon_theme = gtk_icon_theme_get_default(); program_icon_pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)sciteproj_xpm); if (prefs.use_stock_folder_icon) { // use GTK_STOCK_DIRECTORY directory_closed_pixbuf = gtk_icon_theme_load_icon(icon_theme, "folder", 14, 0, NULL); directory_open_pixbuf = gtk_icon_theme_load_icon(icon_theme, "folder", 14, 0, NULL); } else { directory_open_pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)dir_open_xpm); directory_closed_pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)dir_close_xpm); } GdkDisplay *default_display; default_display = gdk_display_get_default(); standard_cursor = gdk_cursor_new_for_display(default_display, GDK_X_CURSOR); busy_cursor = gdk_cursor_new_for_display(default_display, GDK_WATCH); return TRUE; } /** * */ void unload_graphics() { if (program_icon_pixbuf != NULL) g_object_unref(program_icon_pixbuf); if (directory_closed_pixbuf != NULL) g_object_unref(directory_closed_pixbuf); if (directory_open_pixbuf != NULL) g_object_unref(directory_open_pixbuf); } sciteproj-1.14/src/gui_callbacks.h0000644000175000017500000000233513542152470016542 0ustar gusnangusnan/** * gui_callbacks.h - GUI callback code for SciteProj * * Copyright 2006 Roy Wood, 2009-2018 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #ifndef __HEADER_GUI_CALLBACKS_ #define __HEADER_GUI_CALLBACKS_ #define APP_SCITEPROJ_ERROR g_quark_from_static_string("APP_GUI_ERROR") void row_expand_or_collapse_cb(GtkTreeView *treeview, GtkTreeIter *arg1, GtkTreePath *arg2, gpointer user_data); void quit_menu_cb(); void about_menu_cb(); void creategroup_menu_cb(); void popup_open_file_cb(); void edit_properties_cb(); void refresh_folder_cb(); #endif /*__HEADER_GUI_CALLBACKS_*/ sciteproj-1.14/src/expand.c0000644000175000017500000000767513542152470015245 0ustar gusnangusnan/** * expand.c - expand a folder in the treeview * * Copyright 2012-2017 Andreas Rönnquist * * This file is part of SciteProj. * * devilspie2 is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * devilspie2 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 devilspie2. * If not, see . */ #include #include #include #include #include #include #include #include #include #include "clicked_node.h" #include "gui.h" #include "tree_manipulation.h" #include "file_utils.h" #include "script.h" #include "expand.h" /** * */ void expand_tree(GtkTreeModel *tree_model, GtkTreeIter *start_iter) { GtkTreeIter child_iter; gint type; gchar *filepath; if (start_iter) { if (gtk_tree_model_iter_children(tree_model, &child_iter, start_iter)) { do { gtk_tree_model_get(tree_model, &child_iter, COLUMN_ITEMTYPE, &type, COLUMN_FILEPATH, &filepath, -1); if (type == ITEMTYPE_GROUP) { // Check if we should expand this row //printf("filepath :%s\n", filepath); GtkTreePath *path = gtk_tree_model_get_path(tree_model, &child_iter); if (get_expand_folder(filepath)) { expand_tree_row(path, FALSE); expand_tree(tree_model, &child_iter); } } } while (gtk_tree_model_iter_next(tree_model, &child_iter)); } } } /** * */ void start_expand_tree(GtkTreeModel *tree_model, GtkTreeIter *iter) { if (iter) expand_tree(tree_model, iter); } /** * */ gboolean get_expand_folder(gchar *folder_name) { gboolean result = FALSE; gchar *script_filename = g_build_filename(get_project_directory(), "sciteprojrc.lua", NULL); lua_State *lua = NULL; if (g_file_test(script_filename, G_FILE_TEST_EXISTS)) { int num = -1; lua = init_script(); if (load_script(lua, script_filename) != 0) { printf("error loading script: %s\n", script_filename); goto EXITPOINT; } run_script(lua); lua_getglobal(lua, "open_folders"); // Make sure we have a value at all if (lua_isnil(lua, -1)) { goto EXITPOINT; } // And make sure that it is a table if (!lua_istable(lua, -1)) { printf("open_folders is supposed to be a table!\n"); goto EXITPOINT; } lua_pushnil(lua); while(lua_next(lua, -2)) { gchar *key = NULL; if (lua_type(lua, -2) == LUA_TSTRING) { // key type is string key = g_strdup(lua_tostring(lua, -2)); gchar *temp = clean_folder(key); g_free(key); key = temp; } if (lua_type(lua, -1) == LUA_TBOOLEAN) { // value is boolean num = lua_toboolean(lua, -1); } // gboolean abs_path_to_relative_path(const gchar *absPath, gchar **relativePath, const gchar *basePath, GError **err); // convert the absolute path to a relative path gchar *relative_path = NULL; if (g_strcmp0(folder_name, get_project_directory()) == 0) { relative_path = g_strdup("."); //get_project_directory(); } if (!relative_path) { if (abs_path_to_relative_path(folder_name, &relative_path, get_project_directory(), NULL)) { } } gchar *folder_cleaned = clean_folder(relative_path); if (g_strcmp0(key, folder_cleaned) == 0) { result = FALSE; if (num) result = TRUE; } if (key) g_free(key); if (relative_path) g_free(relative_path); if (folder_cleaned) g_free(folder_cleaned); lua_pop(lua, 1); } lua_pop(lua, 1); } EXITPOINT: g_free(script_filename); if (lua) done_script(lua); return result; } sciteproj-1.14/src/statusbar.c0000644000175000017500000000531313542152470015761 0ustar gusnangusnan/** * statusbar.c - statusbar for SciteProj * * Copyright 2009-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #include #include #include #include #include #include "statusbar.h" #define APP_SCITEPROJ_ERROR g_quark_from_static_string("APP_GUI_ERROR") GtkWidget *statusbar = NULL; guint context_id; /** * init_statusbar */ gboolean init_statusbar(GtkWidget *widget, GtkWidget *next_to, GError **err) { statusbar = gtk_statusbar_new(); if (!statusbar) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not init statusbar", __func__); return FALSE; } // gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(statusbar),TRUE); gtk_widget_set_size_request(statusbar, 1, -1); context_id = gtk_statusbar_get_context_id(GTK_STATUSBAR(statusbar), "Info"); set_statusbar_text(_("Welcome to SciteProj\n")); gtk_widget_set_size_request(statusbar, -1, 20); gtk_grid_attach_next_to(GTK_GRID(widget), statusbar, next_to, GTK_POS_BOTTOM, 1, 1); gtk_widget_show (statusbar); return TRUE; } /** * set_statusbar_text */ void set_statusbar_text(const gchar *text) { if (statusbar) { int co = 0; // new string - fill it with characters from text indata, but skip // non-showable characters. gchar *newstring = (gchar*)(g_malloc((int)(strlen(text) + 1))); int newco = 0; for (co = 0; co < (int)strlen(text); co++) { if (text[co] != '\n') { newstring[newco] = text[co]; newco++; } } newstring[newco] = '\0'; // Pop what message that was previously on the statusbar stack gtk_statusbar_pop(GTK_STATUSBAR(statusbar), context_id); // Push the new message (the statusbar will show the message that // is on top of the statusbar stack, the one pushed will be shown) // We popped the last one, because we don't take advantage of the // context_id system of the statusbar. gtk_statusbar_push(GTK_STATUSBAR(statusbar), context_id, newstring); g_free(newstring); } } /** * done_statusbar */ void done_statusbar() { if (statusbar!=NULL) gtk_widget_destroy(statusbar); } sciteproj-1.14/src/gui_callbacks.c0000644000175000017500000002571013542152470016537 0ustar gusnangusnan/** * gui_callbacks.c - GUI callback code for SciteProj * * Copyright 2006 Roy Wood, 2009-2018 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #include #include #include #include #include #include #include #include #include #include #include #include "gui_callbacks.h" #include "clicked_node.h" #include "gui.h" #include "tree_manipulation.h" #include "scite_utils.h" #include "string_utils.h" #include "prefs.h" #include "statusbar.h" #include "graphics.h" #include "about.h" #include "properties_dialog.h" #include "file_utils.h" #include "recent_files.h" #include "remove.h" #include "sort.h" #include "load_folder.h" #include "script.h" /** * Open the selected file. * This is called when a file is rightclicked and open is selected in the menu */ void popup_open_file_cb() { gchar *command = NULL; GError *err = NULL; GtkWidget *dialog = NULL; gchar *absFilePath = NULL; // several files in selection? // We can only open files if (!clicked_node.valid || clicked_node.type != ITEMTYPE_FILE) { goto EXITPOINT; } if (!open_filename(clicked_node.name, (gchar*)(get_project_directory()), &err)) { goto EXITPOINT; } add_file_to_recent(clicked_node.name, NULL); EXITPOINT: if (err != NULL) { dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Could not open selected file: \n\n%s"), err->message); gtk_dialog_run(GTK_DIALOG (dialog)); } if (command) g_free(command); if (absFilePath) g_free(absFilePath); if (err) g_error_free(err); if (dialog) gtk_widget_destroy(dialog); } /** * Open the LUA rc file for the project folder */ void edit_properties_cb() { GError *err = NULL; gchar *command = NULL; if ((command = g_strdup_printf("open:%s\n", prefs_filename)) == NULL) { g_set_error(&err, APP_SCITEPROJ_ERROR, -1, "%s: %s, g_strdup_printf() = NULL", "Error formatting SciTE command", __func__); } else { if (send_scite_command(command, &err)) { // Try to activate SciTE; ignore errors activate_scite(NULL); if (prefs.give_scite_focus == TRUE) { send_scite_command((gchar*)"focus:0", NULL); } } } } /** * step-through function for expand/collapse folder * * @param tree_view * @param newiter * @param tree_path */ static void fix_folders_step_through(GtkTreeView *tree_view, GtkTreeIter newiter, GtkTreePath *tree_path) { GtkTreeModel *tree_model = gtk_tree_view_get_model(tree_view); gchar *relFilePath; GError *error; gint nodeItemType; GtkTreeIter iter = newiter; do { gtk_tree_model_get(tree_model, &iter, COLUMN_ITEMTYPE, &nodeItemType, -1); if (nodeItemType == ITEMTYPE_GROUP) { GtkTreePath *srcPath = gtk_tree_model_get_path(tree_model, &iter); gboolean groupIsExpanded = tree_row_is_expanded(srcPath); if (groupIsExpanded) { set_tree_node_icon(&iter, directory_open_pixbuf, &error); } else { set_tree_node_icon(&iter, directory_closed_pixbuf, &error); } set_tree_node_expanded(&iter, groupIsExpanded, NULL); gtk_tree_model_get(tree_model, &iter, COLUMN_FILEPATH, &relFilePath, -1); if (gtk_tree_model_iter_has_child(tree_model, &iter)) { GtkTreeIter newIter; gtk_tree_model_iter_children(tree_model, &newIter, &iter); fix_folders_step_through(tree_view, newIter, tree_path); } g_free(relFilePath); gtk_tree_path_free(srcPath); } else { } } while(gtk_tree_model_iter_next(tree_model,&iter)); } /** * */ void load_tree_at_iter(GtkTreeView *tree_view, GtkTreeIter *iter) { // We've got the folder - get the child GtkTreeIter child; GtkTreeModel *tree_model = gtk_tree_view_get_model(tree_view); if (iter) { if (gtk_tree_model_iter_children(tree_model, &child, iter)) { remove_tree_node(&child, NULL); gchar *folder_path; gtk_tree_model_get(tree_model, iter, COLUMN_FILEPATH, &folder_path, -1); // Load the wanted filter from the LUA config GSList *filter_list = load_filter_from_lua(folder_path); GSList *file_list; //=load_folder_to_list(folder_path, FALSE, GSList *folder_list; // default sorting here compare_strings_bigger - since we turn the // list backwards after GCompareFunc comparer = get_sort_order_of_folder(folder_path); file_list = load_folder_to_list(folder_path, FALSE, comparer /*file_sort_by_extension_bigger_func*/, filter_list); folder_list = load_folder_to_list(folder_path, TRUE, compare_strings_bigger, filter_list); // Here we should filter out the unwanted items add_tree_folderlist(iter, folder_list, folder_path); if (file_list) { //file_list = g_slist_reverse(file_list); add_tree_filelist(iter, file_list, NULL); } set_tree_node_expanded(iter, TRUE, NULL); GtkTreePath *tree_path = gtk_tree_model_get_path(tree_model, iter); gtk_tree_view_expand_row(tree_view, tree_path, FALSE); gtk_tree_path_free(tree_path); g_slist_foreach(filter_list, (GFunc)g_free, NULL); g_slist_free(filter_list); } } } /** * Callback for expand/collapse event of GtkTreeView * * @param treeView is not used * @param arg1 is not used * @param arg2 is not used * @param user_data is not used */ void row_expand_or_collapse_cb(GtkTreeView *tree_view, GtkTreeIter *iter, GtkTreePath *tree_path, gpointer user_data) { /* Switch the folder icon open/closed*/ GtkTreeModel *tree_model = gtk_tree_view_get_model(tree_view); // make sure all icons the folder (and folders inside it) are set to a correct icon. fix_folders_step_through(tree_view, *iter,tree_path); gchar *temp; gboolean expanded; gboolean loaded; gtk_tree_model_get(tree_model, iter, COLUMN_FILEPATH, &temp, -1); gtk_tree_model_get(tree_model, iter, COLUMN_EXPANDED, &expanded, -1); gtk_tree_model_get(tree_model, iter, COLUMN_FOLDER_CONTENT_LOADED, &loaded, -1); //printf("%s : %d\n", temp, (int)expanded); if (!loaded) { set_tree_node_loaded(iter, TRUE, NULL); load_tree_at_iter(tree_view, iter); } } /** * Callback for "Quit" menu item */ void quit_menu_cb() { gtk_main_quit(); } /** * Callback for "About" menu item */ void about_menu_cb() { show_about_dialog(); } /** * */ gboolean key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer userData) { switch (event->keyval) { case GDK_KEY_BackSpace: { debug_printf((gchar*)"key_press_cb: keyval = %d = GDK_BackSpace, hardware_keycode = %d\n", event->keyval, event->hardware_keycode); break; } case GDK_KEY_Delete: { do_remove_node(TRUE); break; } case GDK_KEY_Insert: { break; } /* case GDK_KEY_F2: { do_rename_node(TRUE); return TRUE; } */ default: { debug_printf("key_press_cb: keyval = %d = '%c', hardware_keycode = %d\n", event->keyval, (char) event->keyval, event->hardware_keycode); return FALSE; } } if (event->state & GDK_SHIFT_MASK) debug_printf(", GDK_SHIFT_MASK"); if (event->state & GDK_CONTROL_MASK) debug_printf(", GDK_CONTROL_MASK"); if (event->state & GDK_MOD1_MASK) debug_printf(", GDK_MOD1_MASK"); if (event->state & GDK_MOD2_MASK) debug_printf(", GDK_MOD2_MASK"); if (event->state & GDK_MOD3_MASK) debug_printf(", GDK_MOD3_MASK"); if (event->state & GDK_MOD4_MASK) debug_printf(", GDK_MOD4_MASK"); if (event->state & GDK_MOD5_MASK) debug_printf(", GDK_MOD5_MASK"); debug_printf("\n"); return FALSE; } /** * search function for the gtk_tree_view_set_search_equal_func * @return TRUE when rows DONT match, FALSE when rows match */ gboolean tree_view_search_equal_func(GtkTreeModel *model,gint column, const gchar *key,GtkTreeIter *iter, gpointer search_data) { gchar *filename; // For some reason this should return TRUE if the row DONT match gboolean res = TRUE; gtk_tree_model_get(model, iter, COLUMN_FILENAME, &filename, -1); // zero when matches, which means we should return FALSE if (g_ascii_strncasecmp(key, filename, strlen(key)) == 0) res = FALSE; g_free(filename); return res; } /** * */ void refresh_folder_cb() { if (!clicked_node.valid || clicked_node.type != ITEMTYPE_GROUP) { return; } gchar *folder_name; GtkTreeModel *tree_model = gtk_tree_view_get_model(GTK_TREE_VIEW(projectTreeView)); GtkTreeIter iter = clicked_node.iter; GtkTreeIter *stored_iter = gtk_tree_iter_copy(&iter); gboolean expanded; gtk_tree_model_get(tree_model, &iter, COLUMN_FILENAME, &folder_name, COLUMN_EXPANDED, &expanded, -1); // If the folder is expanded if (expanded) { // add all rows below to a list of GtkTreePath GtkTreeIter child; GList *list_of_items = NULL; // First, store all GtkTreePath in a linked list if (gtk_tree_model_iter_children(tree_model, &child, &iter)) { GtkTreePath *tree_path; GtkTreeIter *temp_iter = &child; do { gchar *temp; gtk_tree_model_get(tree_model, temp_iter, COLUMN_FILENAME, &temp, -1); tree_path = gtk_tree_model_get_path(tree_model, temp_iter); GtkTreeRowReference *row_reference = gtk_tree_row_reference_new(tree_model, tree_path); list_of_items = g_list_append(list_of_items, row_reference); gtk_tree_path_free(tree_path); } while(gtk_tree_model_iter_next(tree_model, temp_iter)); // go through the list of row-references GList *node; for (node = list_of_items; node != NULL; node = node -> next) { tree_path = gtk_tree_row_reference_get_path((GtkTreeRowReference*)node->data); if (tree_path) { if (gtk_tree_model_get_iter(tree_model, &iter, tree_path)) remove_tree_node(&iter,NULL); } } g_list_foreach(list_of_items, (GFunc)gtk_tree_row_reference_free, NULL); } GtkTreeIter *temp_iter = gtk_tree_iter_copy(stored_iter); gchar *folder; gtk_tree_model_get(tree_model, temp_iter, COLUMN_FILEPATH, &folder, -1); GtkTreeIter new_iter; if (get_number_of_files_in_folder(folder) > 0) { add_tree_file(temp_iter, ADD_CHILD, "", &new_iter, FALSE, NULL); } load_tree_at_iter(GTK_TREE_VIEW(projectTreeView), temp_iter); //set_tree_node_loaded(temp_iter, TRUE, NULL); // get the default sort order //sort_children(stored_iter, NULL, compare_strings_smaller); } else { } } sciteproj-1.14/src/scite_utils.c0000644000175000017500000005451713542152470016312 0ustar gusnangusnan/** * scite_utils_linux.c - Code for working with Scite (GNU/Linux version) * * Copyright 2006 Roy Wood, 2009-2018 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "scite_utils.h" // This is for SciteProj : #include "prefs.h" #include "clicked_node.h" #include "gui.h" #include "graphics.h" #include "string_utils.h" #include "statusbar.h" #include "file_utils.h" #define APP_SCITEPROJ_ERROR g_quark_from_static_string("APP_SCITEUTILS_ERROR") // Indicates whether Scite was successfully forked/executed static gboolean sSciteLaunched = FALSE; // File descriptor of the request pipe static int sRequestPipeFD = 0; // File descriptor of the response pipe static int sResponsePipeFD = 0; // GLib GIOChannel of the response pipe static GIOChannel* sResponsePipeGIOChannel = NULL; // Scite executable name static gchar *sSciteExecName0 = (gchar*)"/usr/local/bin/SciTE"; static gchar *sSciteExecName1 = (gchar*)"/usr/local/bin/scite"; static gchar *sSciteExecName2 = (gchar*)"SciTE"; static gchar *sSciteExecName3 = (gchar*)"scite"; // ----------------- // X11 display Display *sDisplay = NULL; // Scite X11 window Window sSciteWin = 0; gboolean scite_exists = FALSE; void set_scite_launched(gboolean launched); /** * Determine if Scite is open and ready for communication. * * @return TRUE if Scite has been forked/executed and we have an open pipe, FALSE otherwise */ gboolean scite_ready() { return (sSciteLaunched && sRequestPipeFD != 0); } /** * Shut down all the Scite pipes and associated GIOChannels. */ void shutdown_pipes() { if (sRequestPipeFD) { close(sRequestPipeFD); sRequestPipeFD = 0; } if (sResponsePipeGIOChannel) { g_io_channel_unref(sResponsePipeGIOChannel); g_io_channel_shutdown(sResponsePipeGIOChannel, FALSE, NULL); sResponsePipeGIOChannel = NULL; } if (sResponsePipeFD) { close(sResponsePipeFD); sResponsePipeFD = 0; } sSciteWin = 0; } /** * Callback for data-ready on the pipe we use to read from Scite. We don't actually do anything with * the messages from Scite right now, other than echo them to the console. * * @param source is the GIOChannel associated with the pipe Scite writes to * @param condition is the GIOCondition for the event that triggered the callback * @param data is the user data item (not used) */ gboolean scite_pipe_read_ready_cb(GIOChannel *source, GIOCondition condition, gpointer data) { g_assert(source == sResponsePipeGIOChannel); static gchar buff[1024]; gboolean finalResult = TRUE; gsize bytes_read; GError *error = NULL; #ifdef DEBUG_SCITE debug_printf("scite_pipe_read_ready_cb\n"); #endif if (condition & G_IO_IN) { if (g_io_channel_read_chars(source, buff, sizeof(buff) - 1, &bytes_read, &error) != G_IO_STATUS_NORMAL) { g_print("%s: %s = %s\n", __func__, "g_io_channel_read_chars failed", (error != NULL) ? error->message : ""); } else { if ((bytes_read-1) > 0) { buff[bytes_read] = '\0'; // This is for SciteProj : //if(prefs.verbosity>50) { #ifdef DEBUG_SCITE debug_printf("%s: read data '%s'\n", __func__, buff); #endif //} // If the string ends with a newline, remove it! int len=strlen(buff); if (buff[len-1] == '\n') { gchar *temp = g_strndup(buff, len-1); g_snprintf(buff, 1024, "%s", temp); g_free(temp); } // Is it the response to an "askproperty" command? Dunno why they are prefixed with "macro:stringinfo:" though.... static char *askpropertyResponse = (char*)"macro:stringinfo:"; if (g_str_has_prefix(buff, askpropertyResponse)) { char *windowIDStr = buff + strlen(askpropertyResponse); sSciteWin = strtol(windowIDStr, NULL, 0); } if (g_str_has_prefix(buff, "closed:")) { gchar *file=get_filename_from_full_path(buff); gchar *status_string = g_strdup_printf(_("Closed %s"),file); set_statusbar_text(status_string); g_free(status_string); } if (g_str_has_prefix(buff, "closing:")) { set_statusbar_text(_("Closed SciTE")); } if (g_str_has_prefix(buff, "switched:")) { gchar *file=get_filename_from_full_path(buff); gchar *status_string = g_strdup_printf(_("Switched to %s"),file); set_statusbar_text(status_string); g_free(status_string); } if (g_str_has_prefix(buff, "opened:")) { gchar *file=get_filename_from_full_path(buff); gchar *status_string = g_strdup_printf(_("Opened %s"),file); set_statusbar_text(status_string); g_free(status_string); } } } } if (condition & G_IO_ERR) { g_print("%s: condition = G_IO_ERR\n", __func__); finalResult = FALSE; } if (condition & G_IO_HUP) { // This is for SciteProj : if(prefs.verbosity>50) { g_print("%s: condition = G_IO_HUP\n", __func__); } finalResult = FALSE; } if (!finalResult) { // We want to stop monitoring this GIOChannel, so shut it all down shutdown_pipes(); set_scite_launched(FALSE); //~ GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Connection to current instance of Scite has been broken"); //~ gtk_dialog_run(GTK_DIALOG(dialog)); //~ gtk_widget_destroy(dialog); } if (error) g_error_free(error); return finalResult; } /** * Callback for the progress dialog shown when opening Scite. This callback simply sets a boolean * pointed to by the userData paramater. * * @param dialog is the pointer to the dialog * @param responseID is the responseID of the cancel button * @param userData is a pointer to a boolean that we set to true */ static void cancel_button_cb(GtkDialog *dialog, gint responseID, gpointer userData) { if (userData) { *((gboolean *) userData) = TRUE; } } /** * Fork and execute an instance of Scite, then connect to its "Director" pipe. This is uglier than * I expected it to be, once I factored in the progress feedback, user cancellation, handling of * failure of the fork/exec, etc. * * @return TRUE on success, FALSE on failure (further details returned in err) * * @param err returns any errors */ gboolean launch_scite(gchar *instring,GError **err) { debug_printf("launch_scite: %s\n", instring); gboolean resultCode = FALSE; gchar* ipcDirectorName = (gchar*)"ipc.director.name"; gchar* ipcSciteName = (gchar*)"ipc.scite.name"; GtkWidget* dialog = NULL; int childPipePair[2] = { 0, 0 }; fd_set readFDS; struct timeval timeVal; gboolean userClickedCancel = FALSE; gchar responsePipePath[256]; gchar requestPipePath[256]; // Clean up anything open from previous attempts/activity shutdown_pipes(); set_scite_launched(FALSE); if (scite_exists) { gchar *scite_command; char scite_arg1[256]; char scite_arg2[256]; char scite_arg3[256]; char scite_arg4[256]; static unsigned long usecsDelta = 100000; static unsigned long usecsDialogDelay; // We need our process id for use in forming the named pipe filenames pid_t childPID = 0; gulong usecs = 0; int errCode; pid_t ourPID = getpid(); // The response pipe will be used by Scite to send data to us g_snprintf(responsePipePath, sizeof(responsePipePath), "/tmp/sciteproj.%ld", (unsigned long) ourPID); if (setenv(ipcDirectorName, responsePipePath, TRUE)) { errCode = errno; g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not launch Scite, setenv(\"%s\", \"%s\") failed, error = %s", __func__, ipcDirectorName, responsePipePath, strerror(errCode)); goto EXITPOINT; } // The request pipe will be used to send data to Scite g_snprintf(requestPipePath, sizeof(requestPipePath), "/tmp/scite.%ld", (unsigned long) ourPID); if (setenv(ipcSciteName, requestPipePath, TRUE)) { errCode = errno; g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not launch Scite, setenv(\"%s\", \"%s\") failed, error = %s", __func__, ipcSciteName, requestPipePath, strerror(errCode)); goto EXITPOINT; } // Remove any existing files that conflict with the pipe names if (remove(responsePipePath) && errno != ENOENT) { errCode = errno; g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not launch Scite, remove(\"%s\") failed, error = %s", __func__, responsePipePath, strerror(errCode)); goto EXITPOINT; } if (remove(requestPipePath) && errno != ENOENT) { errCode = errno; g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not launch Scite, remove(\"%s\") failed, error = %s", __func__, requestPipePath, strerror(errCode)); goto EXITPOINT; } // Now create our response pipe (Scite creates the request pipe, as long as it doesn't already exist) if (mkfifo(responsePipePath, 0777)) { errCode = errno; g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not launch Scite, mkfifo(\"%s\") failed, error = %s", __func__, responsePipePath, strerror(errCode)); goto EXITPOINT; } // Open the Scite response pipe if ((sResponsePipeFD = open(responsePipePath, O_RDONLY | O_NONBLOCK)) <= 0) { errCode = errno; g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not launch Scite, open(\"%s\") failed, error = %s", __func__, responsePipePath, strerror(errCode)); goto EXITPOINT; } // Hook up the Scite response pipe to our Gtk/GLib main loop if ((sResponsePipeGIOChannel = g_io_channel_unix_new(sResponsePipeFD)) == NULL) { errCode = errno; g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not launch Scite, g_io_channel_unix_new(\"%s\") failed, error = %s", __func__, responsePipePath, strerror(errCode)); goto EXITPOINT; } if ((g_io_channel_set_encoding(sResponsePipeGIOChannel, NULL, err)) != G_IO_STATUS_NORMAL) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not launch Scite, g_io_channel_set_encoding( ) failed, error = %s", __func__, (err != NULL && *err != NULL) ? (*err)->message : ""); goto EXITPOINT; } g_io_add_watch(sResponsePipeGIOChannel, (GIOCondition) (G_IO_IN | G_IO_ERR | G_IO_HUP), scite_pipe_read_ready_cb, NULL); // Also create a pipe pair so our child process can alert us if it fails to execute Scite if (pipe(childPipePair)) { errCode = errno; g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not launch Scite, pipe( ) failed, errno = %d = %s", __func__, errCode, strerror(errCode)); goto EXITPOINT; } // Fix the instring gchar *opt1 = NULL; gchar *opt2 = NULL; if (instring != NULL) { int len = strlen(instring); int split = -1; gchar *tempstring = instring; gchar *place = NULL; int co; for (co=0; co < len; co++) { gchar temp = instring[co]; if (temp == ' ') { split = co; co = len; place = tempstring; } tempstring++; } if (split != -1) { opt1 = g_strndup(instring, split); opt2 = g_strdup(place); } else { opt1 = g_strdup(instring); } } debug_printf("opt1:%s\n", opt1); debug_printf("opt2:%s\n", opt2); // Set up the command line if (opt1 != NULL) { opt1 = g_strchug(opt1); opt1 = g_strchomp(opt1); strcpy(scite_arg1, opt1); } else { strcpy(scite_arg1, ""); } if (opt2 != NULL) { opt2 = g_strchug(opt2); opt2 = g_strchomp(opt2); strcpy(scite_arg2, opt2); } else { strcpy(scite_arg2, ""); } strcpy(scite_arg3, ""); strcpy(scite_arg4, ""); // Fork and (we hope) exec Scite childPID = fork(); if (childPID == -1) { errCode = errno; g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not launch Scite, fork() failed, errno = %d = %s", __func__, errCode, strerror(errCode)); goto EXITPOINT; } else if (childPID == 0) { debug_printf("Launching:'%s','%s','%s','%s'\n",scite_arg1,scite_arg2,scite_arg3,scite_arg4); // We are the child process, so close our end of the read pipe close(childPipePair[0]); if (prefs.scite_path != NULL) { execlp(prefs.scite_path, prefs.scite_path, scite_arg1, scite_arg2, scite_arg3, scite_arg4, (char *) NULL); } else { // Execute Scite, if we can (Check for SciTE) execlp(sSciteExecName0, sSciteExecName0, scite_arg1, scite_arg2, scite_arg3, scite_arg4, (char *) NULL); // Apparently the execlp failed, so try the alternative SciTE executable name (scite) execlp(sSciteExecName1, sSciteExecName1, scite_arg1, scite_arg2, scite_arg3, scite_arg4, (char *) NULL); // (/usr/local/bin/SciTE) execlp(sSciteExecName2, sSciteExecName2, scite_arg1, scite_arg2, scite_arg3, scite_arg4, (char *) NULL); // (/usr/local/bin/scite) execlp(sSciteExecName3, sSciteExecName3, scite_arg1, scite_arg2, scite_arg3, scite_arg4, (char *) NULL); } // If we get here, the execlp() failed, so tell our parent and exit char *message = (gchar*)"Error: Could not execute Scite from child process"; int messageLength = strlen(message); int bytesWritten; g_print("%s: %s\n", __func__, message); bytesWritten = write(childPipePair[1], message, messageLength); if (bytesWritten < messageLength) { g_print("%s: Problem sending message to parent: messageLength = %d, bytesWritten = %d\n", __func__, messageLength, bytesWritten); } close(childPipePair[1]); //_exit(0); } // We are the parent process, and everything looks good so far set_scite_launched(TRUE); // Close our end of the child write pipe close(childPipePair[1]); childPipePair[1] = 0; // Wait for Scite to create a request pipe, or for our child to report failure, or for the user to cancel for (usecs = 0; ; usecs += usecsDelta) { // If the pipe is there, stop waiting struct stat fileStat; if (stat(requestPipePath, &fileStat) == 0 && S_ISFIFO(fileStat.st_mode)) { break; } // Did our child send back an error message? FD_ZERO(&readFDS); FD_SET(childPipePair[0], &readFDS); timeVal.tv_sec = 0; timeVal.tv_usec = 0; if (select(childPipePair[0] + 1, &readFDS, NULL, NULL, &timeVal) > 0) { // If the child sent *any* data, it failed to exec Scite set_scite_launched(FALSE); g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not launch Scite, execlp( ) failed", __func__); goto EXITPOINT; } // No luck yet, so display a progress dialog and wait a bit longer if (usecs > usecsDialogDelay && !dialog) { dialog = gtk_message_dialog_new(get_main_window(), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_CANCEL, _("Connecting to Scite....")); g_signal_connect(dialog, "response", G_CALLBACK(cancel_button_cb), (void *) &userClickedCancel); gtk_widget_show_all(dialog); } while (gtk_events_pending()) { gtk_main_iteration(); } if (userClickedCancel) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not connect to Scite", __func__); goto EXITPOINT; } g_usleep(usecsDelta); } // Try to open the request pipe if ((sRequestPipeFD = open(requestPipePath, O_WRONLY | O_NONBLOCK)) <= 0) { errCode = errno; g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not launch Scite, open(\"%s\") failed, error = %s", __func__, requestPipePath, strerror(errCode)); goto EXITPOINT; } // Ask SciTE for the x11 window ID scite_command = (gchar*)"askproperty:x11.windowid\n"; if (!send_scite_command(scite_command, err)) { goto EXITPOINT; } // g_print("%s: Problem sending message to parent: messageLength = %d, bytesWritten = %d\n", __func__, messageLength, bytesWritten); // Now, let's resize the new window -- // if (!send_scite_command("property:position.left=300\n", err)) { // goto EXITPOINT; // } // Wow-- it all actually worked! resultCode = TRUE; set_statusbar_text(_("Launched SciTE")); } debug_printf("All done launching SciTE...\n"); EXITPOINT: if (dialog) gtk_widget_destroy(dialog); if (childPipePair[0]) close(childPipePair[0]); if (childPipePair[1]) close(childPipePair[1]); if (!resultCode) { shutdown_pipes(); set_scite_launched(FALSE); } return resultCode; } /** * Send a command to Scite. * * @return TRUE on success, FALSE on failure (further details returned in err) * * @param command is the command to send to Scite * @param err returns any errors */ gboolean send_scite_command(gchar *command, GError **err) { g_assert(command != NULL); #ifdef DEBUG_SCITE debug_printf("send_scite_command(%s)\n",command); #endif gboolean resultCode = FALSE; int commandLength = strlen(command); // Ensure we are connected to a running instance of Scite if (!scite_ready() && !launch_scite(NULL,err)) { goto EXITPOINT; } // Send the command over the request pipe.... if ((write(sRequestPipeFD, command, commandLength)) < commandLength) { int errCode = errno; g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not send command to Scite, write(\"%s\") failed, errno = %d = %s", __func__, command, errCode, strerror(errCode)); goto EXITPOINT; } resultCode = TRUE; EXITPOINT: return resultCode; } /** * Activate our child SciTE instance (i.e. bring it to the front) * * @return TRUE if SciTE could be activated; FALSE otherwise (see err for more information) * * @param err returns any errors */ gboolean activate_scite(GError **err) { gboolean finalResult = FALSE; XEvent event; Window rootWindow; long eventMask = SubstructureRedirectMask | SubstructureNotifyMask; // Open the X11 display, if we haven't already done so if (sDisplay == NULL) { char *displayName = getenv("DISPLAY"); if (displayName == NULL || *displayName == '\0') { displayName = (char*)":0.0"; } sDisplay = XOpenDisplay(displayName); if (sDisplay == NULL) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not open X display, XOpenDisplay() = NULL", __func__); goto EXITPOINT; } } // Do we actually have a reference to the SciTE window? if (sSciteWin == 0) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not activate SciTE window, X11 window ID invalid", __func__); goto EXITPOINT; } // Send the "_NET_ACTIVE_WINDOW" message to the ewmh-compliant window manager (we hope) rootWindow = DefaultRootWindow(sDisplay); event.xclient.type = ClientMessage; event.xclient.window = sSciteWin; event.xclient.message_type = XInternAtom(sDisplay, "_NET_ACTIVE_WINDOW", False); event.xclient.format = 32; event.xclient.data.l[0] = 1; event.xclient.data.l[1] = 0; event.xclient.data.l[2] = 0; event.xclient.data.l[3] = 0; event.xclient.data.l[4] = 0; //~ g_print("%s: sDisplay = 0x%lX, message_type = 0x%lX, window = 0x%lX, rootWindow = 0x%lX\n", __func__, (long) sDisplay, (long) event.xclient.message_type, (long) event.xclient.window, (long) rootWindow); if (!XSendEvent(sDisplay, rootWindow, False, eventMask, &event)) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not activate SciTE, XSendEvent() = FALSE", __func__); } XFlush(sDisplay); XMapRaised(sDisplay, sSciteWin); finalResult = TRUE; EXITPOINT: return finalResult; } /** * */ void set_scite_launched(gboolean launched) { sSciteLaunched=launched; } /** * scite_exists */ gboolean check_if_scite_exists() { // Check if a config-file exists gboolean exists = FALSE; #ifdef DEBUG_SCITE debug_printf("prefs:%s\n", prefs.scite_path); #endif if (prefs.scite_path != NULL) { if (g_file_test(prefs.scite_path, G_FILE_TEST_EXISTS)) exists = TRUE; } else { if (g_file_test(sSciteExecName0, G_FILE_TEST_EXISTS)) exists = TRUE; if (g_file_test(sSciteExecName1, G_FILE_TEST_EXISTS)) exists = TRUE; // Check both gchar *test_filename = g_build_filename("/bin", sSciteExecName2, NULL); if (g_file_test(test_filename, G_FILE_TEST_EXISTS)) exists = TRUE; if (test_filename != NULL) g_free(test_filename); test_filename = g_build_filename("/usr/bin", sSciteExecName2, NULL); if (g_file_test(test_filename, G_FILE_TEST_EXISTS)) exists = TRUE; if (test_filename != NULL) g_free(test_filename); test_filename = g_build_filename("/usr/local/bin", sSciteExecName2, NULL); if (g_file_test(test_filename, G_FILE_TEST_EXISTS)) exists = TRUE; if (test_filename != NULL) g_free(test_filename); test_filename = g_build_filename("/bin", sSciteExecName3, NULL); if (g_file_test(test_filename, G_FILE_TEST_EXISTS)) exists = TRUE; if (test_filename != NULL) g_free(test_filename); test_filename = g_build_filename("/usr/bin", sSciteExecName3, NULL); if (g_file_test(test_filename, G_FILE_TEST_EXISTS)) exists = TRUE; if (test_filename != NULL) g_free(test_filename); test_filename = g_build_filename("/usr/local/bin", sSciteExecName3, NULL); if (g_file_test(test_filename, G_FILE_TEST_EXISTS)) exists = TRUE; if (test_filename != NULL) g_free(test_filename); } scite_exists = exists; return exists; } /** * init_scite_connection * currently doesn't do anything on GNU/Linux */ void init_scite_connection() { } /** * */ gboolean open_filename(gchar *filename, gchar *project_directory, GError **err) { gchar *command = NULL; if (!relative_path_to_abs_path(filename, &filename, project_directory, err)) { return FALSE; } // It's a file, so try to open it if ((command = g_strdup_printf("open:%s\n", filename)) == NULL) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Error formatting Scite director command, g_strdup_printf() = NULL", __func__); return FALSE; } else { if (send_scite_command(command, err)) { // Try to activate SciTE; ignore errors activate_scite(NULL); if (prefs.give_scite_focus == TRUE) { send_scite_command((gchar*)"focus:0", NULL); } } } return TRUE; } sciteproj-1.14/src/clicked_node.h0000644000175000017500000000202013542152470016351 0ustar gusnangusnan/** * clicked_node.h - clicked node struct for SciteProj * * Copyright 2006 Roy Wood, 2009-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #ifndef __HEADER_CLICKED_NODE_ #define __HEADER_CLICKED_NODE_ /** * */ struct ClickedNode { gboolean valid; GtkTreeIter iter; gchar *name; gint type; }; typedef struct ClickedNode ClickedNode; #endif /*__HEADER_CLICKED_NODE_*/ sciteproj-1.14/src/about.c0000644000175000017500000002441313542152470015065 0ustar gusnangusnan/** * about.c - about dialog for SciteProj * * Copyright 2008-2019 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #include #include #include #include #include "about.h" #include "graphics.h" #include "prefs.h" gchar *homepage_string=(gchar*)"https://www.nongnu.org/sciteproj"; gchar *sVersion = (gchar*)SCITEPROJ_VERSION; static GtkWidget *window; void create_about_dialog(); gboolean handle_about_close_event(GtkWidget *widget, GdkEvent *event, gpointer user_data); void link_button_cb(GtkButton *button, gpointer user_data); gchar *version_string = NULL; /** * show_about_dialog * Shows the about dialog, and if it isnt already made, creates it */ void show_about_dialog() { if (!window) create_about_dialog(); else gtk_window_present(GTK_WINDOW(window)); } /** * Handle keyboard pressing escape in about dialog */ gboolean handle_keyboard_event_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) { if (event->keyval == GDK_KEY_Escape) { // printf("Escape pressed.\n"); gtk_widget_hide(window); return TRUE; } return FALSE; } /** * creates a new dialog box, and fills it will all necessary information */ void create_about_dialog() { GtkWidget *grid; GtkWidget *textview_info; GtkWidget *logo_image; GtkWidget *linkbutton; GtkWidget *ok_button; GtkWidget *notebook; GtkWidget *notebook_label1; GtkWidget *notebook_label2; GtkWidget *sciteproj_label; GtkWidget *version_string_label; GtkWidget *copyright_label; GtkWidget *gtk_version_label; GtkTextBuffer *textbuffer_info; GtkTextBuffer *textbuffer_license; GtkWidget *textview_license; GtkTextIter iter; gchar *copyrightstring; // Make the dialog window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width(GTK_CONTAINER(window), 8); gtk_widget_set_size_request(window, 500, 400); // Make a container grid = gtk_grid_new(); gtk_grid_set_row_spacing (GTK_GRID (grid), 6); gtk_container_add(GTK_CONTAINER(window), grid); logo_image = gtk_image_new_from_pixbuf(program_icon_pixbuf); gtk_grid_attach(GTK_GRID(grid), logo_image, 0, 0, 5, 1); sciteproj_label = gtk_label_new(NULL); gtk_label_set_selectable(GTK_LABEL(sciteproj_label), FALSE); gtk_label_set_markup(GTK_LABEL(sciteproj_label), "SciteProj"); gtk_grid_attach_next_to(GTK_GRID(grid), sciteproj_label, logo_image, GTK_POS_BOTTOM, 5, 1); // Show version of SciteProj gchar *about_dialog_version_string; #ifdef _DEBUG about_dialog_version_string = g_strdup_printf("%s DEBUG",version_string); #else about_dialog_version_string = g_strdup_printf("%s", version_string); #endif version_string_label = gtk_label_new(about_dialog_version_string); gtk_label_set_selectable(GTK_LABEL(version_string_label), FALSE); gtk_grid_attach_next_to(GTK_GRID(grid), version_string_label, sciteproj_label, GTK_POS_BOTTOM, 5, 1); // Show SciteProj copyrights copyrightstring = g_strdup_printf("Copyright (C) 2008-2017 Andreas Rönnquist "); copyright_label = gtk_label_new(copyrightstring); gtk_label_set_selectable(GTK_LABEL(copyright_label), FALSE); gtk_grid_attach_next_to(GTK_GRID(grid), copyright_label, version_string_label, GTK_POS_BOTTOM, 5, 1); // show GTK versions gchar *gtk_string = g_strdup_printf("GTK+ %d.%d.%d / GLib %d.%d.%d", //"Operating System: unknown", gtk_major_version, gtk_minor_version, gtk_micro_version, glib_major_version, glib_minor_version, glib_micro_version); gtk_version_label = gtk_label_new(gtk_string); gtk_label_set_selectable(GTK_LABEL(gtk_version_label), FALSE); gtk_grid_attach_next_to(GTK_GRID(grid), gtk_version_label, copyright_label, GTK_POS_BOTTOM, 5, 1); // Show a link to the SciteProj homepage linkbutton = gtk_link_button_new_with_label(homepage_string, homepage_string); gtk_grid_attach_next_to(GTK_GRID(grid), linkbutton, gtk_version_label, GTK_POS_BOTTOM, 5, 1); // New notebook - we want tabs for different sets of text notebook = gtk_notebook_new(); notebook_label1 = gtk_label_new(_("Information")); notebook_label2 = gtk_label_new(_("License")); // create a scrolled_window and a textview for the license textbuffer_license = gtk_text_buffer_new(NULL); gtk_text_buffer_get_start_iter(textbuffer_license, &iter); gchar *sLicense = _("SciteProj is free software: you can redistribute it and/or modify " "it under the terms of the GNU General Public License as published by " "the Free Software Foundation, either version 3 of the License, or " "(at your option) any later version.\n" "\n" "SciteProj 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.\n" "\n" "You should have received a copy of the GNU General Public License " "along with SciteProj. If not, see .\n"); gtk_text_buffer_insert(textbuffer_license, &iter, sLicense, -1); textview_license = gtk_text_view_new_with_buffer(textbuffer_license); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview_license), GTK_WRAP_WORD); gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(textview_license), TRUE); gtk_text_view_set_editable(GTK_TEXT_VIEW(textview_license), FALSE); GtkWidget *scrolled_window_license; scrolled_window_license = gtk_scrolled_window_new(NULL, NULL); // Never show horisontal scrollbar, always show vertical gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window_license), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); gtk_container_add(GTK_CONTAINER(scrolled_window_license), textview_license); // New textbuffer - and we get the beginning of the textbuffer textbuffer_info = gtk_text_buffer_new(NULL); gtk_text_buffer_get_start_iter(textbuffer_info, &iter); gchar *about_text2 = g_strdup_printf("" "%s\n" "Roy Wood and\n" "Martin Andrews \n\n" "%s\n" "Mattias Wecksten \n" "Frank Wunderlich\n\n" "%s", _("SciteProj is based on ScitePM by"), _("Many thanks to"), _("For more information about SciteProj, see the README file that\n" "is provided with this package.")); gchar *text_to_add; #ifdef _DEBUG gchar *prefs_dir_string = g_strdup_printf("Preferences loaded from %s",prefs_filename); text_to_add = g_strdup_printf("%s\n\n%s", about_text2, prefs_dir_string); #else text_to_add = about_text2; #endif gtk_text_buffer_insert(textbuffer_info, &iter, text_to_add, -1); gtk_text_buffer_get_end_iter(textbuffer_info, &iter); // Setup the textview and windows textview_info = gtk_text_view_new_with_buffer(textbuffer_info); gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(textview_info), TRUE); gtk_text_view_set_editable(GTK_TEXT_VIEW(textview_info), FALSE); GtkWidget *scrolled_window_info; scrolled_window_info = gtk_scrolled_window_new(NULL, NULL); // Never show horisontal scrollbar, always show vertical gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window_info), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); gtk_container_add(GTK_CONTAINER(scrolled_window_info), textview_info); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window_info, notebook_label1); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window_license, notebook_label2); gtk_widget_set_vexpand(notebook, TRUE); gtk_widget_set_hexpand(notebook, TRUE); gtk_grid_attach_next_to(GTK_GRID(grid), notebook, linkbutton/*gtk_version_label*/, GTK_POS_BOTTOM, 5, 1); gtk_text_buffer_place_cursor(textbuffer_info, &iter); gtk_text_buffer_select_range(textbuffer_info, &iter, &iter); // Create an ok button ok_button = gtk_button_new(); gtk_button_set_use_underline(GTK_BUTTON(ok_button), TRUE); gtk_button_set_label(GTK_BUTTON(ok_button), "_OK"); gtk_widget_set_halign(ok_button, GTK_ALIGN_END); gtk_widget_set_hexpand(ok_button, FALSE); gtk_grid_attach_next_to(GTK_GRID(grid), ok_button, notebook, GTK_POS_BOTTOM, 5, 1); gtk_widget_grab_focus(ok_button); gtk_text_buffer_get_start_iter(textbuffer_info, &iter); gtk_text_buffer_place_cursor(textbuffer_info, &iter); g_signal_connect_closure (G_OBJECT(ok_button), "clicked", g_cclosure_new_swap(G_CALLBACK(gtk_widget_hide_on_delete), window, NULL), FALSE); g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK(handle_about_close_event), window); g_signal_connect(G_OBJECT(linkbutton), "released", G_CALLBACK(link_button_cb), linkbutton); // Handle ESC in about window gtk_widget_add_events(window, GDK_KEY_PRESS_MASK); g_signal_connect(G_OBJECT(window), "key_press_event", G_CALLBACK(handle_keyboard_event_cb), NULL); gtk_widget_show_all(window); } /** * Show version */ void show_version() { g_print("SciteProj %s\n", version_string); } /** * */ gboolean handle_about_close_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) { gtk_widget_hide(window); return TRUE; } /** * Callback for the link button, Without this, it would color the text purple when the * link is followed, which I found really ugly. */ void link_button_cb(GtkButton *button, gpointer user_data) { GtkWidget *linkbutton = (GtkWidget*)(user_data); gtk_link_button_set_visited(GTK_LINK_BUTTON(linkbutton), FALSE); } /** * */ void init_version_string() { version_string = g_strdup_printf(_("version %s"), SCITEPROJ_VERSION); } /** * */ void done_version_string() { g_free(version_string); } sciteproj-1.14/src/folder_config.c0000644000175000017500000000150413542152470016547 0ustar gusnangusnan/** * folder_config.c - per folder configuration loaded from LUA * * Copyright 2012-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #include "folder_config.h" /** * */ sciteproj-1.14/src/about.h0000644000175000017500000000202513542152470015065 0ustar gusnangusnan/** * about.h - about dialog for SciteProj * * Copyright 2008-2019 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #ifndef __HEADER_ABOUT_ #define __HEADER_ABOUT_ /* extern gchar *sVersion;*/ void show_about_dialog(); void show_usage_dialog(); void show_version(); void init_version_string(); void done_version_string(); extern gchar *version_string; #endif /*__HEADER_ABOUT_*/ sciteproj-1.14/src/sort.h0000644000175000017500000000245513542152470014751 0ustar gusnangusnan/** * sort.h - Helpers for sorting * * Copyright 2012-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #ifndef __HEADER_SORT_ #define __HEADER_SORT_ /** * */ gint compare_strings_bigger(gconstpointer a, gconstpointer b); gint compare_strings_smaller(gconstpointer a, gconstpointer b); gint file_sort_by_extension_bigger_func(gconstpointer a, gconstpointer b); gint file_sort_by_extension_smaller_func(gconstpointer a, gconstpointer b); void sort_ascending_cb(); void sort_descending_cb(); void sort_ascending_by_extension_cb(); void sort_descending_by_extension_cb(); GCompareFunc get_sort_order_of_folder(gchar *folder_name); #endif /*__HEADER_SORT_*/ sciteproj-1.14/src/string_utils.h0000644000175000017500000000210413542152470016477 0ustar gusnangusnan/** * string_utils.h - misc string utils for SciteProj * * Copyright 2006 Roy Wood, 2009-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #ifndef __HEADER_STRING_UTILS_ #define __HEADER_STRING_UTILS_ // Append a string to a (possibly) existing string gboolean str_append(gchar **dst, const gchar *src, GError **err); void debug_printf(const char *st, ...); char *remove_newline(char *s); #endif /*__HEADER_STRING_UTILS_*/ sciteproj-1.14/src/graphics.h0000644000175000017500000000217613542152470015562 0ustar gusnangusnan/** * graphics.h - graphics code for SciteProj * * Copyright 2009-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #ifndef __HEADER_GRAPHICS_ #define __HEADER_GRAPHICS_ /** * */ extern GdkPixbuf *directory_closed_pixbuf; extern GdkPixbuf *directory_open_pixbuf; extern GdkPixbuf *program_icon_pixbuf; gboolean load_graphics(GtkWidget *widget, GError **err); void unload_graphics(); extern GdkCursor *standard_cursor; extern GdkCursor *busy_cursor; #endif /*__HEADER_GRAPHICS_*/ sciteproj-1.14/src/file_utils.c0000644000175000017500000002705313542152470016115 0ustar gusnangusnan/** * file_utils.c - file utilities for SciteProj * * Copyright 2009-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #include #include #include #include #include #include #include #include #include "string_utils.h" #include "file_utils.h" #include "load_folder.h" #include "sort.h" /** * */ #define APP_SCITEPROJ_ERROR g_quark_from_static_string("APP_STRINGUTILS_ERROR") /** * */ gchar *current_directory = 0; /** * */ gboolean is_separator(gchar ch) { gboolean result = FALSE; if ((ch == '/') || (ch == G_DIR_SEPARATOR) || (ch == '\\')) { result = TRUE; } return result; } /** * */ gchar *path_up_string(gchar *instring) { int len = (int)strlen(instring); int co; int start = len--; if (is_separator(instring[start])) { start--; } int res = -1; for (co = start; co > 0; co--) { if (is_separator(instring[co])) { if (res == -1) res = co; } } gchar *resstring = g_strdup_printf("%s", instring); if (res != -1) { resstring[res] = '\0'; } return resstring; } /** * fix_separators * * Replaces \\ and \ and // with /, and replaces stuff like /./ with just one separator */ gchar *fix_separators(gchar *source) { gchar *result = g_strdup(source); gchar *pointer = result; if (pointer) { int co = 0; for (co = 0; co < strlen(source); co++) { if (is_separator(source[co])) { // if ((*pointer == G_DIR_SEPARATOR) || (*pointer == '\\') || (*pointer == '/')) { *pointer = '/'; // skip /./ and similar if ((source[co+1] == '.') && (is_separator(source[co+2]))) { co+=2; } } else { *pointer = source[co]; } pointer++; } *pointer = '\0'; } return result; } /** * */ gchar *fix_path(char *base_dir,char *temp) { // first, make slashes real ones for the platform. gchar *curr = g_strdup(base_dir); gchar *infile = fix_separators(temp); //gchar *pointer = infile; gchar *out_path = g_strdup_printf("%s",curr); gchar *current_path = 0; if (!g_path_is_absolute(infile)) { int co; for (co = 0; co<(int)strlen(infile); co++) { char ch = infile[co]; if (!is_separator(ch)) { if (current_path != NULL) { gchar *buf = g_strdup_printf("%s%c",current_path,ch); g_free(current_path); current_path = buf; } else { current_path = g_strdup_printf("%c",ch); } } else { //g_print("%s\n",current_path); if (strcmp(current_path,"..") == 0) { //g_print("Up! curr:%s\n",out_path); //file_pointer = &infile[co]; gchar *buf = path_up_string(out_path); g_free(out_path); out_path = buf; g_free(current_path); current_path = 0; } } } } else { infile++; } gchar *tempfile = infile; do { if ((tempfile[0] == '.') && (tempfile[1] == G_DIR_SEPARATOR)) { tempfile+=2; } } while((tempfile[0] == '.') && (tempfile[0] == G_DIR_SEPARATOR)); if (current_path != 0) g_free(current_path); //gchar *new_res = g_strdup_printf("%s%c%s",out_path,G_DIR_SEPARATOR,get_filename_from_full_path(file_pointer)); gchar *new_res = g_strdup_printf("%s%c%s", out_path, G_DIR_SEPARATOR, tempfile); g_free(curr); //g_free(infile); return new_res; } /** * */ void init_file_utils() { gchar *temp = g_get_current_dir(); current_directory = fix_separators(temp); g_free(temp); if (current_directory[strlen(current_directory)-1] != G_DIR_SEPARATOR) { } } /** * get_filename_from_full_path */ gchar *get_filename_from_full_path(gchar *src) { gchar *pointer; gchar *result = NULL; gboolean slashFound = FALSE; g_assert(src != NULL); pointer = src; do { if ((*pointer == G_DIR_SEPARATOR) || (*pointer == '\\') || (*pointer == '/')) { // point to the character after the slash result = ++pointer; slashFound = TRUE; } pointer++; } while((*pointer) != '\0'); if (!slashFound) result = src; return result; } /** * Convert an absolute file path to a relative file path. * * @return TRUE on success, FALSE on failure (further details returned in err) * * @param absPath is the absolute file path * @param relativePath returns the relative file path (must be later freed with g_free() ) * @param basePath is the base file path against which the relative path is determined; pass NULL if the current working directory should be used as the base path * @param err returns any errors */ gboolean abs_path_to_relative_path(const gchar *absPath, gchar **relativePath, const gchar *basePath, GError **err) { g_assert(absPath != NULL); g_assert(relativePath != NULL); gboolean finalResult = FALSE; gchar *localBasePath = NULL; char *workingDir = NULL; int localBasePathLength = 0; int absPathLength = strlen(absPath); int i = 0; int dirSlashOffset = 0; if (!g_path_is_absolute(absPath)) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Specified path, '%s', is not absolute", __func__ , absPath); goto EXITPOINT; } // If no basepath specified, use current working dir if (!basePath) { workingDir = getcwd(NULL, 0); if (!workingDir) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not determine current working directory, getcwd() = NULL, errno = %d", __func__ , errno); goto EXITPOINT; } basePath = workingDir; } // Set up a local copy of the base path, and ensure it ends with a '/' if (!str_append(&localBasePath, basePath, err)) { goto EXITPOINT; } localBasePathLength = strlen(localBasePath); if (localBasePathLength <= 0 || localBasePath[localBasePathLength - 1] != G_DIR_SEPARATOR) { if (!str_append(&localBasePath, G_DIR_SEPARATOR_S, err)) { goto EXITPOINT; } ++localBasePathLength; } // Start relative path with local dir if (!str_append(relativePath, "./", err)) { goto EXITPOINT; } // Skip over matching parent dirs while (i < localBasePathLength && i < absPathLength && localBasePath[i] == absPath[i]) { if (absPath[i] == G_DIR_SEPARATOR) { dirSlashOffset = i + 1; } ++i; } // Step up one dir for every dir in the leftover part of the base path for (i = dirSlashOffset; i < localBasePathLength; ++i) { if (localBasePath[i] == G_DIR_SEPARATOR) { if (!str_append(relativePath, "../", err)) { goto EXITPOINT; } } } // Finally, add the leftover part of the absolute path if (!str_append(relativePath, absPath + dirSlashOffset, err)) { goto EXITPOINT; } finalResult = TRUE; EXITPOINT: free(workingDir); if (localBasePath) g_free(localBasePath); return finalResult; } /** * Convert a relative file path to an absolute file path. * * @return TRUE on success, FALSE on failure (further details returned in err) * * @param relativePath is the relative file path * @param absPath returns the absolute file path (must be later freed with g_free() ) * @param basePath is the base file path used to formulate the absolute path; pass NULL if the current working directory should be used as the base path * @param err returns any errors */ gboolean relative_path_to_abs_path(gchar *relativePath, gchar **absPath, const gchar *basePath, GError **err) { g_assert(absPath != NULL); g_assert(relativePath != NULL); int i=0; gboolean finalResult = FALSE; char *workingDir = NULL; gchar *localAbsPath = NULL; int absPathLength; int co; for (co=0; co 0) ? i - 1 : 0; } while (i > 0 && !is_separator(localAbsPath[i])/* != G_DIR_SEPARATOR*/); } if (tail != NULL) { g_memmove(localAbsPath + i, tail, tailLength); absPathLength -= (tail - localAbsPath - i); } else { ++i; } } *absPath = localAbsPath; localAbsPath = NULL; finalResult = TRUE; EXITPOINT: if (workingDir) free(workingDir); if (localAbsPath) g_free(localAbsPath); return finalResult; } /** * */ gchar *get_file_extension(gchar *filename) { gchar *result = g_strrstr(filename, "."); if (!result) result = ""; return result; } /** * */ int get_number_of_files_in_folder(gchar *folder_name) { int result = 0; GSList *file_list; GSList *folder_list; file_list = load_folder_to_list(folder_name, FALSE, file_sort_by_extension_bigger_func, NULL); folder_list = load_folder_to_list(folder_name, TRUE, compare_strings_bigger, NULL); if (file_list) { while (file_list) { result++; file_list = file_list->next; }; } if (folder_list) { while (folder_list) { result++; folder_list = folder_list->next; }; } return result; } /** * is_string_folder * @return gboolean TRUE if the entered string represent a folder in the * systems folder structure. */ gboolean is_string_folder(gchar *instring) { gboolean result = FALSE; GDir *dir = g_dir_open(instring, 0, NULL); if (dir) { result = TRUE; } if (dir) g_dir_close(dir); return result; } /** * */ gchar *clean_folder(gchar *infolder) { gchar *result = NULL; gchar *temp = infolder; int len = strlen(infolder); if (g_strcmp0(infolder, "./") == 0) { result = g_strdup_printf("."); return result; } if (temp) { if ((temp[0] == '.') && (temp[1] == G_DIR_SEPARATOR)) { temp += 2; len -= 2; } if (temp[len - 1] == G_DIR_SEPARATOR) { result = g_strndup(temp, len - 1); } else { result = g_strdup(temp); } } return result; } sciteproj-1.14/src/clipboard.h0000644000175000017500000000174313542152470015720 0ustar gusnangusnan/** * clipboard.h - clipboard support for SciteProj * * Copyright 2010-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #ifndef __HEADER_CLIPBOARD_ #define __HEADER_CLIPBOARD_ /** * */ void copy_filename_to_clipboard(GtkTreeModel *model, GtkTreeIter *iter); void copy_filename_to_clipboard_cb(); #endif /*__HEADER_CLIPBOARD_*/ sciteproj-1.14/src/statusbar.h0000644000175000017500000000176213542152470015772 0ustar gusnangusnan/** * statusbar.h - statusbar for SciteProj * * Copyright 2009-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #ifndef __HEADER_STATUSBAR_ #define __HEADER_STATUSBAR_ gboolean init_statusbar(GtkWidget *grid, GtkWidget *next_to, GError **err); void set_statusbar_text(const gchar *text); void done_statusbar(); #endif /*__HEADER_STATUSBAR_*/ sciteproj-1.14/src/icon.h0000644000175000017500000000217013542152470014704 0ustar gusnangusnan/** * icon.h - Icon helper functions * * Copyright (C) 2006 - Jesse van den Kieboom * (C) 2012-2017 - Andreas Rönnquist * * 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 3 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, see . */ /* This is a modified and stripped version of gedit-file-bookmarks-utils.h of the gedit project */ #ifndef __HEADER_ICON_ #define __HEADER_ICON_ /** * */ GdkPixbuf *get_pixbuf_from_file(GFile *file, GtkIconSize size); GdkPixbuf *get_pixbuf_from_filename(gchar *filename, GtkIconSize size); #endif /*__HEADER_ICON_*/ sciteproj-1.14/src/folder_config.h0000644000175000017500000000160413542152470016555 0ustar gusnangusnan/** * folder_config.h - per folder configuration loaded from LUA * * Copyright 2012-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #ifndef __HEADER_FOLDER_CONFIG_ #define __HEADER_FOLDER_CONFIG_ #endif /*__HEADER_FOLDER_CONFIG_*/ sciteproj-1.14/src/clipboard.c0000644000175000017500000000435013542152470015710 0ustar gusnangusnan/** * clipboard.c - clipboard code for SciteProj * * Copyright 2010-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #include #include #include "clicked_node.h" #include "gui.h" #include "tree_manipulation.h" #include "file_utils.h" #include "string_utils.h" #include "clipboard.h" /** * Copies the filename including full folder to the clipboard */ void copy_filename_to_clipboard(GtkTreeModel *model, GtkTreeIter *iter) { GError *err = NULL; gchar *nodename = NULL; gchar *filePath = NULL; int nodeType = -1; GdkDisplay *display = NULL; GtkClipboard *clipboard = NULL; gtk_tree_model_get(model, iter, COLUMN_FILENAME, &nodename, COLUMN_ITEMTYPE, &nodeType, COLUMN_FILEPATH, &filePath, -1); gchar *absFilePath = NULL; //g_strdup_printf("%s",filePath); // filePath is NULL? //if (!relative_path_to_abs_path(sClickedNodeName, &absFilePath, get_project_directory(), &err)) { if (!relative_path_to_abs_path(filePath, &absFilePath, get_project_directory(), &err)) { goto EXITPOINT; } display = gdk_display_get_default(); clipboard = gtk_clipboard_get_for_display(display, GDK_SELECTION_CLIPBOARD); gtk_clipboard_set_text(clipboard, absFilePath, -1); EXITPOINT: if (err) g_error_free(err); } /** * Callback for the menu item */ void copy_filename_to_clipboard_cb() { if (!clicked_node.valid || clicked_node.type != ITEMTYPE_FILE) { //goto EXITPOINT; } else { copy_filename_to_clipboard(gtk_tree_view_get_model(GTK_TREE_VIEW(projectTreeView)), &(clicked_node.iter)); } } sciteproj-1.14/src/properties_dialog.h0000644000175000017500000000211513542152470017466 0ustar gusnangusnan/** * properties_dialog.h - Properties Dialogs code for SciteProj * * Copyright 2009-2018 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #ifndef __HEADER_PROPERTIES_DIALOG_ #define __HEADER_PROPERTIES_DIALOG_ void group_properties_gui(GtkTreeModel *model, GtkTreeIter *iter); void file_properties_gui(GtkTreeModel *model, GtkTreeIter *iter); void group_properties_cb(); void file_properties_cb(); #endif /*__HEADER_PROPERTIES_DIALOG_*/ sciteproj-1.14/src/load_folder.c0000644000175000017500000001110113542152470016213 0ustar gusnangusnan/** * load_folder.c - folder loading support for sciteproj * * Copyright 2012-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #include #include #include #include "tree_manipulation.h" #include "load_folder.h" #include "clicked_node.h" #include "gui.h" #include "file_utils.h" #include "sort.h" #include "expand.h" struct ParseFileStruct { GtkTreeIter current_iter; int depth; }; typedef struct ParseFileStruct ParseFileStruct; GtkTreeIter prevFileIterArray[100]; int currentFilePrevFileIter = 0; gboolean prevFileIterValid[100]; int number_of_files=0; /** * */ gboolean ignore_pattern_matches(gchar *folder_name, const gchar *filename, GSList *filter_list) { gboolean result = FALSE; gchar *full_filename = g_build_filename(folder_name, filename, NULL); int len = strlen(full_filename); if (filter_list) { while (filter_list && !result) { gchar *filter = (gchar *)filter_list->data; gchar *temp_filter_string = g_build_filename(get_project_directory(), filter, NULL); GPatternSpec *pattern_spec = g_pattern_spec_new(temp_filter_string); if (g_pattern_match(pattern_spec, len, full_filename, NULL)) { result = TRUE; } g_pattern_spec_free(pattern_spec); g_free(temp_filter_string); filter_list = filter_list->next; }; } g_free(full_filename); return result; } /** * */ GSList *load_folder_to_list(gchar *folder_path, gboolean read_directories, GCompareFunc compare_func, GSList *filter_list) { GSList *result_list = NULL; GDir *dir=g_dir_open(folder_path, 0, NULL); const gchar *short_filename; while((short_filename = g_dir_read_name(dir))) { gchar *temp_file = g_build_filename(folder_path, short_filename, NULL); if (read_directories) { if (g_file_test(temp_file, G_FILE_TEST_IS_DIR)) { if (filter_list != NULL) { if (!ignore_pattern_matches(folder_path, short_filename, filter_list)) { result_list = g_slist_prepend(result_list, (gpointer)short_filename); } } else { result_list = g_slist_prepend(result_list, (gpointer)short_filename); } } } else { if (!g_file_test(temp_file, G_FILE_TEST_IS_DIR)) { if (filter_list != NULL) { if (!ignore_pattern_matches(folder_path, short_filename, filter_list)) { result_list = g_slist_prepend(result_list, (gpointer)temp_file); } } else { result_list = g_slist_prepend(result_list, (gpointer)temp_file); } } } } result_list = g_slist_sort(result_list, compare_func); return result_list; } /** * @param project_path - the folder to read the contents from * @param err - errors are returned here * */ gboolean load_folder(gchar *path, GError **err) { GtkTreeModel *model; model = gtk_tree_view_get_model(GTK_TREE_VIEW(projectTreeView)); ParseFileStruct parse_struct; parse_struct.depth = 0; number_of_files = 0; GtkTreeIter dot_folder_iterator; add_tree_group(NULL, ADD_CHILD, ".", path/*get_filename_from_full_path(project_path)*/ , TRUE, &(parse_struct.current_iter), NULL); //add_tree_file(NULL, ADD_CHILD, project_path , &(parse_struct.current_iter), TRUE, NULL); dot_folder_iterator = parse_struct.current_iter; prevFileIterValid[currentFilePrevFileIter] = FALSE; prevFileIterArray[currentFilePrevFileIter] = parse_struct.current_iter; currentFilePrevFileIter++; prevFileIterArray[currentFilePrevFileIter] = parse_struct.current_iter; parse_struct.depth++; add_tree_file(&parse_struct.current_iter, ADD_CHILD, "", &parse_struct.current_iter, FALSE, NULL); //current_max_depth=0; //read_folder(GTK_TREE_STORE(model), path, &parse_struct, NULL); // Expand the dot-folder // void expand_tree_row(GtkTreePath *path, gboolean expandChildren); GtkTreePath *iter_path = gtk_tree_model_get_path(GTK_TREE_MODEL(model), &dot_folder_iterator); if (iter_path) expand_tree_row(iter_path, FALSE); gtk_tree_path_free(iter_path); start_expand_tree(GTK_TREE_MODEL(model), &dot_folder_iterator); return TRUE; } sciteproj-1.14/src/sort.c0000644000175000017500000001375013542152470014744 0ustar gusnangusnan/** * sort.c - Helpers for sorting * * Copyright 2012-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #include #include #include #include #include #include "file_utils.h" #include "sort.h" #include "clicked_node.h" #include "gui.h" #include "tree_manipulation.h" #include "script.h" /** * */ gint compare_strings_bigger(gconstpointer a, gconstpointer b) { const gchar *test1 = get_filename_from_full_path((gchar*)a); const gchar *test2 = get_filename_from_full_path((gchar*)b); return g_ascii_strcasecmp(test1, test2); } /** * */ gint compare_strings_smaller(gconstpointer a, gconstpointer b) { const gchar *test1 = get_filename_from_full_path((gchar*)a); const gchar *test2 = get_filename_from_full_path((gchar*)b); return g_ascii_strcasecmp(test2, test1); } /** * */ gint file_sort_by_extension_bigger_func(gconstpointer a, gconstpointer b) { gint result=0; gchar *filename1 = (gchar*)a; gchar *filename2 = (gchar*)b; gchar *ext1 = get_file_extension(filename1); gchar *ext2 = get_file_extension(filename2); result = g_ascii_strcasecmp(ext1, ext2); if (result == 0) { result = g_ascii_strcasecmp(filename1, filename2); } return result; } /** * */ gint file_sort_by_extension_smaller_func(gconstpointer a, gconstpointer b) { gint result=0; gchar *filename1 = (gchar*)a; gchar *filename2 = (gchar*)b; gchar *ext1 = get_file_extension(filename1); gchar *ext2 = get_file_extension(filename2); result = g_ascii_strcasecmp(ext2, ext1); if (result == 0) { result = g_ascii_strcasecmp(filename2, filename1); } return result; } /** * */ void sort_ascending_cb() { GError *err = NULL; if (clicked_node.valid && clicked_node.type == ITEMTYPE_FILE) { goto EXITPOINT; } sort_children(&(clicked_node.iter), &err, compare_strings_smaller); EXITPOINT: // if (err) g_error_free(err); } /** * */ void sort_descending_cb() { GError *err = NULL; if (clicked_node.valid && clicked_node.type == ITEMTYPE_FILE) { goto EXITPOINT; } sort_children(&clicked_node.iter, &err, compare_strings_bigger); EXITPOINT: // if (err) g_error_free(err); } /** * */ void sort_ascending_by_extension_cb() { GError *err = NULL; if (clicked_node.valid && clicked_node.type == ITEMTYPE_FILE) { goto EXITPOINT; } sort_children(&clicked_node.iter, &err, file_sort_by_extension_smaller_func); EXITPOINT: if (err) g_error_free(err); } /** * */ void sort_descending_by_extension_cb() { GError *err = NULL; if (clicked_node.valid && clicked_node.type == ITEMTYPE_FILE) { goto EXITPOINT; } sort_children(&clicked_node.iter, &err, file_sort_by_extension_bigger_func); EXITPOINT: if (err) g_error_free(err); } /** * */ GCompareFunc get_sort_order_of_folder(gchar *folder_name) { // We default to compare_strings_smaller GCompareFunc result = compare_strings_smaller; gchar *script_filename = g_build_filename(get_project_directory(), "sciteprojrc.lua", NULL); lua_State *lua = NULL; if (g_file_test(script_filename, G_FILE_TEST_EXISTS)) { int num = -1; lua = init_script(); if (load_script(lua, script_filename) != 0) { printf("error loading script: %s\n", script_filename); goto EXITPOINT; } run_script(lua); lua_getglobal(lua, "sort_order"); // Make sure that we have a value at all if (lua_isnil(lua, -1)) { goto EXITPOINT; } // and make sure it really is a table if (!lua_istable(lua, -1)) { printf("sort_order is expected to be a table!\n"); goto EXITPOINT; } lua_pushnil(lua); while(lua_next(lua, -2)) { gchar *key = NULL; if (lua_type(lua, -2) == LUA_TSTRING) { // key type is string key = g_strdup(lua_tostring(lua, -2)); gchar *temp = clean_folder(key); g_free(key); key = temp; //printf(" key: %s\n", key); } if (lua_type(lua, -1) == LUA_TNUMBER) { // value is number num = lua_tonumber(lua, -1); //printf(" value: %d\n", num); } /* gboolean abs_path_to_relative_path(const gchar *absPath, gchar **relativePath, const gchar *basePath, GError **err); // convert the absolute path to a relative path */ gchar *relative_path = NULL; if (g_strcmp0(folder_name, get_project_directory()) == 0) { relative_path = g_strdup("."); //get_project_directory(); } if (!relative_path) { if (abs_path_to_relative_path(folder_name, &relative_path, get_project_directory(), NULL)) { //printf("relative_path: %s\n", relative_path); } } //printf("Relative path: %s\n", relative_path); gchar *folder_cleaned = clean_folder(relative_path); //printf("folder_cleaned: %s\n", folder_cleaned); if (g_strcmp0(key, folder_cleaned) == 0) { switch (num) { case 0: result = compare_strings_smaller; break; case 1: result = compare_strings_bigger; break; case 2: result = file_sort_by_extension_smaller_func; break; case 3: result = file_sort_by_extension_bigger_func; break; }; } if (key) g_free(key); if (relative_path) g_free(relative_path); if (folder_cleaned) g_free(folder_cleaned); lua_pop(lua, 1); } lua_pop(lua,1); } EXITPOINT: g_free(script_filename); if (lua) done_script(lua); return result; }sciteproj-1.14/src/icon.c0000644000175000017500000000430713542152470014703 0ustar gusnangusnan/* * icon.c - Icon helper functions * * Copyright (C) 2006 - Jesse van den Kieboom * (C) 2012-2017 - Andreas Rönnquist * * 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 3 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, see . */ /* This is a modified and stripped version of gedit-file-bookmarks-utils.c of the gedit project */ #include /** * */ /** * */ GdkPixbuf * get_pixbuf_from_icon(GIcon *icon, GtkIconSize size) { GdkPixbuf *result = NULL; GtkIconTheme *theme; GtkIconInfo *info; gint width; if (!icon) return NULL; theme = gtk_icon_theme_get_default(); gtk_icon_size_lookup(size, &width, NULL); info = gtk_icon_theme_lookup_by_gicon(theme, icon, width, GTK_ICON_LOOKUP_USE_BUILTIN); if (!info) return NULL; result=gtk_icon_info_load_icon(info, NULL); return result; } /** * */ GdkPixbuf * get_pixbuf_from_file(GFile *file, GtkIconSize size) { GIcon *icon; GFileInfo *info; GdkPixbuf *result = NULL; info = g_file_query_info(file, G_FILE_ATTRIBUTE_STANDARD_ICON, G_FILE_QUERY_INFO_NONE, NULL, NULL); if (!info) return NULL; icon = g_file_info_get_icon(info); if (icon != NULL) { result=get_pixbuf_from_icon(icon, size); } g_object_unref(info); return result; } /** * */ GdkPixbuf * get_pixbuf_from_filename(gchar *filename, GtkIconSize size) { GFile *tempfile = g_file_new_for_path(filename); GdkPixbuf *result=get_pixbuf_from_file(tempfile, size); return result; } sciteproj-1.14/src/scite_utils.h0000644000175000017500000000312213542152470016301 0ustar gusnangusnan/** * scite_utils_linux.h - Code for working with Scite (GNU/Linux version) * * Copyright 2006 Roy Wood, 2009-2018 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #ifndef __HEADER_SCITE_UTILS_ #define __HEADER_SCITE_UTILS_ //your declarations extern gboolean scite_exists; // Fork a child process and launch Scite from it //gboolean launch_scite(gchar *sciteExecutableName, GError **err); gboolean launch_scite(gchar *instring, GError **err); // Send a command to Scite, launching Scite if necessary gboolean send_scite_command(gchar *command, GError **err); // Determine whether Scite is currently launched and the communication pipes are open gboolean scite_ready(); // Activate the SciTE window (i.e. bring it the front) gboolean activate_scite(GError **err); gboolean check_if_scite_exists(); void init_scite_connection(); gboolean open_filename(gchar *filename, gchar *project_directory, GError **err); #endif /*__HEADER_SCITE_UTILS_*/ sciteproj-1.14/src/script.h0000644000175000017500000000246113542152470015263 0ustar gusnangusnan/** * script.h - Script code for sciteproj * * Copyright 2012-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #ifndef __HEADER_SCRIPT_ #define __HEADER_SCRIPT_ /** * */ lua_State *init_script(); void register_cfunctions(lua_State *lua); int load_script(lua_State *lua, char *filename); void run_script(lua_State *lua); void done_script(lua_State *lua); int load_script_buffer(lua_State *lua, const char *buffer); int lua_get_boolean(lua_State *lua, char *variable_name); double lua_get_number(lua_State *lua, char *variable_name); gboolean lua_global_exists(lua_State *lua, char *variable_name); GSList *load_filter_from_lua(); #endif /*__HEADER_SCRIPT_*/ sciteproj-1.14/src/properties_dialog.c0000644000175000017500000001421513542152470017465 0ustar gusnangusnan/** * properties_dialog.c - Properties Dialogs code for SciteProj * * Copyright 2009-2018 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #include #include #include #include #include #include #include "properties_dialog.h" #include "tree_manipulation.h" #include "clicked_node.h" #include "gui.h" #include "string_utils.h" #include "file_utils.h" /** * My set align */ void my_set_align(GtkWidget *widget) { gtk_widget_set_halign(widget, GTK_ALIGN_START); gtk_widget_set_valign(widget, GTK_ALIGN_START); } /** * Group properties callback */ void group_properties_gui(GtkTreeModel *tree_model, GtkTreeIter *iter) { GtkWidget *dialog; gchar *nodename = NULL; GtkWidget *table; GtkWidget *label1, *label2; GtkWidget *filename, *filepath_label; GtkWidget *container_box; gchar *filePath = NULL; int nodeType = -1; gtk_tree_model_get(tree_model, iter, COLUMN_FILENAME, &nodename, COLUMN_ITEMTYPE, &nodeType, COLUMN_FILEPATH, &filePath, -1); dialog = gtk_dialog_new_with_buttons(_("Group Properties"), NULL, GTK_DIALOG_MODAL, _("OK"), GTK_RESPONSE_ACCEPT, NULL); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); label1 = gtk_label_new(_("Group name:")); label2 = gtk_label_new(_("Full folder:")); filename = gtk_label_new(nodename); filepath_label = gtk_label_new(filePath); my_set_align(filename); my_set_align(filepath_label); my_set_align(label1); my_set_align(label2); table = gtk_grid_new(); gtk_grid_attach(GTK_GRID(table), label1, 0, 0, 1, 1); gtk_grid_attach(GTK_GRID(table), label2, 0, 1, 1, 1); gtk_grid_attach(GTK_GRID(table), filename, 1, 0, 4, 1); gtk_grid_attach(GTK_GRID(table), filepath_label, 1, 1, 4, 1); gtk_grid_set_row_spacing(GTK_GRID (table), 6); gtk_grid_set_column_spacing(GTK_GRID (table), 6); container_box = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); gtk_box_pack_start(GTK_BOX(container_box), table, TRUE, TRUE, 0); set_dialog_transient(dialog); gtk_window_set_default_size(GTK_WINDOW(dialog), 500, 100); gtk_window_set_resizable (GTK_WINDOW(dialog), FALSE); gtk_widget_show_all(dialog); gtk_dialog_run(GTK_DIALOG(dialog)); if (dialog) gtk_widget_destroy(dialog); } /** * File properties callback */ void file_properties_gui(GtkTreeModel *model, GtkTreeIter *iter) { GError *err = NULL; gchar *nodename = NULL; GtkWidget *table; GtkWidget *label1, *label2, *label3; GtkWidget *path, *filename, *filesize_label; GtkWidget *container_box = NULL; GtkWidget *dialog; gchar *filePath = NULL; int nodeType = -1; gtk_tree_model_get(model, iter, COLUMN_FILENAME, &nodename, COLUMN_ITEMTYPE, &nodeType, COLUMN_FILEPATH, &filePath, -1); debug_printf((gchar*)"Node name: %s\n", nodename); debug_printf((gchar*)"File name: %s\n", filePath); dialog = gtk_dialog_new_with_buttons(_("File Properties"), NULL, GTK_DIALOG_MODAL, _("OK"), GTK_RESPONSE_ACCEPT,NULL); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); gchar *absFilePath = NULL; //g_strdup_printf("%s",filePath); // filePath is NULL? //if (!relative_path_to_abs_path(sClickedNodeName, &absFilePath, get_project_directory(), &err)) { if (!relative_path_to_abs_path(filePath, &absFilePath, get_project_directory(), &err)) { goto EXITPOINT; } gchar *size_string; // get the size of the file struct stat file_status; if(stat(absFilePath, &file_status) != 0) { perror("could not stat"); //goto EXITPOINT; } size_string = g_strdup_printf("%d bytes", (int)(file_status.st_size)); label1 = gtk_label_new(_("Filename:")); label2 = gtk_label_new(_("Path:")); label3 = gtk_label_new(_("File size:")); filename = gtk_label_new(nodename); path = gtk_label_new(absFilePath/*sClickedNodeName*/); filesize_label = gtk_label_new(size_string); my_set_align(filename); my_set_align(path); my_set_align(filesize_label); my_set_align(label1); my_set_align(label2); my_set_align(label3); table = gtk_grid_new(); gtk_grid_attach(GTK_GRID(table), label1, 0, 0, 1, 1); gtk_grid_attach(GTK_GRID(table), label2, 0, 1, 1, 1); gtk_grid_attach(GTK_GRID(table), label3, 0, 2, 1, 1); gtk_grid_attach(GTK_GRID(table), filename, 1, 0, 4, 1); gtk_grid_attach(GTK_GRID(table), path, 1, 1, 4, 1); gtk_grid_attach(GTK_GRID(table), filesize_label, 1, 2, 4, 1); gtk_grid_set_row_spacing (GTK_GRID (table), 6); gtk_grid_set_column_spacing (GTK_GRID (table), 6); container_box = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); gtk_box_pack_start(GTK_BOX(container_box), table, TRUE, TRUE, 0); set_dialog_transient(dialog); gtk_window_set_default_size(GTK_WINDOW(dialog), 500, 100); gtk_window_set_resizable (GTK_WINDOW(dialog), FALSE); gtk_widget_show_all(dialog); gtk_dialog_run(GTK_DIALOG(dialog)); EXITPOINT: if (err) g_error_free(err); if (dialog) gtk_widget_destroy(dialog); } /** * */ void group_properties_cb() { if (!clicked_node.valid || clicked_node.type != ITEMTYPE_GROUP) { //goto EXITPOINT; } else { group_properties_gui(gtk_tree_view_get_model(GTK_TREE_VIEW(projectTreeView)), &(clicked_node.iter)); } } /** * */ void file_properties_cb() { if (!clicked_node.valid || clicked_node.type != ITEMTYPE_FILE) { //goto EXITPOINT; } else { file_properties_gui(gtk_tree_view_get_model(GTK_TREE_VIEW(projectTreeView)), &(clicked_node.iter)); } } sciteproj-1.14/src/gui.c0000644000175000017500000004520313542152470014537 0ustar gusnangusnan/** * gui.c - GUI code for SciteProj * * Copyright 2006 Roy Wood, 2009-2019 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #include #include #include #include #include #include #include #include #include "clicked_node.h" #include "gui.h" #include "tree_manipulation.h" #include "scite_utils.h" #include "string_utils.h" #include "prefs.h" #include "statusbar.h" #include "graphics.h" #include "about.h" #include "properties_dialog.h" #include "file_utils.h" #include "clipboard.h" #include "remove.h" #include "recent_files.h" #include "gui_callbacks.h" #include "sort.h" #include "menus.h" // Forward-declare static functions static gint window_delete_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data); static void tree_row_activated_cb(GtkTreeView *treeView, GtkTreePath *path, GtkTreeViewColumn *column, gpointer userData); static gboolean mouse_button_pressed_cb(GtkWidget *treeView, GdkEventButton *event, gpointer userData); //gboolean dialog_response_is_exit(gint test); void recent_files_switch_visible(); gboolean tree_view_search_equal_func(GtkTreeModel *model, gint column, const gchar *key, GtkTreeIter *iter, gpointer search_data); gboolean is_name_valid(gchar *instring); gboolean key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer userData); gchar *window_saved_title = NULL; static GtkWidget *sMainWindow = NULL; GtkWidget *projectTreeView = NULL; ClickedNode clicked_node; GtkCellRenderer *textCellRenderer = NULL; GtkCellRenderer *pixbuffCellRenderer = NULL; GtkWidget *scrolledWindow = NULL; GtkTreeViewColumn *column1 = NULL; GtkWidget *recentGrid = NULL; GtkWidget *recentHbox = NULL; /** * Initialize globals (i.e. create the main window and populate it). This is a long chunk of code. * * @return TRUE on success, FALSE on failure (further details returned in err) * * @param err returns any errors */ gboolean setup_gui(GError **err) { gboolean resultCode = FALSE; GtkTreeSelection *selection = NULL; GtkWidget *vpaned = NULL; GtkTreeStore *projectTreeStore = NULL; //GtkAccelGroup* accelgroup = NULL; GError *tempErr = NULL; GtkWidget *grid; GtkWidget *fullGrid = NULL; GtkWidget *recentScrolledWindow = NULL; clicked_node.valid = FALSE; clicked_node.name = NULL; clicked_node.type = -1; window_saved_title=g_strdup_printf(_("[UNTITLED]")); // Create top-level window, configure it if (!(sMainWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL))) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: %s, gtk_window_new() = NULL", __func__, "Couldn't init main window" ); goto EXITPOINT; } // TODO: call these in load_graphics instead if (!(load_graphics(sMainWindow, err))) { goto EXITPOINT; } gtk_window_set_icon(GTK_WINDOW(sMainWindow), program_icon_pixbuf); gtk_window_set_default_icon(program_icon_pixbuf); gtk_window_set_title(GTK_WINDOW(sMainWindow), window_saved_title); gtk_container_set_border_width(GTK_CONTAINER(sMainWindow), 0); //3 g_signal_connect(G_OBJECT(sMainWindow), "delete_event", G_CALLBACK(window_delete_event_cb), NULL); // Main content of the window is a vpaned vpaned = gtk_paned_new(GTK_ORIENTATION_VERTICAL); // Then we need a grid grid = gtk_grid_new(); // Activate the keyboard accelerators accelerator_group = gtk_accel_group_new(); gtk_window_add_accel_group(GTK_WINDOW(sMainWindow), accelerator_group); if (init_menus(sMainWindow) != 0) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: %s, gtk_scrolled_window_new() = NULL", __func__, "Couldn't init menus" ); goto EXITPOINT; } // Add a scrolled window to the main window if (!(scrolledWindow = gtk_scrolled_window_new(NULL, NULL))) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: %s, gtk_scrolled_window_new() = NULL", __func__, "Couldn't init main scrolled window" ); goto EXITPOINT; } gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledWindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); gtk_grid_attach(GTK_GRID(grid), scrolledWindow, 0, 1, 1, 1); gtk_widget_set_vexpand(scrolledWindow, TRUE); gtk_widget_set_hexpand(scrolledWindow, TRUE); // Create the tree datastore if ((projectTreeStore = create_treestore(&tempErr)) == NULL) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: %s", tempErr->message, "Couldn't init treestore" ); goto EXITPOINT; } // Create the treeview, set it up to render the tree datastore, and add it to the hbox if (!(projectTreeView = gtk_tree_view_new_with_model(GTK_TREE_MODEL(projectTreeStore)))) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: %s, gtk_tree_view_new_with_model() = NULL", __func__, "Couldn't init gtk_tree_view" ); goto EXITPOINT; } gtk_tree_view_set_enable_search(GTK_TREE_VIEW(projectTreeView), TRUE); if (!(textCellRenderer = gtk_cell_renderer_text_new())) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: %s, gtk_cell_renderer_text_new() = NULL", __func__, "Couldn't init cell renderer" ); goto EXITPOINT; } g_object_set(G_OBJECT(textCellRenderer), "editable", FALSE, "mode", GTK_CELL_RENDERER_MODE_EDITABLE, NULL); if (!(pixbuffCellRenderer = gtk_cell_renderer_pixbuf_new())) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: %s, gtk_cell_renderer_pixbuf_new() = NULL", __func__, "Couldn't init gtk_cell_renderer_pixbuf" ); goto EXITPOINT; } if (!(column1 = gtk_tree_view_column_new())) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: %s, gtk_tree_view_column_new() = NULL", __func__, "Couldn't init gtk_tree_view_column" ); goto EXITPOINT; } gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(projectTreeView), FALSE); gtk_tree_view_column_set_resizable(column1, TRUE); gtk_tree_view_column_set_min_width(column1, (int)(prefs.width * .75)); gtk_tree_view_column_pack_start(column1, pixbuffCellRenderer, FALSE); gtk_tree_view_column_add_attribute(column1, pixbuffCellRenderer, "pixbuf", COLUMN_ICON); gtk_tree_view_column_pack_start(column1, textCellRenderer, TRUE); gtk_tree_view_column_add_attribute(column1, textCellRenderer, "text", COLUMN_FILENAME); gtk_tree_view_column_add_attribute(column1, textCellRenderer, "weight", COLUMN_FONTWEIGHT); gtk_tree_view_column_add_attribute(column1, textCellRenderer, "weight-set", COLUMN_FONTWEIGHTSET); gtk_tree_view_append_column(GTK_TREE_VIEW(projectTreeView), column1); // Stoopid gtk always expands the last column gtk_container_add(GTK_CONTAINER(scrolledWindow), projectTreeView); // Get tree events selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(projectTreeView)); gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE); g_signal_connect(G_OBJECT(projectTreeView), "row-activated", G_CALLBACK(tree_row_activated_cb), NULL); gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(projectTreeView), tree_view_search_equal_func, NULL, NULL); g_signal_connect(G_OBJECT(projectTreeView), "row-expanded", G_CALLBACK(row_expand_or_collapse_cb), NULL); g_signal_connect(G_OBJECT(projectTreeView), "row-collapsed", G_CALLBACK(row_expand_or_collapse_cb), NULL); g_signal_connect(G_OBJECT(projectTreeView), "button-press-event", G_CALLBACK(mouse_button_pressed_cb), projectTreeView); g_signal_connect(G_OBJECT(projectTreeView), "key-press-event", G_CALLBACK(key_press_cb), projectTreeView); // -------------------------------- // Recent file stuff: if (!(recentGrid = gtk_grid_new())) { g_set_error(err, APP_SCITEPROJ_ERROR,-1, "%s: %s, gtk_grid_new() = NULL", "Couldn't init recent grid", __func__); goto EXITPOINT; } if ((recentScrolledWindow = init_recent_files(&tempErr)) == NULL) { goto EXITPOINT; } gtk_widget_set_vexpand(recentScrolledWindow, TRUE); gtk_widget_set_hexpand(recentScrolledWindow, TRUE); gtk_grid_attach(GTK_GRID(recentGrid), recentScrolledWindow, 0, 0, 1, 1); fullGrid = gtk_grid_new(); gtk_paned_pack1(GTK_PANED(vpaned), grid, TRUE, FALSE); gtk_paned_pack2(GTK_PANED(vpaned), recentGrid, TRUE, TRUE); gtk_widget_show(vpaned); gtk_grid_insert_row(GTK_GRID(fullGrid), 0); gtk_grid_attach(GTK_GRID(fullGrid), vpaned, 0, 0, 1, 1); gtk_grid_insert_row(GTK_GRID(fullGrid), 0); gtk_grid_attach(GTK_GRID(fullGrid), menuBar, 0, 0, 1, 1); gtk_widget_show(menuBar); gtk_widget_show(GTK_WIDGET(fullGrid)); if (!prefs.hide_statusbar) { if (!init_statusbar(fullGrid, vpaned, &tempErr)) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: %s", tempErr->message, "Error initing statusbar"); goto EXITPOINT; } } gtk_container_add(GTK_CONTAINER(sMainWindow), fullGrid); g_signal_connect(G_OBJECT(recentTreeView), "key-press-event", G_CALLBACK(key_press_cb), recentTreeView); gtk_window_resize(GTK_WINDOW(sMainWindow), prefs.width, prefs.height); gtk_window_move(GTK_WINDOW(sMainWindow), prefs.xpos, prefs.ypos); int window_xsize, window_ysize; gtk_window_get_size(GTK_WINDOW(sMainWindow), &window_xsize, &window_ysize); gtk_paned_set_position(GTK_PANED(vpaned), (int)(window_ysize*0.75)); // Show it all.... gtk_widget_show(recentGrid); if (!prefs.show_recent) { gtk_widget_hide(recentGrid); } else { gtk_widget_show(recentGrid); } gtk_widget_show(projectTreeView); gtk_widget_show(scrolledWindow); gtk_widget_show(grid); gtk_widget_show(sMainWindow); resultCode = TRUE; EXITPOINT: if (tempErr) g_error_free(tempErr); return resultCode; } /** * */ void gui_close() { if (window_saved_title) g_free(window_saved_title); if (scrolledWindow) gtk_widget_destroy(scrolledWindow); unload_graphics(); done_statusbar(); if (sMainWindow) gtk_widget_destroy(sMainWindow); } /** * Determine whether a specified row in the tree is expanded. * * @return TRUE if the row is expanded; FALSE otherwise * * @param path is the GtkTreePath referencing the row */ gboolean tree_row_is_expanded(GtkTreePath *path) { g_assert(path != NULL); return gtk_tree_view_row_expanded(GTK_TREE_VIEW(projectTreeView), path); } /** * Expand a row in the tree. * * @param path is the GtkTreePath referencing the row * @param expandChildren indicates whether all children should be expanded */ void expand_tree_row(GtkTreePath *path, gboolean expandChildren) { if (path != NULL) { gtk_tree_view_expand_row(GTK_TREE_VIEW(projectTreeView), path, FALSE); } } /** * Callback for Gtk "delete_event" message for the top-level application window. * * @param widget is not used * @param event is not used * @param data is not used */ static gint window_delete_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data) { gboolean eventHandled = TRUE; gtk_main_quit(); return eventHandled; } /** * */ static void switch_folder_icon(GtkTreeView *treeView, GtkTreePath *path) { GtkTreeIter iter; gint nodeItemType; gchar *relFilePath = NULL; GtkTreeModel *treeModel = gtk_tree_view_get_model(treeView); GdkPixbuf *pixbuf; gtk_tree_model_get_iter(treeModel, &iter, path); gtk_tree_model_get(treeModel, &iter, COLUMN_ITEMTYPE, &nodeItemType, COLUMN_FILEPATH, &relFilePath, COLUMN_ICON, &pixbuf, -1); gboolean res=gtk_tree_view_row_expanded(treeView, path); if (res) { gtk_tree_view_collapse_row(treeView, path); } else { gtk_tree_view_expand_row(treeView, path, FALSE); } g_free(relFilePath); } /** * Callback handler for Gtk "row-activated" event. * * @param treeView is the GtkTreeView * @param path is the GtkTreePath of the activated row * @param column is not used * @param userData is not used */ static void tree_row_activated_cb(GtkTreeView *treeView, GtkTreePath *path, GtkTreeViewColumn *column, gpointer userData) { GtkTreeIter iter; gchar *relFilePath = NULL; gchar *absFilePath = NULL; gchar *command = NULL; GError *err = NULL; GtkWidget *dialog = NULL; gint nodeItemType; gchar *fixed = NULL; // Get the data from the row that was activated GtkTreeModel *treeModel = gtk_tree_view_get_model(treeView); gtk_tree_model_get_iter(treeModel, &iter, path); gtk_tree_model_get(treeModel, &iter, COLUMN_ITEMTYPE, &nodeItemType, COLUMN_FILEPATH, &relFilePath, -1); // We can only open files if (nodeItemType != ITEMTYPE_FILE) { switch_folder_icon(treeView,path); goto EXITPOINT; } absFilePath = fix_path((gchar*)get_project_directory(), relFilePath); fixed = fix_path((gchar*)get_project_directory(), relFilePath); if ((command = g_strdup_printf("open:%s\n", fixed)) == NULL) { g_set_error(&err, APP_SCITEPROJ_ERROR, -1, "%s: %s, g_strdup_printf() = NULL", "Error formatting SciTE command", __func__); } else { if (send_scite_command(command, &err)) { // Try to activate SciTE; ignore errors activate_scite(NULL); if (prefs.give_scite_focus == TRUE) { send_scite_command((gchar*)"focus:0", NULL); } add_file_to_recent(fixed,NULL); gchar *statusbar_text = g_strdup_printf(_("Opened %s"), remove_newline(get_filename_from_full_path(command))); set_statusbar_text(statusbar_text); g_free(statusbar_text); } } EXITPOINT: if (err != NULL) { gchar *could_not_open_string; could_not_open_string = g_strdup_printf(_("Could not open selected file:")); dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("%s\n\n%s"), could_not_open_string, err->message); gtk_dialog_run(GTK_DIALOG (dialog)); g_free(could_not_open_string); } if (relFilePath) g_free(relFilePath); if (absFilePath) g_free(absFilePath); if (command) g_free(command); if (err) g_error_free(err); if (dialog) gtk_widget_destroy(dialog); if (fixed) g_free(fixed); } /** * Respond to a Gtk "button-press-event" message. * * @param treeView is the GTKTreeView widget in which the mouse-button event occurred * @param event is the GdkEventButton event object * @param userData is not currently used */ static gboolean mouse_button_pressed_cb(GtkWidget *treeView, GdkEventButton *event, gpointer userData) { gboolean eventHandled = FALSE; GtkTreePath *path = NULL; GtkTreeModel *treeModel = NULL; gchar *nodeName = NULL; gint nodeItemType; GtkTreeIter iter; GtkTreeSelection *tree_selection = NULL; g_assert(treeView != NULL); g_assert(event != NULL); // Until we know for sure, assume that the user has not clicked on a node clicked_node.valid = FALSE; // If it is not a right-click, then ignore it if (event->type != GDK_BUTTON_PRESS || event->button != 3) { goto EXITPOINT; } // Find if the user has clicked on a node if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(treeView), (gint) event->x, (gint) event->y, &path, NULL, NULL, NULL)) { // Nope-- user clicked in the GtkTreeView, but not on a node goto EXITPOINT; } // User clicked on a node, so retrieve the particulars treeModel = gtk_tree_view_get_model(GTK_TREE_VIEW(treeView)); if (!gtk_tree_model_get_iter(treeModel, &iter, path)) { goto EXITPOINT; } gtk_tree_model_get(treeModel, &iter, COLUMN_ITEMTYPE, &nodeItemType, COLUMN_FILEPATH, &nodeName, -1); // Save the node info for use by the popup menu callbacks if (clicked_node.name) g_free(clicked_node.name); clicked_node.valid = TRUE; clicked_node.iter = iter; clicked_node.type = nodeItemType; clicked_node.name = nodeName; nodeName = NULL; // Check if something is selected tree_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeView)); if (tree_selection != NULL) { // Check if clicked on something in the selection, otherwise make the clicked one the selection. if (gtk_tree_selection_path_is_selected(tree_selection, path) == FALSE) { // clear selection and make current line selected gtk_tree_selection_unselect_all(tree_selection); gtk_tree_selection_select_path(tree_selection, path); } } // Pop up the appropriate menu for the node type if (nodeItemType == ITEMTYPE_FILE) { if (fileRightClickPopupMenu) { gtk_menu_popup_at_pointer(GTK_MENU(fileRightClickPopupMenu), (GdkEvent*)event); } } else if (nodeItemType == ITEMTYPE_GROUP) { if (groupRightClickPopupMenu) { gtk_menu_popup_at_pointer(GTK_MENU(groupRightClickPopupMenu), (GdkEvent*)event); } } eventHandled = TRUE; EXITPOINT: if (path) gtk_tree_path_free(path); if (nodeName) g_free(nodeName); return eventHandled; } /** * Set the title of the main window. * * @param newName is the desired new name of the window. */ void set_window_title(const gchar *newName) { g_assert(newName != NULL); gchar *temp_string = g_new(gchar, 512); g_snprintf(temp_string,512, "%s", newName); gtk_window_set_title(GTK_WINDOW(sMainWindow), temp_string); g_free(window_saved_title); window_saved_title = g_strdup_printf("%s", newName); g_free(temp_string); } /** * */ gboolean dialog_response_is_exit(gint test) { gboolean result = FALSE; if ((test == GTK_RESPONSE_REJECT) || (test == GTK_RESPONSE_CANCEL) || (test == GTK_RESPONSE_DELETE_EVENT) || (test == GTK_RESPONSE_NONE)) { result = TRUE; } return result; } /** * */ void recent_files_switch_visible() { gboolean visible = FALSE; g_object_get(G_OBJECT(recentGrid), "visible", &visible, NULL); if (visible) { gtk_widget_hide(recentGrid); gtk_widget_grab_focus(projectTreeView); } else { gtk_widget_show(recentGrid); } } /** * */ void set_dialog_transient(GtkWidget *dialog) { gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(sMainWindow)); } /** * */ GtkWindow *get_main_window() { return GTK_WINDOW(sMainWindow); } sciteproj-1.14/src/load_folder.h0000644000175000017500000000221713542152470016230 0ustar gusnangusnan/** * load_folder.h - folder loading support for sciteproj * * Copyright 2012-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #ifndef __HEADER_LOAD_FOLDER_ #define __HEADER_LOAD_FOLDER_ gboolean ignore_pattern_matches(gchar *folder_name, const gchar *filename, GSList *filter_list); gboolean load_folder(gchar *project_path, GError **err); GSList *load_folder_to_list(gchar *folder_path, gboolean read_directories, GCompareFunc compare_func, GSList *filter_list); #endif /*__HEADER_LOAD_FOLDER_*/ sciteproj-1.14/src/remove.c0000644000175000017500000002531713542152470015254 0ustar gusnangusnan/** * remove.c - code for removing nodes * * Copyright 2011-2017 Andreas Rönnquist * * This file is part of SciteProj * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . */ #include #include #include #include #include "clicked_node.h" #include "gui.h" #include "tree_manipulation.h" #include "remove.h" #include "file_utils.h" #include "prefs.h" /** * delete_file * deletes a file (or directory) from the filesystem - directories needs to * be empty to be able to delete them. */ gboolean delete_file(gchar *filename,GError **error) { gboolean result = FALSE; gchar *file_to_delete; if (g_file_test(filename, G_FILE_TEST_IS_DIR)) { file_to_delete = filename; // We have already checked if the folder is empty } else { if (!relative_path_to_abs_path(filename, &file_to_delete, get_project_directory(), error)) { result = FALSE; goto EXITPOINT; } } printf("%s\n", file_to_delete); result=TRUE; EXITPOINT: return result; } /** * */ GList *get_list_of_selected_items_rows(GtkTreeView *treeview) { GtkTreeSelection *selection = gtk_tree_view_get_selection(treeview); GtkTreeModel *model; if (gtk_tree_selection_count_selected_rows(selection) == 0) return NULL; model = gtk_tree_view_get_model(treeview); GList *result_list = gtk_tree_selection_get_selected_rows(selection, &model); return result_list; } /** * */ GList *get_list_of_selected_items_string_list(GtkTreeView *treeview) { GtkTreeModel *model = gtk_tree_view_get_model(treeview); GList *row_list = get_list_of_selected_items_rows(treeview); GList *string_list = NULL; // Begin at the end, and go to the start row_list = g_list_last(row_list); GtkTreeIter iter; while (row_list) { GtkTreePath *path = (GtkTreePath *)row_list->data; if (path) { gtk_tree_model_get_iter(model, &iter, path); gchar *path_string; gtk_tree_model_get(model, &iter, COLUMN_FILEPATH, &path_string, -1); string_list = g_list_prepend(string_list, path_string); } row_list = row_list -> prev; } g_list_foreach (row_list, (GFunc)gtk_tree_path_free, NULL); g_list_free (row_list); return string_list; } /** * get_list_of_selected_items_strings * Will only give the 7 first values, orelse it probably wouldn't fit in a * dialog */ gchar *get_list_of_selected_items_strings(GtkTreeView *treeview) { GtkTreeModel *model = gtk_tree_view_get_model(treeview); GList *list = get_list_of_selected_items_rows(treeview); // Begin at the end, and go to the start list = g_list_last(list); GtkTreeIter iter; gchar *result_string = g_strdup("\n\n"); int count = 0; while (list) { GtkTreePath *path = (GtkTreePath *)list->data; if (path) { gtk_tree_model_get_iter(model, &iter, path); gchar *path_string; gtk_tree_model_get(model, &iter, COLUMN_FILEPATH, &path_string, -1); if (count <7) { gchar *temp = g_strconcat(result_string, path_string, "\n", NULL); g_free(result_string); result_string=temp; } else if (count == 7) { gchar *temp = g_strconcat(result_string, "...\n", NULL); g_free(result_string); result_string=temp; } count++; } list = list -> prev; } g_list_foreach (list, (GFunc)gtk_tree_path_free, NULL); g_list_free (list); return result_string; } /** * Actually remove selected nodes */ void remove_selected_items ( GtkTreeView *treeview ) { GError *error = NULL; GtkTreeIter iter; GtkTreeModel *model = gtk_tree_view_get_model(treeview); GList *list = get_list_of_selected_items_rows(treeview); // gtk_tree_selection_get_selected_rows( selection, &model ); // Begin at the end and go to the start list = g_list_last(list); while(list) { GString *fixed_path = g_string_new(""); g_string_printf(fixed_path, "%s", gtk_tree_path_to_string((GtkTreePath*)list->data)/*ipath*/); GtkTreePath *path = gtk_tree_path_new_from_string(fixed_path->str); g_string_free(fixed_path, TRUE); if (path) { if ( gtk_tree_model_get_iter ( model, &iter, path) ) { // get iter from specified path remove_tree_node(&iter, &error); } else { // invalid path g_error(_("Error!!!\n")); } gtk_tree_path_free(path); } else { g_error(_("Error!!!\n")); } list = list->prev; } g_list_foreach (list, (GFunc)gtk_tree_path_free, NULL); g_list_free (list); } /** * */ GtkWidget *do_question_dialog(const gchar *buffer) { GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, "%s", buffer); return dialog; } /** * */ gboolean really_do_delete_question(const gchar *format, ...) { GtkWidget *dialog; gint dialog_response; char buffer[256]; gboolean result; va_list args; va_start(args, format); vsprintf(buffer, format, args); dialog = do_question_dialog(buffer); va_end(args); result = TRUE; dialog_response = gtk_dialog_run(GTK_DIALOG (dialog)); if (dialog_response_is_exit(dialog_response)) { result = FALSE; goto EXITPOINT; } // Ask again to really make sure the user knows what he/she is doing. if (result) { gtk_widget_destroy(dialog); gchar *extended_question_string = g_strdup_printf( "Are you really really sure? \n" "This will actually delete the files\n" "from the filesystem.\n\n%s",buffer); dialog = do_question_dialog(extended_question_string); dialog_response=gtk_dialog_run(GTK_DIALOG(dialog)); if (dialog_response_is_exit(dialog_response)) { result = FALSE; goto EXITPOINT; } } EXITPOINT: gtk_widget_destroy(dialog); return result; } /** * */ void do_remove_node(gboolean ignore_clicked_node) { GError *err = NULL; GtkWidget *dialog = NULL; gchar *nodename = NULL; gint selected_rows = 0; gboolean multiple_selected = FALSE; // Check if we are in "write-protect" mode if (prefs.write_protect) { dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "You are in write protected mode!\n\n" "You cannot delete anything when using sciteproj in this mode.\n" "To be able to delete files, either use your terminal, your\n" "file-manager of choice, or you can set the 'write_protect'\n" "variable in your sciteprojrc.lua to false.\n"); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); dialog = NULL; goto EXITPOINT; } // Make sure a node has been selected if (!ignore_clicked_node) { if (!clicked_node.valid) { goto EXITPOINT; } } GtkTreeSelection *tree_select; tree_select = gtk_tree_view_get_selection(GTK_TREE_VIEW(projectTreeView)); selected_rows = gtk_tree_selection_count_selected_rows(tree_select); if (selected_rows>1) { multiple_selected = TRUE; } if (!ignore_clicked_node) { // Figure out the node name nodename = strrchr(clicked_node.name, '/'); if (nodename) { ++nodename; } else { nodename = clicked_node.name; } } else { // if there is only one selected, get its name nodename = NULL; multiple_selected = TRUE; } // Confirm removal from project if (multiple_selected) { gchar *file_list_string = get_list_of_selected_items_strings(GTK_TREE_VIEW(projectTreeView)); gchar *question_string = g_strdup_printf("%s\n%s",_("Delete all selected items?"),file_list_string); if (really_do_delete_question(question_string)) { // remove them! GList *string_list = get_list_of_selected_items_string_list(GTK_TREE_VIEW(projectTreeView)); while (string_list) { gchar *temp = (gchar *)string_list->data; if (!delete_file(temp, &err)) { goto EXITPOINT; } string_list = string_list->next; }; remove_selected_items(GTK_TREE_VIEW(projectTreeView)); } g_free(file_list_string); g_free(question_string); } else { gboolean really_do_delete = FALSE; if (clicked_node.type == ITEMTYPE_FILE) { if (nodename) { really_do_delete = really_do_delete_question(_("Delete file '%s'?"), nodename); } else { really_do_delete = really_do_delete_question(_("Delete file?")); } } else { // TODO: check if the folder is empty already here before "confirmation" questions gchar *filepath; GtkTreeModel *tree_model = gtk_tree_view_get_model(GTK_TREE_VIEW(projectTreeView)); gtk_tree_model_get(tree_model, &clicked_node.iter, COLUMN_FILEPATH, &filepath, -1); if (get_number_of_files_in_folder(filepath) > 0) { dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Folder need to be empty to be able to delete it!"); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); goto EXITPOINT; } if (nodename) { really_do_delete = really_do_delete_question(_("Delete folder '%s' and any contained files?"),nodename); } else { really_do_delete = really_do_delete_question(_("Delete folder and any contained files?")); } } if (!really_do_delete) { goto EXITPOINT; } // Delete the file gchar *filepath; GtkTreeModel *tree_model = gtk_tree_view_get_model(GTK_TREE_VIEW(projectTreeView)); gtk_tree_model_get(tree_model, &clicked_node.iter, COLUMN_FILEPATH, &filepath, -1); if (!delete_file(filepath, &err)) { goto EXITPOINT; } // Remove the node if (!remove_tree_node(&(clicked_node.iter), &err)) { GtkWidget *errDialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Could not delete the selected node: \n\n%s"), err->message); gtk_dialog_run(GTK_DIALOG (errDialog)); gtk_widget_destroy(errDialog); } } EXITPOINT: if (err) g_error_free(err); if (dialog) gtk_widget_destroy(dialog); } sciteproj-1.14/src/menus.h0000644000175000017500000000252613542152470015110 0ustar gusnangusnan/** * menus.h - Menus for SciteProj * * Copyright 2009-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #ifndef __HEADER_MENUS_ #define __HEADER_MENUS_ /* Menu definitions */ extern GtkAccelGroup *accelerator_group; extern GtkWidget *menuBar; extern GtkWidget *groupPopupMenu; extern GtkWidget *fileMenuEntry; extern GtkWidget *editMenuEntry; extern GtkWidget *viewMenuEntry; extern GtkWidget *helpMenuEntry; extern GtkWidget *filePopupMenu; extern GtkWidget *fileRightClickPopupMenu; extern GtkWidget *groupRightClickPopupMenu; extern GtkWidget *sortPopupMenu; extern GtkWidget *recentPopupMenu; extern GtkWidget *quitMenuItem; int init_menus(GtkWidget* widget); #endif /*__HEADER_MENUS_*/ sciteproj-1.14/src/string_utils.c0000644000175000017500000000441313542152470016477 0ustar gusnangusnan/** * string_utils.c - misc string utils for SciteProj * * Copyright 2006 Roy Wood, 2009-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #include #include #include #include #include #include "string_utils.h" #include "file_utils.h" #include #include #include #define APP_SCITEPROJ_ERROR g_quark_from_static_string("APP_STRINGUTILS_ERROR") /** * Append a string to an existing string, expanding the allocation of the string. * * @return TRUE on success, FALSE on failure (further details returned in err) * * @param dst is the string to append onto * @param src is the string to append to dst * @param err returns any errors */ gboolean str_append(gchar **dst, const gchar *src, GError **err) { gboolean finalResult = FALSE; g_assert(dst != NULL); g_assert(src != NULL); gulong dstLength = (*dst == NULL) ? 0 : strlen(*dst); gulong srcLength = strlen(src); gulong totalLength = dstLength + srcLength + 1; gchar *newDst = (gchar *) g_try_realloc(*dst, totalLength); if (newDst == NULL) { g_set_error(err, APP_SCITEPROJ_ERROR, -1, "%s: Could not allocate memory, g_try_realloc(%ld) = NULL", __func__, totalLength); goto EXITPOINT; } g_memmove(newDst + dstLength, src, srcLength + 1); *dst = newDst; finalResult = TRUE; EXITPOINT: return finalResult; } /** * */ void debug_printf(const char *st, ...) { va_list ap; va_start(ap,st); #ifdef _DEBUG vprintf(st,ap); #endif va_end(ap); } /** * */ char *remove_newline( char *s ) { int len=strlen(s); if (s[len-1] == '\n') { s[len-1] = '\0'; } return s; } sciteproj-1.14/src/menus.c0000644000175000017500000002326513542152470015106 0ustar gusnangusnan/** * menus.c - Menus for SciteProj * * Copyright 2009-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #include #include #include #include #include #include #include #include #include "gui_callbacks.h" #include "properties_dialog.h" #include "menus.h" #include "clicked_node.h" #include "gui.h" #include "sort.h" #include "clipboard.h" #include "recent_files.h" GtkWidget *menuBar = NULL; GtkWidget *fileMenuEntry = NULL; GtkWidget *editMenuEntry = NULL; GtkWidget *viewMenuEntry = NULL; GtkWidget *helpMenuEntry = NULL; GtkWidget *filePopupMenu = NULL; GtkWidget *editPopupMenu = NULL; GtkWidget *viewPopupMenu = NULL; GtkWidget *helpPopupMenu = NULL; GtkWidget *fileRightClickPopupMenu = NULL; GtkWidget *groupRightClickPopupMenu = NULL; GtkWidget *sortPopupMenu = NULL; GtkWidget *quitMenuItem = NULL; GtkWidget *aboutMenuItem = NULL; GtkWidget *sortMenuItem = NULL; GtkWidget *sortAscendingMenuItem = NULL; GtkWidget *sortDescendingMenuItem = NULL; GtkWidget *sortAscendingExtensionMenuItem = NULL; GtkWidget *sortDescendingExtensionMenuItem = NULL; GtkWidget *openFileMenuItem = NULL; GtkWidget *copyFilenameMenuItem = NULL; GtkWidget *propertiesMenuItem = NULL; GtkWidget *propertiesFileMenuItem = NULL; GtkWidget *propertiesGroupMenuItem = NULL; GtkWidget *showRecentFileMenuItem = NULL; GtkWidget *menuSeparator = NULL; GtkWidget *sortSeparator = NULL; GtkWidget *fileRightClickSeparator = NULL; GtkWidget *folderPopupSeparator1 = NULL; GtkWidget *folderPopupSeparator2 = NULL; GtkWidget *updateFolderContentMenuItem = NULL; GtkAccelGroup *accelerator_group = NULL; GtkWidget *recentPopupMenu = NULL; GtkWidget *recentMenuOpenFileItem = NULL; GtkWidget *recentMenuRemoveFileItem = NULL; GtkWidget *recentMenuCopyFilenameItem = NULL; GtkWidget *recentMenuPropertiesItem = NULL; GtkWidget *recentMenuSeparator = NULL; /** * */ int init_menus(GtkWidget *window) { menuBar = gtk_menu_bar_new(); fileMenuEntry = gtk_menu_item_new_with_mnemonic(_("_File")); editMenuEntry = gtk_menu_item_new_with_mnemonic(_("_Edit")); viewMenuEntry = gtk_menu_item_new_with_mnemonic(_("_View")); helpMenuEntry = gtk_menu_item_new_with_mnemonic(_("_Help")); filePopupMenu = gtk_menu_new(); editPopupMenu = gtk_menu_new(); viewPopupMenu = gtk_menu_new(); helpPopupMenu = gtk_menu_new(); menuSeparator = gtk_separator_menu_item_new(); quitMenuItem = gtk_menu_item_new_with_mnemonic(_("_Quit")); gtk_menu_item_set_submenu(GTK_MENU_ITEM(fileMenuEntry), filePopupMenu); gtk_menu_item_set_submenu(GTK_MENU_ITEM(editMenuEntry), editPopupMenu); gtk_menu_item_set_submenu(GTK_MENU_ITEM(viewMenuEntry), viewPopupMenu); gtk_menu_item_set_submenu(GTK_MENU_ITEM(helpMenuEntry), helpPopupMenu); gtk_menu_shell_append(GTK_MENU_SHELL(filePopupMenu), quitMenuItem); propertiesMenuItem = gtk_menu_item_new_with_mnemonic(_("Edit properties")); gtk_menu_shell_append(GTK_MENU_SHELL(editPopupMenu), propertiesMenuItem); g_signal_connect(G_OBJECT(propertiesMenuItem), "activate", G_CALLBACK(edit_properties_cb), NULL); showRecentFileMenuItem = gtk_menu_item_new_with_mnemonic(_("Show Recently Opened Files")); g_signal_connect(G_OBJECT(showRecentFileMenuItem), "activate", G_CALLBACK(recent_files_switch_visible), NULL); gtk_widget_add_accelerator(showRecentFileMenuItem, "activate", accelerator_group, GDK_KEY_r, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); gtk_menu_shell_append(GTK_MENU_SHELL(viewPopupMenu), showRecentFileMenuItem); aboutMenuItem = gtk_menu_item_new_with_mnemonic(_("About")); g_signal_connect(G_OBJECT(aboutMenuItem), "activate", G_CALLBACK(about_menu_cb), NULL); gtk_menu_shell_append(GTK_MENU_SHELL(helpPopupMenu), aboutMenuItem); gtk_menu_shell_append(GTK_MENU_SHELL(menuBar), fileMenuEntry); gtk_menu_shell_append(GTK_MENU_SHELL(menuBar), editMenuEntry); gtk_menu_shell_append(GTK_MENU_SHELL(menuBar), viewMenuEntry); gtk_menu_shell_append(GTK_MENU_SHELL(menuBar), helpMenuEntry); fileRightClickPopupMenu = gtk_menu_new(); openFileMenuItem = gtk_menu_item_new_with_mnemonic(_("Open file in SciTE")); gtk_menu_shell_append(GTK_MENU_SHELL(fileRightClickPopupMenu), openFileMenuItem); copyFilenameMenuItem = gtk_menu_item_new_with_mnemonic(_("Copy filename to clipboard")); gtk_menu_shell_append(GTK_MENU_SHELL(fileRightClickPopupMenu), copyFilenameMenuItem); fileRightClickSeparator = gtk_separator_menu_item_new(); gtk_menu_shell_append(GTK_MENU_SHELL(fileRightClickPopupMenu), fileRightClickSeparator); propertiesFileMenuItem = gtk_menu_item_new_with_mnemonic(_("Properties")); gtk_menu_shell_append(GTK_MENU_SHELL(fileRightClickPopupMenu), propertiesFileMenuItem); g_signal_connect(G_OBJECT(openFileMenuItem), "activate", G_CALLBACK(popup_open_file_cb), NULL); g_signal_connect(G_OBJECT(copyFilenameMenuItem), "activate", G_CALLBACK(copy_filename_to_clipboard_cb), NULL); g_signal_connect(G_OBJECT(propertiesFileMenuItem), "activate", G_CALLBACK(file_properties_cb), NULL); sortPopupMenu = gtk_menu_new(); sortMenuItem = gtk_menu_item_new_with_mnemonic(_("Sort folder contents")); sortAscendingMenuItem = gtk_menu_item_new_with_mnemonic(_("Sort ascending by name")); sortDescendingMenuItem = gtk_menu_item_new_with_mnemonic(_("Sort descending by name")); sortAscendingExtensionMenuItem = gtk_menu_item_new_with_mnemonic(_("Sort ascending by extension")); sortDescendingExtensionMenuItem = gtk_menu_item_new_with_mnemonic(_("Sort descending by extension")); sortSeparator = gtk_separator_menu_item_new(); gtk_menu_shell_append(GTK_MENU_SHELL(sortPopupMenu), sortAscendingMenuItem); gtk_menu_shell_append(GTK_MENU_SHELL(sortPopupMenu), sortDescendingMenuItem); gtk_menu_shell_append(GTK_MENU_SHELL(sortPopupMenu), sortSeparator); gtk_menu_shell_append(GTK_MENU_SHELL(sortPopupMenu), sortAscendingExtensionMenuItem); gtk_menu_shell_append(GTK_MENU_SHELL(sortPopupMenu), sortDescendingExtensionMenuItem); g_signal_connect(G_OBJECT(sortAscendingMenuItem), "activate", G_CALLBACK(sort_ascending_cb), NULL); g_signal_connect(G_OBJECT(sortDescendingMenuItem), "activate", G_CALLBACK(sort_descending_cb), NULL); g_signal_connect(G_OBJECT(sortAscendingExtensionMenuItem), "activate", G_CALLBACK(sort_ascending_by_extension_cb), NULL); g_signal_connect(G_OBJECT(sortDescendingExtensionMenuItem), "activate", G_CALLBACK(sort_descending_by_extension_cb), NULL); gtk_menu_item_set_submenu(GTK_MENU_ITEM(sortMenuItem), sortPopupMenu); groupRightClickPopupMenu = gtk_menu_new(); folderPopupSeparator1 = gtk_separator_menu_item_new(); folderPopupSeparator2 = gtk_separator_menu_item_new(); propertiesGroupMenuItem = gtk_menu_item_new_with_mnemonic(_("Properties")); updateFolderContentMenuItem = gtk_menu_item_new_with_mnemonic(_("Update folder content")); gtk_menu_shell_append(GTK_MENU_SHELL(groupRightClickPopupMenu), sortMenuItem); gtk_menu_shell_append(GTK_MENU_SHELL(groupRightClickPopupMenu), folderPopupSeparator1); gtk_menu_shell_append(GTK_MENU_SHELL(groupRightClickPopupMenu), updateFolderContentMenuItem); gtk_menu_shell_append(GTK_MENU_SHELL(groupRightClickPopupMenu), folderPopupSeparator2); gtk_menu_shell_append(GTK_MENU_SHELL(groupRightClickPopupMenu), propertiesGroupMenuItem); g_signal_connect(G_OBJECT(propertiesGroupMenuItem), "activate", G_CALLBACK(group_properties_cb), NULL); g_signal_connect(G_OBJECT(updateFolderContentMenuItem), "activate", G_CALLBACK(refresh_folder_cb), NULL); gtk_widget_show_all(groupRightClickPopupMenu); gtk_widget_show_all(fileRightClickPopupMenu); gtk_widget_show_all(GTK_WIDGET(menuBar)); gtk_widget_add_accelerator(quitMenuItem, "activate", accelerator_group, GDK_KEY_q, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); g_signal_connect(G_OBJECT(quitMenuItem), "activate", G_CALLBACK(quit_menu_cb), NULL); recentPopupMenu = gtk_menu_new(); recentMenuOpenFileItem = gtk_menu_item_new_with_mnemonic(_("Open file in SciTE")); recentMenuRemoveFileItem = gtk_menu_item_new_with_mnemonic(_("Remove file from this list")); recentMenuCopyFilenameItem = gtk_menu_item_new_with_mnemonic(_("Copy filename to clipboard")); recentMenuPropertiesItem = gtk_menu_item_new_with_mnemonic(_("Properties")); recentMenuSeparator = gtk_separator_menu_item_new(); g_signal_connect(G_OBJECT(recentMenuOpenFileItem), "activate", G_CALLBACK(popup_open_recent_file_cb), NULL); g_signal_connect(G_OBJECT(recentMenuRemoveFileItem), "activate", G_CALLBACK(popup_remove_recent_file_cb), NULL); g_signal_connect(G_OBJECT(recentMenuCopyFilenameItem), "activate", G_CALLBACK(copy_recent_filename_to_clipboard_cb), NULL); g_signal_connect(G_OBJECT(recentMenuPropertiesItem), "activate", G_CALLBACK(properties_recent_file_cb), NULL); gtk_menu_shell_append(GTK_MENU_SHELL(recentPopupMenu),recentMenuOpenFileItem); gtk_menu_shell_append(GTK_MENU_SHELL(recentPopupMenu),recentMenuRemoveFileItem); gtk_menu_shell_append(GTK_MENU_SHELL(recentPopupMenu),recentMenuCopyFilenameItem); gtk_menu_shell_append(GTK_MENU_SHELL(recentPopupMenu),recentMenuSeparator); gtk_menu_shell_append(GTK_MENU_SHELL(recentPopupMenu),recentMenuPropertiesItem); gtk_widget_show_all(GTK_WIDGET(recentPopupMenu)); return 0; } sciteproj-1.14/src/gui.h0000644000175000017500000000324113542152470014540 0ustar gusnangusnan/** * gui.h - GUI code for SciteProj * * Copyright 2006 Roy Wood, 2009-2019 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #ifndef __HEADER_GUI_ #define __HEADER_GUI_ /** * Variables */ extern gchar *window_saved_title; extern GtkWidget *projectTreeView; extern GtkWidget *recentTreeView; extern GtkCellRenderer *textCellRenderer; extern ClickedNode clicked_node; extern GtkTreeViewColumn *column1; extern ClickedNode clicked_node; // Initialize the GUI gboolean setup_gui(GError **err); void gui_close(); // Enable/Disable the "Save Project" button void set_save_button_sensitivity(gboolean enabled); // Set the window title void set_window_title(const gchar *newName); // Is a given row expanded? gboolean tree_row_is_expanded(GtkTreePath *path); // Expand a row void expand_tree_row(GtkTreePath *path, gboolean expandChildren); gboolean dialog_response_is_exit(gint test); void recent_files_switch_visible(); void set_dialog_transient(GtkWidget *dialog); extern GtkWindow *get_main_window(); #endif /*__HEADER_GUI_*/ sciteproj-1.14/src/recent_files.h0000644000175000017500000000231013542152470016412 0ustar gusnangusnan/** * recent_files.h - list of recently opened files * * Copyright 2011-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #ifndef __HEADER_RECENT_FILES_ #define __HEADER_RECENT_FILES_ /** * */ extern GtkWidget *recentTreeView; //extern GtkWidget *recentPopupMenu; GtkWidget *init_recent_files(GError **err); gboolean add_file_to_recent(gchar *filepath, GError **err); void popup_open_recent_file_cb(); void popup_remove_recent_file_cb(); void copy_recent_filename_to_clipboard_cb(); void properties_recent_file_cb(); #endif /*__HEADER_RECENT_FILES_*/ sciteproj-1.14/src/file_utils.h0000644000175000017500000000324713542152470016121 0ustar gusnangusnan/** * file_utils.h - file utilities for SciteProj * * Copyright 2009-2017 Andreas Rönnquist * * This file is part of SciteProj. * * SciteProj is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SciteProj 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 SciteProj. If not, see . * */ #ifndef __HEADER_FILE_UTILS_ #define __HEADER_FILE_UTILS_ /** * */ extern gchar *current_directory; /** * */ void init_file_utils(); gchar *fix_path(gchar *base_dir,gchar *original); gboolean is_separator(gchar ch); gchar *fix_separators(gchar *source); // get the filename from a full path+filename gchar *get_filename_from_full_path(gchar *src); // Convert an absolute file path to a relative file path gboolean abs_path_to_relative_path(const gchar *absPath, gchar **relativePath, const gchar *basePath, GError **err); // Convert a relative file path to an absolute file path gboolean relative_path_to_abs_path(gchar *relativePath, gchar **absPath, const gchar *basePath, GError **err); gchar *get_file_extension(gchar *filename); int get_number_of_files_in_folder(gchar *folder_name); gboolean is_string_folder(gchar *instring); gchar *clean_folder(gchar *folder_name); #endif /*__HEADER_FILE_UTILS_*/ sciteproj-1.14/VERSION0000644000175000017500000000000413542152470014056 0ustar gusnangusnan1.14sciteproj-1.14/bin/0000755000175000017500000000000013542152470013564 5ustar gusnangusnansciteproj-1.14/bin/placeholder.txt0000644000175000017500000000000013542152470016575 0ustar gusnangusnansciteproj-1.14/Makefile0000644000175000017500000000572113542152470014461 0ustar gusnangusnan# # Copyright (C) 2009-2019 Andreas Rönnquist # This file is distributed under the same license # as the sciteproj package, see COPYING file. # ifndef CC CC=gcc endif ifndef PKG_CONFIG PKG_CONFIG=pkg-config endif SRC=src BIN=bin GRPH=graphics OBJ=obj ifdef DEBUG STD_CFLAGS=-Wall -g3 -ggdb -D_DEBUG else STD_CFLAGS=-Wall -Wformat -Wno-format-extra-args -Wformat-security -Wformat-nonliteral -Wformat=2 -Wdeprecated-declarations endif OBJECTS=$(OBJ)/about.o $(OBJ)/clipboard.o $(OBJ)/expand.o\ $(OBJ)/file_utils.o $(OBJ)/folder_config.o\ $(OBJ)/graphics.o $(OBJ)/gui.o $(OBJ)/gui_callbacks.o\ $(OBJ)/icon.o $(OBJ)/load_folder.o $(OBJ)/menus.o $(OBJ)/main.o $(OBJ)/prefs.o\ $(OBJ)/properties_dialog.o $(OBJ)/recent_files.o $(OBJ)/remove.o\ $(OBJ)/scite_utils.o $(OBJ)/script.o $(OBJ)/sort.o $(OBJ)/statusbar.o\ $(OBJ)/string_utils.o $(OBJ)/tree_manipulation.o GRAPHICS_INCLUDES=$(GRPH)/dir-close.xpm \ $(GRPH)/dir-open.xpm \ $(GRPH)/sciteproj.xpm ifndef PREFIX ifdef INSTALL_PREFIX PREFIX=$(INSTALL_PREFIX) else PREFIX=/usr/local endif endif NAME=sciteproj PROG=${BIN}/${NAME} DEPEND=Makefile.dep DATADIR= ${DESTDIR}${PREFIX}/share LOCALEDIR = ${DATADIR}/locale VERSION=$(shell cat ./VERSION) PKG_GTK=gtk+-3.0 CHECK_GTK3=1 LIB_CFLAGS=$(shell $(PKG_CONFIG) --cflags --silence-errors $(PKG_GTK) $(PKG_WNCK) lua5.3 || $(PKG_CONFIG) --cflags $(PKG_GTK) $(PKG_WNCK) lua) STD_LDFLAGS= LIBS=-lX11 $(shell $(PKG_CONFIG) --libs --silence-errors $(PKG_GTK) $(PKG_WNCK) lua5.3 || $(PKG_CONFIG) --libs $(PKG_GTK) $(PKG_WNCK) lua) LOCAL_CFLAGS=$(STD_CFLAGS) $(DEPRECATED) $(CFLAGS) $(LIB_CFLAGS) LOCAL_LDFLAGS=$(STD_CFLAGS) $(LDFLAGS) $(STD_LDFLAGS) LOCAL_CPPFLAGS=$(CPPFLAGS) LOCAL_CFLAGS+=-DGTK_DISABLE_SINGLE_INCLUDES LOCAL_CFLAGS+=-DGSEAL_ENABLE LOCAL_CFLAGS+=-DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED LOCAL_CFLAGS+=-DLOCALEDIR=\"$(LOCALEDIR)\" -DPACKAGE=\"$(NAME)\" -DSCITEPROJ_VERSION=\"$(VERSION)\" all: $(BIN)/$(NAME) sciteproj.1.gz ${MAKE} -C po -j1 all $(OBJ)/%.o: $(SRC)/%.c $(CC) $(LOCAL_CFLAGS) $(LOCAL_CPPFLAGS) -c $< -o $@ $(BIN)/$(NAME): $(OBJECTS) $(CC) $(LOCAL_CFLAGS) $(LOCAL_LDFLAGS) $(OBJECTS) -o $(PROG) $(LIBS) sciteproj.1.gz: sciteproj.1 gzip -k sciteproj.1 clean: rm -rf $(OBJECTS) $(PROG) $(DEPEND) rm -f sciteproj.1.gz ${MAKE} -C po clean install: install -d $(DESTDIR)$(PREFIX)/bin install -m 755 $(PROG) $(DESTDIR)$(PREFIX)/bin install -d $(DESTDIR)$(PREFIX)/share/pixmaps install -m 644 graphics/sciteproj.xpm $(DESTDIR)$(PREFIX)/share/pixmaps install -d $(DESTDIR)$(PREFIX)/share/man/man1 install -m 644 sciteproj.1.gz $(DESTDIR)$(PREFIX)/share/man/man1 ${MAKE} -C po install uninstall: rm -f $(DESTDIR)$(PREFIX)/$(PROG) rm -f $(DESTDIR)$(PREFIX)/share/pixmaps/sciteproj.xpm rm -f $(DESTDIR)$(PREFIX)/share/man/man1/sciteproj.1.gz ${MAKE} -C po uninstall $(DEPEND): $(CC) $(LOCAL_CFLAGS) -MM $(SRC)/*.c | sed -e "s/\([A-Za-z0-9+-0._&+-]*:\)/\$(OBJ)\/\1/g" -e "s/obj\/C\:/\/C/g" > $(DEPEND) -include $(DEPEND) sciteproj-1.14/COPYING0000644000175000017500000000007513542152470014051 0ustar gusnangusnan Sciteproj is licensed under the GPL3 license. See GPL3.txt sciteproj-1.14/README.translators0000644000175000017500000000326613542152470016256 0ustar gusnangusnan# # Copyright (C) 2010-2018 Andreas Rönnquist # This file is distributed under the same license # as the sciteproj package, see COPYING file. # Information for new translators ------------------------------- Starting fresh -------------- Get a copy of the sciteproj sources, and create a sciteproj.pot file: cd po make sciteproj.pot Generate a new po for your language with sciteproj.pot as input: msginit --input=sciteproj.pot This will read your environment, and init the translation meta information with values based on that info. See msginit --help for more info. Then start translating all strings in the po using your favourite texteditor, or a "gettext catalogs (.po files) editor" like poedit (which can be found at http://www.poedit.net.) Note that hot-keys are illustrated with the "_" character, the character following "_" is the keyboard shortcut for that menu item. Checking your translation for errors and completeness ----------------------------------------------------- msgfmt -c --statistics sv.po -o /dev/null Building SciteProj with your translation included -------------------------------------------------- Edit the Makefile in the po folder to include your translation in the listing under the LANGUAGES variable. Then build sciteproj as usual with make and install using make install as root. Updating your translation ------------------------- When it is time to update your translation, get the latest git version of sciteproj, and then do the following: cd po rm sciteproj.pot make sciteproj.pot Next issue the following command to update your po file: msgmerge --update sv.po sciteproj.pot Then open your file and locate the strings that need updating. sciteproj-1.14/README0000644000175000017500000001513513542152470013701 0ustar gusnangusnan# # Copyright (C) 2010-2019 Andreas Rönnquist # This file is distributed under the same license # as the sciteproj package, see COPYING file. # SciteProj ========= SciteProj is a Project Manager for usage with the SciTE text editor. It is based on ScitePM by Roy Wood. It is a "director" of SciTE, using it's director interface to communicate between SciteProj and SciTE. See http://www.scintilla.org/SciTEDirector.html for more information. SciteProj is used to browse folders on the harddrive in customizable ways. Previous versions used to load "projects" from XML files, but this was dropped, and now sciteproj shows and works directly on your harddrive contents filterable and sortable as you wish. Running ======= SciteProj will load a configuration from the file sciteprojrc.lua first in the directory specified by $XDG_CONFIG_HOME each program start. This is most likely ~/.config/sciteprojrc.lua or if that doesn't exist sciteproj will load config from sciteprojrc.lua in the current folder. See the following links on why we use the folder ~/.config/ : http://developer.gnome.org/glib/stable/glib-Miscellaneous-Utility-Functions.html#g-get-user-config-dir http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html Between 0.7 and 0.8 SciteProj has gone through some big changes, and changed the way "projects" are handled. From now on sciteproj works directly on what is available on the harddrive, and doesn't use a project XML file. However, if you have a local sciteprojrc.lua in a folder, sciteproj will read information from it and act on that to determine how to view the folder. Please notice that I now use LUA, which amongst other means that boolean values are case sensitive for lowercase and TRUE and FALSE are invalid as values. The options availible in the config file are: * The window geometry You can enter wanted window geometry/positioning, which will be applied to the program upon next program start. The variables are xpos, ypos, width and height. Also, the following options exist: * give_scite_focus If this is set to true, the SciTE window will recieve focus when you open a file from SciteProj. (Defaults to false) * hide_statusbar Don't show the statusbar to save valuable screen-space. * use_stock_folder_icon Should we use the system folder icon, or the ones provided by sciteproj? The sciteproj one are different icons for opened and closed directory, while when using the stock ones there are only one icon for folders, open or closed. * start_scite Should SciTE be started simultaneously with sciteproj? You can open this configuration file by opening the Edit menu and select Edit Options in that menu. This will open sciteprojrc.lua from the current folder as if it was part of your project and edit it in SciTE. SciteProj will give you a warning if it isn't able to find the SciTE executable on SciteProj start. As default SciTE will be searched for in /usr/bin, /bin, and /usr/local/bin, under the names scite and SciTE. If it isn't found there you will get a warning upon running. You can also use the --scite flag when running to locate SciTE, for example sciteproj --scite=/bin/scite will look for the scite executable in the /bin/ folder. SciTE will also be searched for in the path pointed to by the environment variable SciTE_HOME. By pressing Ctrl+R or choosing "View Recently Opened Files" in the "View" menu, you split up the project window in two parts, and the new part contain a list of the most recently opened files in the project. The files in this list are sorted so the ones you opened latest is at the top of the list (or bottom - its configurable). Local folder settings ===================== SciteProj will load sciteprojrc.lua from the current folder. In this file you can decide what files should be hidden and shown, what sort order should be used per folder, and which folders should be open when starting sciteproj and not. It follows LUA syntax, and uses three tables to filter hidden files, sort order, and to determine which folders should be open on sciteproj start. (A table is a lua type that implements associative arrays) First, hide_filter should look something like this (lines starting with "--" are comments, and not read by the LUA interpreter): -- hide_filter -- filters out files from the project listing - wildcards are allowed. hide_filter = { -- ".gitignore", -- "src/*.h", -- "test", ".git", "obj", "old" } Second, sort-order is a table with folder-names as indexes: -- sort_order -- Here you can list folders and set their individual sort order. -- -- 0 - ascending -- 1 - descending -- 2 - ascending by extension -- 3 - descending by extension -- -- default on folders that isn't listed here is 0 - ascending -- sort_order = { ["./graphics/test/"] = 0, ["src"] = 2 } a dot is the current folder, and all folder listed is below the "project" path if a full path name isn't listed. Last, open_folders is used to determine which folders should be open or closed on sciteproj program start: -- open folder - should a folder start as opened or closed? -- all folders default to false open_folders = { ["bin"] = true, ["src"] = true, ["src/test"] = false, ["po"] = false } Thats it! Enjoy using sciteproj! Credits ======= SciteProj is based on the program ScitePM written by Roy Wood and Martin Andrews, and is developed by Andreas Rönnquist . ----------------------------------- graphics/sciteproj.xpm is based on the SciTE logo, which is licensed under the following license: License for Scintilla and SciTE Copyright 1998-2003 by Neil Hodgson 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. (see http://sourceforge.net/p/scintilla/scite/ci/default/tree/License.txt) ----------------------------------- graphics/dir-open.xpm graphics/dir-close.xpm These icons are created by the Tango Desktop Project, and released under Public Domain, see at the bottom of http://tango.freedesktop.org/ for details.