7897 Commits

Author SHA1 Message Date
Colomban Wendling
bc013ae9fe Rename LIBGEANY_LIBS to LIBGEANY_LDFLAGS and only use it on libgeany.la
The flags in this variables are used to tune the linker behavior on the
final libgeany (currently set the version information), so should only
used on really linked libraries, not Libtool helper libraries.
2015-03-10 23:16:49 +01:00
Colomban Wendling
361bf702e0 Explicitly cast string literals to non-constant pointers 2015-03-10 23:10:06 +01:00
Colomban Wendling
a264b7ab77 Properly initialize Libtool 2015-03-10 23:10:06 +01:00
Matthew Brush
bcc7a35c06 Don't export GtkBuilder callbacks anymore
They are connected inside the library now rather than using GModule to
find the symbols. Mark local callback handlers as static since they
aren't global or exported anymore, they should be static. Since they're
static now, all of the forward-declarations of the functions local to
callbacks.c are pointless, so just remove them.
2015-03-10 23:10:06 +01:00
Matthew Brush
1d64d5211f Replace dynamic exports with codegen for GtkBuilder callbacks
This prevents having to export those callbacks and put them in the
global namespace. Also, use inline shell script in Makefile.am instead
of a Python script which should be more portable (by default) and gets
rid of the helper script.
2015-03-10 23:10:06 +01:00
Matthew Brush
eb36500ac4 Improve Autotools build system for libgeany
Checks if the compiler supports -fvisibility and the linker supports
-dynamic-list arguments and use them instead of hardcoding. The new
geany-lib.m4 also accomodates future use of Libtool versioning.
2015-03-10 23:10:06 +01:00
Matthew Brush
d33758da92 Move Geany's core into a library (libgeany)
This will allow plugins to link against the core when accessing API
functions, now that the macro/struct/funcptr stuff is gone.

Also convert the helper libraries into Libtool helper libraries as
linking a shared library against static libraries is (apparently) not
portable.
2015-03-10 23:09:46 +01:00
Matthew Brush
860df27696 Remove struct/macro/funcptr linkage control for plugin API
Add rest of headers needed for declarations of all public API
functions. Add HAVE_PLUGINS define to geanyplugins.h since some headers
need this and it should always be valid for this header.
geanyfunctions.h left for source-level backwards compatibility for
plugins which might `#include` this header directly. I don't know why
they do it, but some Geany-Plugins do this.
2015-03-10 22:06:47 +01:00
Matthew Brush
1e630e6f12 Remove redundant GEANY_EXPORT_SYMBOL usage in callbacks.h
It only needs to be specified in one place for each function.
2015-03-10 22:06:47 +01:00
Matthew Brush
056e7cb4c8 Change to GEANY_EXPORT_SYMBOL for callback functions
This allows them to be dynamically exported when -fvisibility=hidden
is applied.

TODO: remove the CFLAGS hack in configure.ac
2015-03-10 22:06:47 +01: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
Matthew Brush
a40ab0a4d9 Explicitly list symbols to dynamically export
Uses a Python script to generate a listing used by the linker to
determine which symbols to dynamically export. This provides finer
grained control of which symbols are dynamically exported, limiting
only to the ones needed for GtkBuilder signal connections.

The build system integration could probably be done a little cleaner.
2015-03-10 22:06:18 +01:00
Dimitar Zhekov
ce0fa6ffa1 Add a spawn module for Geany
g_spawn_async_with_pipes() under Windows has various drawbacks:

- There is no g_shell_parse_argv() for windows. It's not hard to write
  one, but the command line recreated by mscvrt may be wrong.
- GLib converts the argument vector to UNICODE. For non-UTF8 arguments,
  the result is often "Invalid string in argument vector at %d: %s:
  Invalid byte sequence in conversion input" (YMMV). Our tools (make,
  grep, gcc, ...) are "ANSI", so converting to UNICODE and then back
  only causes problems.
