674 Commits

Author SHA1 Message Date
Colomban Wendling
f948916ad0 Don't get properties of a non-current style state to please GTK 3.20
GTK 3.20 doesn't like getting a style property for a non-current state,
unless the call is wrapped in a save()/restore() pair.

So, fix the code to either use the current state or temporarily save
the context.

gb.c now uses different states, but it shouldn't really matter given
how they are used, and even gives a native behavior when the window
loses focus, as it now properly reacts to BACKDROP state.
2016-05-03 00:31:38 +02:00
Jiří Techet
e5c11cd46a Use correct flag for gtk_style_get_color() 2016-03-08 20:40:08 +01:00
Colomban Wendling
3fda6988b3 Merge pull request #890 from kugel-/gtkdoc-hdr
Generated and ship a GtkDoc header suitable for GObject Introspection.
2016-03-01 18:53:08 +01:00
Colomban Wendling
f90da20359 Add @nullable annotations everywhere 2016-02-28 02:12:35 +01:00
Colomban Wendling
d0cd111883 Merge pull request #575 from techee/colourise
Colourise only the visible area when highlighting typenames
2016-02-17 17:37:21 +01:00
Thomas Martitz
bfa0946420 doxygen: various doxygen-related fixes in preparation for gtkdoc generation 2016-02-07 17:50:23 +01:00
Colomban Wendling
a7ce20dc59 Merge pull request #826 from kugel-/doxygen-fixes2
Doxygen API fixes and cleanup.
2016-01-18 03:19:15 +01:00
Colomban Wendling
6e0d4ac6ec Merge pull request #581 from techee/symbollist_sort
Make it possible to define default symbol_list_sort_mode
2016-01-13 17:43:03 +01:00
Jiří Techet
1ea072e125 Make it possible to define default symbol_list_sort_mode
Both sorting by name and appearance makes sense for most languages. Some
users may prefer sorting by appearance so make it configurable in
preferences (the possibility to override the settings for specific
filetypes is preserved).

Thanks to Colomban Wendling for lots of improvements of this patch.

Fixes #313.
2016-01-11 23:36:50 +01:00
Thomas Martitz
6098f55032 encodings: move private stuff into private header
encodings.h had a pretty large GEANY_PRIVATE part so it's worthwhile to
separate that into its own header (as per HACKING). What's left is used by the
plugin API.
2015-12-17 09:52:49 +01:00
Jiří Techet
b361b83276 Colourise only the visible area when highlighting typenames
Colorizing the whole document is rather expensive and unnecessary as
Scintilla colorizes the visible part of the document when scrolling
happens. Instead, colorize only the visible area when highlighting
typenames.
2015-12-12 15:07:22 +01:00
Thomas Martitz
b1e9c4f3b6 document: show informational doc message after first reload
6f5d5db and d6d4728 disabled "maintain history on reload" by default,
with the intention to reenable it when we have a better method to
make it discoverable for the user. This was necessary since it became
enabled by default but could be surprising given Geany warned about
losing data before.

This commit tries to resolve the discoverability, by providing an
informational doc message that is shown once to the user, after the first
reload. The doc message also gives the option to disable this feature.
2015-10-30 15:23:44 +01:00
Colomban Wendling
25bd24187b Merge pull request #621 from techee/remote_mtime
Fix the "source file has been modified" issue

Closes #605.
2015-10-06 15:00:11 +02:00
Jiří Techet
daf4dd45b8 Don't mix POSIX/GIO operations when opening/saving/stat()ing files
GVFS uses different backends for "native" GIO operations and POSIX
operations which use the FUSE backend. If the two kinds of operations are
mixed, we may get races.

The patch checks the value of file_prefs.use_gio_unsafe_file_saving and
based on it either uses GIO operations or POSIX operations for file loading,
saving and checking modification time.
2015-10-01 12:09:45 +02:00
Jiří Techet
3495cf05ab Remove saved file's mtime check comparing it with the current time
As the edited file can be a remote file on a server with a different time
zone, the mtime can actually be in the future. In this case the check not
only shows the misleading warning but more importantly the

doc->priv->mtime < st.st_mtime

check never happens and the user doesn't get the modified file prompt.

Setting

doc->priv->mtime = time(NULL);

to the current time on file creation isn't harmful in any way because the
saved file's mtime is taken but it's a bit misleading so better to set it
to 0.
2015-08-18 19:48:12 +02:00
Pavel Sountsov
795230c572 Use current selection when replacing tabs/spaces from the menu.
When saving the file, the tabs are removed from the whole file as usual.
2015-08-16 11:22:01 -07:00
Pavel Sountsov
381d74b1a7 Use current selection when stripping trailing whitespace from the menu.
When the lines are stripped due to the file being saved, ignore the selection.
2015-08-16 11:22:01 -07:00
Jiří Techet
dde13c7a16 Syntax-highlight go types 2015-05-28 16:27:32 +02:00
Colomban Wendling
9644fb0ae2 Define GEANY_{EXPORT,API}_SYMBOL from the build system
This makes it easier to define it consistently to what the compiler
and platform supports, and avoids having to include a special header
everywhere, which is some kind of a problem for separate libraries
like TagManager and especially Scintilla.

