318 Commits

Author SHA1 Message Date
Nick Treleaven
2c5a71f054 Add function document_close().
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2740 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-07-01 14:20:16 +00:00
Nick Treleaven
6e2ce22ec1 Move on_editor_expose_event(), create_new_sci() to editor.c.
Make on_editor_button_press_event() and on_editor_scroll_event()
static.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2720 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-06-20 17:10:51 +00:00
Nick Treleaven
a85c71ee9b Remove document_delay_colourise(), document_colourise_all().
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2719 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-06-20 14:19:57 +00:00
Nick Treleaven
48204adc80 Don't colourise any documents until they need to be drawn. This
should make Save All faster for filetypes that support typename
highlighting, and makes the document_delay_colourise(),
document_colourise_all() functions redundant (they'll be removed in
the next commit).
Note: I'll move on_editor_expose_event() to editor.c.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2717 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-06-20 12:34:13 +00:00
Enrico Tröger
e46a97a0e0 Allow scrolling page by page by holding down the Shift or Alt key (closes #1995405).
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2713 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-06-19 17:09:46 +00:00
Nick Treleaven
56e77de794 Bring back GeanyDocument::is_valid field as it is clearer and more
descriptive than using doc->index != -1.
Add deprecated macros DOC_IDX_VALID and DOC_IDX in plugindata.h,
which can make porting outside plugins easier; of course, it is
better to rewrite the code to use document pointers.
Use is_valid instead of the DOC_VALID macro when iterating over
documents_array, as there are never NULL pointers in it.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/document-pointer@2704 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-06-18 14:18:26 +00:00
Nick Treleaven
4b1e4056b8 Fix redo, reload commands.
Fix focusing editor on notebook tab click.
Minor formatting and use NZV, DOC_FILENAME macros.
Make doc_at() debug function check idx is within range.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/document-pointer@2702 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-06-18 13:36:33 +00:00
Enrico Tröger
57b3fb52b0 Fix wrong and add missing checks.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/document-pointer@2697 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-06-16 18:31:59 +00:00
Enrico Tröger
d03f72122a Get rid of GeanyDocument::is_valid, use the index value instead.
Remove DOC_IDX_* macros.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/document-pointer@2693 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-06-15 15:24:44 +00:00
Enrico Tröger
d3439f8a17 Use document pointer instead of an index to the documents array everywhere in the core code.
Pass a document pointer to the callbacks of all "document-*" signals.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/document-pointer@2692 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-06-15 13:35:48 +00:00
Nick Treleaven
98550fa246 Note: this breaks the plugin API for document functions.
Make all DocumentFuncs use a GeanyDocument* instead of an integer
index, so there's no need to access the documents array or (in most
cases) use DOC_IDX_VALID() - just check for non-NULL.
Add GeanyDocument::index field for use with the documents array.
Add DOC_IDX() macro to get the document index from a possibly NULL
pointer.
Note: the new functions in the core have a documents_ prefix where
they would conflict with the old names, which are still present and
used in the core (but will be removed soon).
Remove DocumentFuncs::get_cur_idx() - use get_current() instead.
Replace DocumentFuncs::get_n_idx() with get_from_page().
Rename DocumentFuncs::find_by_realpath() to find_by_real_path().
Replace DocumentFuncs::remove() with remove_page().
Add 'changed' argument for DocumentFuncs::set_text_changed().
Add dox for document_set_filetype().
Rename debugging function doc() doc_at() to avoid conflicts.
Rename document_find_by_realpath() in the core also.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/document-pointer@2687 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-06-12 16:50:01 +00:00
Nick Treleaven
9268c9a1dc Replace 2 macros only used locally with const char pointers.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2645 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-06-05 12:43:10 +00:00
Nick Treleaven
4fb246b243 Only reorder recent files on closing documents that have existed on
disk.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2644 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-06-05 12:36:48 +00:00
Nick Treleaven
73d817275a Only set GeanyDocument::real_path when the file exists on disk -
after a successful save or open.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2642 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-06-05 12:14:51 +00:00
Enrico Tröger
7c591fbebd Change preprocessor checks for sys/time.h and remove unnecessary sys/stat.h check.
Remove useless or unused configure checks.
Install THANKS file by default.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2641 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-06-04 15:43:52 +00:00
Nick Treleaven
50b0a10654 Note: this breaks the plugin API for plugins using
document_find_by_filename().
Make document_find_by_filename() take only a utf8_filename argument,
and now match any documents that have a filename set but aren't saved
on disk.
Add document_find_by_realpath() to the plugin API.
Add filename argument for document_save_file_as().
Add GeanyDocument::real_path field, which if non-NULL indicates the
file once existed on disk (not just as an unsaved document filename).


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2637 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-06-03 17:22:04 +00:00
Nick Treleaven
1cbbb727c2 Fix possible document double-colourise after reloading a file.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2633 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-06-02 15:52:00 +00:00
Nick Treleaven
37e0d1f3f1 Move GeanyDocument GUI elements and saved_encoding to private
Document struct which inherits from GeanyDocument. This is to hide
implementation fields from the plugin API, so that we can change
them if necessary.
Add DOCUMENT() macro to convert a GeanyDocument* to a Document*.
Also move UNDO_*, FileEncoding to documentprivate.h.
Move undo_action struct to document.c.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2631 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-06-02 15:31:59 +00:00
Nick Treleaven
be0d9e8ea7 Note: this breaks the plugin API.
Replace doc_array with documents_array, a pointer array. This is
necessary to avoid breaking the ABI every time a field is added to
GeanyDocument.
Remove deprecated pluginmacros.h documents macro, to avoid a
conflict.
Replace doc_list[] macro with documents[] macro, which returns a
GeanyDocument pointer.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2624 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-05-29 17:00:54 +00:00
Nick Treleaven
398efbd373 Note: this commit breaks the plugin API.
Split widget fields out of GeanyApp into GeanyMainWidgets, so other
data items can be added without breaking the plugin ABI.
Add GeanyData::main_widgets, and macro.
Rename treeview_notebook sidebar_notebook in GeanyMainWidgets.
Move tools_menu from GeanyData to GeanyMainWidgets.
Move statusbar out of GeanyApp (shouldn't be used directly).
Move ignore_callback out of GeanyApp.
Rename sci_goto_line() argument unfold, like sci_goto_pos().
Make utils_goto_file_pos(), utils_goto_line(),
utils_switch_document() into static functions (they are UI-related,
so shouldn't be in utils.c).
Move utils_goto_pos() to editor.c, add mark argument.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2609 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-05-22 14:41:28 +00:00
Enrico Tröger
dba4b278f8 Force using tabs for indentation when opening Makefiles.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2596 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-05-18 16:03:20 +00:00
Enrico Tröger
311b82ebb2 Rename document struct to GeanyDocument.
Rename filetype struct to GeanyFiletype.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2594 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-05-16 14:17:54 +00:00
Nick Treleaven
3a12da9daf Note: this commit breaks the plugin API (but is necessary so that in
future the ABI can stay stable when adding preferences).
Split up prefs into interface_prefs, toolbar_prefs, file_prefs,
search_prefs, tool_prefs, template_prefs, and add these to the
plugin API.
Move suppress_search_dialogs and search_use_current_word to
search_prefs, and rename accordingly.
Rename switch_msgwin_pages pref to switch_to_status.
Remove toolbar_ prefix for toolbar_prefs items.
Remove tool_ prefix for tool_prefs items.
Remove template_ prefix for template_prefs items.
Add Geany prefix for EditorPrefs.
Add Geany prefix for SearchPrefs.
Initialize search_prefs to zero in main.c.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2591 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-05-16 12:08:39 +00:00
Enrico Tröger
beb68832b3 Move several editing related functions from document.c to editor.c.
Fix two compiler warnings about non-literal format strings.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2588 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-05-15 13:43:29 +00:00
Enrico Tröger
b2cddc87a0 Move indicator functions from document.c into editor.c.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2587 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-05-14 17:58:56 +00:00
Nick Treleaven
a0337bc281 Fix line breaking not getting reset for new documents sometimes.
Merge all document default settings into init_doc_struct().


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2585 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-05-14 16:37:09 +00:00
Enrico Tröger
c151befff3 Add new function document_set_indicator_on_line() for future use.
Add some functions to the plugin API for the upcoming spell check plugin.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2581 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-05-14 15:46:48 +00:00
Enrico Tröger
392d1f863f Add preferences for default end of line characters for new files (closes #1895362) and to disable the automatic continuation of multi-line comments in C-like languages.
Enable multi-line continuation also for CSS files.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2580 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-05-14 15:36:27 +00:00
Nick Treleaven
08bb6ae5fc Add note about possible double colourisation after reloading
(it shouldn't be that noticeable though).


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2579 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-05-14 12:11:01 +00:00
Nick Treleaven
a8ab07fd19 Recolourise the document in document_reload_file() because the
text may have changed (should fix #1948857).


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2578 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-05-14 11:58:05 +00:00
Nick Treleaven
d131023fe7 Add basic Line Breaking option in the Document menu. Line breaking
only works when typing characters past the line breaking column
number.
Add 'Line breaking column' editor pref.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2562 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-05-09 12:13:29 +00:00
Nick Treleaven
f20b4e90f1 Merge revisions 2537:2558 from the custom-filetypes branch:
Note: this breaks the API.
This commit is to restructure most of the filetypes code that
affects the plugin API, custom filetype support is not implemented.
Add filetypes_array to GeanyData for plugins to access a dynamic
array of filetype pointers.
Remove old filetypes array from API.
Use a hash table for filetypes, using filetype::name keys.
Replace filetypes_get_from_uid() with filetypes_lookup_by_name().
Store filetype::name instead of unique ID when saving sessions.
Remove all filetype UID code.
Add GEANY_MAX_BUILT_IN_FILETYPES.
Remove GEANY_MAX_FILE_TYPES - use filetypes_array->len (or
GEANY_MAX_BUILT_IN_FILETYPES) instead.
Rename GEANY_FILETYPES_ALL GEANY_FILETYPES_NONE.
Make Open dialog file filter work for filetypes added after
GEANY_FILETYPES_NONE (really the None filetype should be made the
first element in filetypes_array, but this would need rewriting
quite a lot of code).
Add deprecated aliases for GEANY_MAX_FILE_TYPES and
GEANY_FILETYPES_ALL.
Remove unused filetype::item field.
Create FullFileType private type that 'inherits' from filetype
(FullFileType* can be cast to filetype*). This is used in
filetype_new() to hide filetype struct fields from the API.
Remove radio_items[] and use FullFileType::menu_item instead.
Make filetypes_detect_from_extension() work for all filetypes
in filetypes_hash.
Add filetype_new() to create and initialize a new filetype.
Refactor open_session_file() from configuration_open_files().
Refactor get_session_file_string() from
configuration_save_session_files().
Refactor create_set_filetype_menu() from filetypes_init().
Move print_filetypes() out of parse_command_line_options();


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2559 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-05-07 16:29:48 +00:00
Nick Treleaven
00c722966c Rename GEANY_FILETYPES_ALL GEANY_FILETYPES_NONE.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/custom-filetypes@2556 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-05-07 13:54:21 +00:00
Enrico Tröger
e9245af57c Show an error dialog with an appropriate message when a file could not be saved.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2548 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-05-04 16:45:26 +00:00
Enrico Tröger
50e6868c25 Fix crash when trying to change the encoding of a file (introduced in r2529).
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2535 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-04-27 15:05:40 +00:00
Enrico Tröger
4cec2ade93 Refactor write_data_to_disk() and save_convert_to_encoding() from document_save_file().
Include missing error string in error message when writing the file failed.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2529 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-04-25 12:49:38 +00:00
Nick Treleaven
3ce268801a Add/reorder a recent file item when closing a document.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2527 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-04-25 11:47:01 +00:00
Nick Treleaven
3afebc701c Move Close All functions to document.c.
Add document_account_for_unsaved().


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2526 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-04-24 14:33:12 +00:00
Nick Treleaven
dc398a3b59 Add document_close_all() and use it in project.c.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2521 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-04-23 17:07:52 +00:00
Enrico Tröger
c87a82adec Make use of ngettext() for strings with plural forms.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2515 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-04-22 14:44:45 +00:00
Enrico Tröger
2698b343a0 Clean related navigation queue items when closing a document.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2505 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-04-19 08:14:00 +00:00
Enrico Tröger
9024500f92 Add document_new_file_if_non_open() to open new documents if no other documents are open.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2453 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-04-08 14:07:17 +00:00
Enrico Tröger
34438f1290 Avoid setting line number margin twice when creating new tabs, also don't call gtk_notebook_set_current_page() explicitly as it isn't necessary.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2439 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-04-02 13:58:25 +00:00
Nick Treleaven
6b88c068a1 Split document_create_new_sci() into document_create() and
create_new_sci().
Rename filename parameter utf8_filename.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2422 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-03-27 13:59:51 +00:00
Enrico Tröger
35602e14ca Add support for resolving Windows shortcuts when opening files and open the shortcut's target.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2416 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-03-26 18:53:59 +00:00
Nick Treleaven
1e387f4dc5 Replace untitled file header filename after Save As and add to recent
files on Windows too.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2381 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-03-21 16:59:30 +00:00
Nick Treleaven
c248368faf Only use filetype detection after Save As, not on every save when the
filetype is None (fixes #1891778).


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2377 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-03-21 14:02:59 +00:00
Nick Treleaven
e3a71b8a9f Fix Doxygen undocumented parameter warnings.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2340 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-03-13 17:53:03 +00:00
Enrico Tröger
3eca552b45 Use SCI_SETSCROLLWIDTHTRACKING to improve horizontal scrollbar behaviour by always adjusting to the longest line (part of #1905141).
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2316 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-03-09 16:30:01 +00:00
Enrico Tröger
076066c7db Don't open zero byte sized files read-only (e.g. files in /proc).
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2307 ea778897-0a13-0410-b9d1-a72fbfd435f5
2008-03-05 17:34:00 +00:00