- For various reasons, GLib uses an intermediate program to start
  children (see gspawn-win32.c), with the side effect that the
  grandchildren output (such as make -> gcc) is not captured.
- With non-blocking pipes, the g_io_add_watch() callbacks are never
  invoked, while with blocking pipes, g_io_channel_read_line() blocks.
- Some smaller problems, explained in spawn.c as inline comments.

The spawn module tries to fix these problems, and to provide easier
APIs, which guarantee that the callbacks will synchronized as expected,
and g_io_channel_read_line() will not be required, since even under
Unix, it may buffer lines of unlimited length.

This initial commit only adds the module source and header files, and
includes it in the various build systems.

You can see PR 274 for a long discussion about the module.
2015-03-10 21:24:42 +02:00
Colomban Wendling
7254bf9664 Merge branch 'scintilla-update-354' 2015-03-08 14:34:04 +01:00
Colomban Wendling
3cf8c3a6be objectivec: Enable escapes in verbatim strings
Enable new Scintlla lexer.cpp.verbatim.strings.allow.escapes lexer
property for ObjectiveC.
2015-03-08 14:31:26 +01:00
Colomban Wendling
8ac86ce423 Update Scintilla to version 3.5.4 2015-03-08 14:30:34 +01:00
Colomban Wendling
e64cb97332 Make the editor tab close buttons smaller on GTK3
Also remove extra padding around the button's image to reduce its size
and try and avoid it expanding the tab's height.

This at least fixes the editor tabs height on Adwaita theme, where they
were 1px taller than normal.
2015-03-06 17:36:15 +01:00
Colomban Wendling
c3d7acfe81 Merge pull request #433 from b4n/statusbar-eol-short-name
Use the short name for EOL mode in the statusbar
2015-03-06 02:45:39 +01:00
Colomban Wendling
93c217aae9 Merge pull request #412 from techee/rules_hint
Disable "rules hint" for the Documents tab
2015-03-06 01:47:42 +01:00
Jiří Techet
8d19ea4c9f Disable "rules hint" for the Documents tab
The "rules hint" property is used to tell the theme for which TreeView
even/odd rows should have a different color. This is typically used for
long rows or rows which need to be visually separated for some reason.

Currently the Documents sidebar view uses it which doesn't make much
sense because the row is short and neither of the other tabs in the sidebar
use it.
2015-03-05 10:21:11 +01:00
Colomban Wendling
e1c35d2dc1 Merge branch 'techee/leaks'
Merges PR #417.
2015-03-04 22:57:02 +01:00
Frank Lanitz
a40acf52b4 Update of German translation 2015-03-04 19:05:05 +01:00
Colomban Wendling
709cbd512b Explicitly initialize some variables for which we use the default value
This does not change anything in practice because static variables are
initialized implicitly as we need them anyway, but this makes things
clearer and more explicit.
2015-03-04 16:39:36 +01:00
Colomban Wendling
e0116ccd9c Merge pull request #418 from b4n/spell-windows-windows
Spell "Windows" as "Windows", not "Win".
2015-03-04 15:58:47 +01:00
Colomban Wendling
888d3dc9dc Use the short name for EOL mode in the statusbar
See discussion in https://github.com/geany/geany/pull/418
2015-03-04 15:57:26 +01:00
Colomban Wendling
96e2635abe Merge pull request #431 from techee/absolute_prjname
Always use absolute path when opening projects from command-line
2015-03-04 15:04:34 +01:00
Jiří Techet
51ce1018cc Always use absolute path when opening projects from command-line
At the moment when geany project is loaded from commandline using
e.g. "geany myproject.geany", the relative path is used by geany
so e.g. Project->Recent Projects shows the relative path instead of
the absolute one (also if the project is already in the list with an absolute
path, additional entry with relative path is created).