As we only use these macros from the source and not the headers, it
is fine for it to be defined to a configure-time check from the build
system.

Warning: Although Waf and Windows makefiles are updated they are not
         tested an will probably required tuning.
2015-04-10 16:08:08 +02:00
Matthew Brush
2f08670763 Mark all plugin API functions to have "default" (public) visibility
Adds a new header `pluginexport.h` to put the macros in, could be
moved into an existing header (support.h?) by I didn't want to drag
a bunch of existing stuff into the source files for this one macro.

TagManager has relative include, this could be fixed by changing the
include directories for it if it's a problem. Mark the Scintilla
functions exported by re-declaring them in sciwrappers.c with the
attribute to avoid changing upstream Scintilla code.
2015-03-10 22:06:47 +01:00
Jiří Techet
9df204ab78 Fix compiler warning 2015-03-04 12:47:20 +01:00
Colomban Wendling
8aa4f11cad Optimize notebook page -> document lookup and remove dead code
This actually fixes a theoretical bug introduced when notebook pages
stopped being ScintillaWidgets, but this bug had no effect because it
was in a dead code path -- because no, `page_num` never is -1 nor
`page` NULL.
2015-02-21 18:56:51 +01:00
Colomban Wendling
1a8de8fb09 Optimize document -> notebook page lookup 2015-02-21 18:53:59 +01:00
Colomban Wendling
99552dbe12 Fix emission of the ::document-activate signal
The ::document-activate signal was not emitted when opening the first
tab of the notebook, e.g. when the tab count changed from 0 to 1.

This is because the ::document-activate signal is emitted in response
to the GtkNotebook::switch-page signal, which is emitted whenever the
currently displayed page changes.  When there already is a current page
(when there is one or more pages), adding a new page does not trigger
the signal, as this new page doesn't become the current one (we will
switch to it later).  However, when there are none, the newly added one
becomes current, and so the signal is emitted right away.

This is problematic because when we add the page to the notebook, the
document associated with it is not yet ready (only partly initialized),
and so we can't emit the signal on a valid document, and we discard it.

Not emitting this signal leads to inconsistent behavior introducing
subtle bugs in plugins relying on it.

To work this around, only show the page widget (the child added to the
notebook) after we finished initializing everything.  This is the
simplest fix, because a lot of the code around document creation and
opening depend on the fact the page is already added, so while delaying
the page addition sounds like the more sensible fix, it has non-trivial
consequences that would require a large amount of work to overcome.

Note that interestingly, in addition to our problem, GtkNotebook seems
to have a bug as it emits the ::switch-page right when adding the first
page even if that page is not visible.  However, it properly emits it
again when the child becomes visible, so we just still discard the
first emission like we used to.
2015-02-21 18:49:09 +01:00
Thomas Martitz
7fba0317d0 document: Remove duplicated code.
Since document_compare_by_tab_order_reverse does the exact reverse of
document_compare_by_tab_order the code need not to be duplicated. Instead
document_compare_by_tab_order can be called and the return value be reversed.
2015-01-28 15:33:52 +01:00
Colomban Wendling
f403e7e8c2 Merge pull request #188 from artros/feature/keep-edit-history-on-reload
Maintain edit history on document reload

Conflicts:
 * src/callbacks.c: document_reload_prompt().

Amendments:
 * src/document.c: document_redo(), document_undo(): for loop style.
2015-01-28 15:16:40 +01:00
Colomban Wendling
44eecc25c3 Merge pull request #187 from artros/bug/clear-redo-on-edit
Clear redo stack on edit
2015-01-28 14:30:43 +01:00
Colomban Wendling
67cc8faf4b Fix closing of the "missing file" infobar
The issue was introduced in b646424ddb715382a937d233a75bc684c22e18ec as
it removed the default handler that used to destroy the infobar.

Now, the infobar is properly closed, but only if the action succeeded.

Closes #375.
2014-11-09 22:14:12 +01:00
Colomban Wendling
6a0673f4ae TM: Don't allow passing NULL to tm_workspace API 2014-11-08 18:32:41 +01:00
Jiří Techet
a95fc1a994 Don't expose the source file update function to plugins 2014-11-05 21:50:07 +01:00
Jiří Techet
71cc1ecb20 Cleaner and safer TMWorkspace API
With the previous TMWorkspace API it was possible to make the workspace
inconsistent by e.g. removing source files and forgetting to update
workspace. This could lead to non-obvious and not immediately visible
crashes.