Use main_get_argv_filename(), which is already used for ordinary files,
also for opening .geany files.
2015-03-04 14:34:55 +01:00
Colomban Wendling
05e19be0a3 Merge pull request #419 from techee/osx-integration
OS X integration
2015-03-04 14:08:11 +01:00
Colomban Wendling
b032f2e214 Merge pull request #426 from techee/run_script_tmp
Create geany_run_script.sh in the temporary directory instead of the
working directory.
2015-03-04 13:58:02 +01:00
Nick Treleaven
185d4fff93 Merge pull request #430 from techee/fix_warning
Fix compiler warning
2015-03-04 12:40:15 +00:00
Jiří Techet
9df204ab78 Fix compiler warning 2015-03-04 12:47:20 +01:00
Jiří Techet
7fa8b3a695 Backport adaptive scrolling patch from scintilla 2015-03-04 12:40:45 +01:00
Jiří Techet
a9912c3c35 Don't use single menu for "New with template" shared by toolbar and menubar
The current implementation uses single menu for the toolbar and
menubar and reparents it when file menu is shown/hidden.
Connectiong "show"/"hide" signals doesn't work for menu items
on OS X (and I suppose Ubuntu either) so the template submenu is
never shown in the File menu.

The easiest fix seems to be having two identical menus the same
way we have them for recent files.
2015-03-04 12:40:45 +01:00
Jiří Techet
3031ac7e41 Check disk status when Geany enters foreground
Since we have a simple way to check Geany has entered foreground
on OS X, use it to check the current document's disk status.
2015-03-04 12:40:45 +01:00
Jiří Techet
2e1dc7aeba Don't use expose-event/draw signals of the menu
The expose-event/draw signals were used to reenable the menu
after it has been disabled when VTE overrides the given keybinding.
This doesn't work on OS X where GtkMenuBar isn't displayed
(there may be a similar problem with the global menubar on
Ubuntu).

The reason why these signals were used was probably slight
flickering of the menubar when using ordinary g_idle_add() to
reenable the menu (the dimmed menu gets drawn after which
it gets reenabled and redrawn non-dimmed). It is however possible
to use idle function with higher than redraw priority in which case
the menu is enabled before the redraw so the dimmed menu
isn't drawn at all.

Fixes https://sourceforge.net/p/geany/bugs/1081/
2015-03-04 12:40:45 +01:00
Jiří Techet
232d4dacde Add right-click launcher icon entry creating a new window
Normal clicking the launcher icon just brings the application to
the foreground so there must be a way users can create a new
instance of Geany.

Add an entry "New Window" to the context menu which is shown
when right-clicking the Geany icon in the launcher (most applications
have the "New Window" entry there).

In addition, fix "Open in new window" when using app bundle.

Since both of these functionalities create a new Geany instance,
factor-out the instance creation code into a new utility function
and use it in both cases.
2015-03-04 12:40:45 +01:00
Jiří Techet
562885765d React to various useful gtk-mac-integration signals
NSApplicationBlockTermination signal is emitted when clicking
the Quit menu to check whether the application permits
quitting - react accordingly.

---

NSApplicationOpenFile signal is emitted when

* file is dragged on the application icon
* application is selected from "Open with" menu after right-clicking
the file
* when double-clicking a file for which the application is default
editor/viewer
* when file is opened from command-line

When the application isn't running, it is first started and then this
signal is emitted.

Use the signal to open files. In addition, when the opened file
has the ".geany" suffix, open it (but only if the project isn't already
open). The project has to be opened in idle function because blocking
the signal handler for a long time by the project-close confirmation
dialog causes problems.
2015-03-04 12:40:36 +01:00
Jiří Techet
ada4595264 Use global menubar on OS X
We have to disable quartz accelerator handling because otherwise
accelerators are performed also from other windows than the main
Geany editor (e.g. Ctrl+V with find dialog open performs the keybinding
Ctrl+V and inserts the text to the editor).