The new set of the public (but also Geany private) API calls always
updates the workspace accordingly and neither of the calls can lead
to an inconsistent state of the workspace.

In addition, perform some minor cleanups and simplifications - unify
parsing from buffer and from file, support "parsing" of 0-sized buffers
and improve documentation.
2014-11-02 11:39:57 +01:00
Jiří Techet
bdee1336aa Keep a separate list of typenames for Scintilla syntax highlighting
Manage the list the same way as workspace tags_array by the fast tag removal
and merge. Thanks to this, typename tags don't have to be extracted from
tags_array periodically, which speeds up editing.
2014-10-30 22:08:17 +01:00
Jiří Techet
15c90b63c9 Get rid of lazy initialization in TM
Lazy initializing various member pointers doesn't bring any real performance
improvement but it requires lots of additional NULL checks - get rid of
this.

Make some more cleanups on the way.

In addition, remove success/failure return values from tm_workspace_add_source_file()
and tm_workspace_remove_source_file() which have no real use.
2014-10-30 22:08:17 +01:00
Jiří Techet
43b8ab8d23 Only keep the minimal set of parameter in the TM API calls
Avoid "utility" parameters like do_free for which we already have API calls
and which actually don't perform any free if the source file isn't
in TM. Clarify when to set the update_workspace parameter.
2014-10-30 22:08:17 +01:00
Jiří Techet
0285ec28a5 Move tm_source_file_update() to tm_workspace.c
The placement of this function in tm_source_file is not right - by moving
it to the workspace we can make the source file unaware of the existence
of the workspace (no inclusion of tm_workspace.h in tm_source_file any
more). Also change tm_source_file_new() so it doesn't offer the source file
update.

After this change
* TMWorkspace knows TMSourceFile and TMTag
* TMSourceFile knows TMTag
* TMTag knows TMSourceFile
2014-10-30 22:08:17 +01:00
Jiří Techet
26587454b0 Remove TmWorkObject and all the OO related stuff
In addition, rename all functions, parameters, comments etc. mentioning
work_object and remove unnecessary parameters of various functions.
Delete dead code paths.

Also move common functions like tm_get_real_path() from tm_work_object to
tm_source_file.
2014-10-18 21:40:10 +02:00
Colomban Wendling
75ab7103f1 Merge pull request #353 from b4n/tm-no-update-on-quit
Don't rebuild TagManager workspace tags when quitting
2014-10-12 16:02:40 +02:00
Colomban Wendling
f1da4b9914 Don't rebuild TagManager workspace tags when quitting
Updating the workspace is useless as the application will be shut down,
and not doing it can save a lot of time (almost 50% speedup quitting an
instance with all Geany source from `src/` open).
2014-10-11 01:40:10 +02:00
Nick Treleaven
ab7a0018b2 Don't prompt for reload from infobar when there are no unsaved changes
Also warn about losing undo history when there are no changes.
2014-10-10 16:59:43 +01:00
Nick Treleaven
541cb8dbcc Force disk check before save to prevent accidental overwriting
Useful e.g. with Save All when the modified file is not the current tab.
2014-09-30 17:10:53 +01:00
Nick Treleaven
3ab6579091 Notify user when trying to save read-only document 2014-09-26 11:44:07 +01:00
Nick Treleaven
4ceb9fb1f2 Add comment about throwing away read-only for renamed documents 2014-09-26 11:44:05 +01:00
Nick Treleaven
9d669a72f7 API: Rename document_reload_file -> document_reload_force
New name is clearer against document_reload_prompt.
Add deprecated alias.
2014-09-25 11:45:49 +01:00
Nick Treleaven
b646424ddb Only close reload infobar if the response succeeded 2014-09-24 12:21:32 +01:00
Nick Treleaven
3830240cb8 Confirm info-bar reload when document has modifications 2014-09-24 12:21:30 +01:00
Nick Treleaven
0a80a72f0b Set status id to STATUS_DISK_CHANGED when protecting document 2014-09-24 12:08:40 +01:00
Nick Treleaven
9a02525d1c Don't set document text as changed when file on disk is newer
Setting the document text as changed makes it too easy to accidentally
overwrite the file - e.g. when closing you're reminded to save it.
It also makes it slower to close documents you no longer want open.
Setting text as changed is still done if the user cancels the warning.
2014-09-24 12:08:24 +01:00
Nick Treleaven
06e40e512f Confirm whether to save protected documents
(Reuses existing strings).
2014-09-23 14:53:08 +01:00
Nick Treleaven
7450a992b5 Use 'Overwrite' rather than Save for clarity in reload infobar 2014-09-23 14:43:49 +01:00
Thomas Martitz
a6d11cb4f8 Use custom document info bar response IDs 2014-09-23 14:43:47 +01:00