OS X applications have an extra menu entry to the left of the File menu -
an "application menu". This menu usually contains About, Preferences,
Quit. Many users, however, may be used to Geany from other platforms
and expect Preferences to be under the Edit menu so leave them there.
Quit and About are rarely used and the application menu is the place where
they are supposed to be - move these entries from other Geany menus there
and hide them in the affected menus (the quit entry is inserted automatically,
we just need to hide it from File).

Also tell OS X the Help menu is dedicated to help (we get search in
menu entries by name for free thanks to this).

The global menu should refresh automatically based on user actions.
Unfortunately this is not the case when gtk_menu_reorder_child()
is used because it does not emit any signals so the gtk-mac-integration
library doesn't see this call. Refresh the menu manually after calling
this function.
2015-03-04 12:40:36 +01:00
Jiří Techet
18d517bd95 Use gtk-mac-integration so app bundle can be created on OS X
This patch adds the gtk-mac-integration library and uses it to
adjust various paths in Geany to point it inside the app bundle
if Geany runs from inside the bundle.

It adds the utils_resource_dir() utility function to return
correct directories for various kinds of resources for all supported
operating systems. Using this function the patch adjusts all Geany
resource, plugin, icon, doc, and locale paths.
2015-03-04 12:40:27 +01:00
Jiří Techet
7b5df86bd1 Create geany_run_script.sh in the temporary directory instead of the working directory
Under some conditions, geany_run_script.sh is not deleted and we
have no means to detect this in Geany (e.g. when the terminal emulator
is started correctly but it fails to execute the script for some reason).
In this case it is better to keep the garbage in /tmp than the working
directory. Apart from that, it eliminates potential transfer of the run script
over a NFS and eliminates the visibility of the script in working directory
on Windows.

Apart from that this patch fixes some locale/utf8 conversion problems
and other subtle problems with the previous implementation.
2015-03-04 11:48:53 +01:00
Colomban Wendling
87af9597fc Make sci_get_cursor_virtual_space() GEANY_PRIVATE 2015-03-03 20:10:41 +01:00
Dimitar Zhekov
a5b99dc96d Add virtual column and selected chars to the statusbar
Closes https://sourceforge.net/p/geany/patches/10/
2015-03-03 20:07:11 +01:00
Colomban Wendling
9694338e71 Merge pull request #428 from kugel-/mingw-datadir
Fix installation of data files on Windows with the Autotools build
system.
2015-03-03 17:05:44 +01:00
Colomban Wendling
1a6adc0d63 Fix build with GLib < 2.30 (oops) 2015-03-03 15:12:52 +01:00
Colomban Wendling
1c1d76721d Fix several tooltips to properly use plain text instead of markup
Most of our tree view tooltips were set from plain text values but
parsed as markup by GTK, which sometimes lead to markup errors, when
the tooltip value contained markup control characters.

This also adds ui_tree_view_set_tooltip_text_column() to the plugin
API so plugins can easily set plain text tooltips from tree views
columns.

Fixes https://sourceforge.net/p/geany/bugs/1091/
2015-02-28 19:15:00 +01:00
Thomas Martitz
cc6602c2b6 autotools: Install to $prefix/data on win32
setup_paths() sets app->datadir to $prefix/win32. With mingw-via-autotools,
it installed data to $prefix/share/geany (like on Linux). With this change
data is installed to $prefix/data ($datarootdir is not changed).

This fixes geany startup after make install with autotools.

Linux:
pkgdatadir = ${datarootdir}/geany
GEANY_DATA_DIR = /path/to/prefix/share/geany

Win32:
pkgdatadir = ${prefix}/data
GEANY_DATA_DIR = /path/to/prefix/data
2015-02-25 09:23:12 +01:00
Colomban Wendling
a8a2d14711 Merge pull request #415 from b4n/json
Add JSON filetype (with tag parser)
2015-02-24 18:08:46 +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