404 Commits

Author SHA1 Message Date
Jiří Techet
daecf69c9c Make keybindings_get_modifiers() part of plugin API 2015-01-20 19:33:06 +01:00
Jiří Techet
82b413e506 Fix keybindings on OS X
On OS X the Command key is used for common keybindings instead
of Ctrl. Introduce a new macro, GEANY_PRIMARY_MOD_MASK that
represents the Command key on OS X and Ctrl on other platforms.

For some events, such as mouse key press, GDK_MOD2_MASK is returned
for the Command key by GTK instead of GDK_META_MASK (which is returned
when Command is pressed together with some other key). To hide this
behavior from users, introduce keybindings_get_modifiers() which can be
used instead of gtk_accelerator_get_default_mod_mask() and which
inserts GDK_META_MASK when GDK_MOD2_MASK is found in the mask
on OS X.
2015-01-20 19:33:06 +01:00
Colomban Wendling
740c12c0ca Remove "Show macro list" keybinding and feature
This feature looks like a poorly implemented subset of "Complete word",
but lacks some important features like prefix filtering.  It is also
misnamed as it shows not only macros, but also variables and enums.

It also only shows `editor_prefs.autocompletion_max_entries`, but does
so from *each* file, not as a whole.

So drop it altogether, as this feature doesn't really look useful and
the current implementation seem to suffer of too many shortcomings for
it to realistically be actually used.
2015-01-11 17:30:27 +01:00
Nick Treleaven
cfcbc6a205 Make Next/Previous Message keybindings work without a document open 2014-10-30 16:34:00 +00:00
Colomban Wendling
f5230f334e Fix moving editor tabs through keybindings 2014-10-12 18:00:12 +02:00
elextr
a8e8e2cd9e Merge pull request #312 from elextr/reflow_fix
Make reflow paragraph leave cursor at end of reflowed text, which is more likely to be useful than where it was left at the start of the last line.
2014-08-19 18:05:38 +10:00
Colomban Wendling
593b9dd2c9 Merge branch 'single-line-regex' 2014-08-10 01:51:48 +02:00
Colomban Wendling
482d2732af Add support for single-line regular expressions 2014-08-10 01:46:16 +02:00
elextr
ed20a4373d Make reflow paragraph leave cursor at end.
The cursor was left at the beginning of the last line, leaving
it at the end is more likely to be a useful position to continue
typing.
2014-08-06 13:15:07 +10:00
Thomas Martitz
db90411b0e main: Refactor quit functions
Move quit-related functions to main.c and make them static. main_quit() now
does all the heavy work and can be called from signal handlers.
2014-07-03 22:33:26 +02:00
Matthew Brush
4efcbab332 Include what you use
This is a mega-commit - because most of it had to be done in one go
otherwise some commits would fail to compile - that attempts to fix a
few problems with Geany's includes as well as various other related
cleanups. After this change it's easier to use includes and there's
little worry about which order things are included in or who includes
what.

Overview of changes:

* Include config.h at the start of each source file if HAVE_CONFIG_H
  is defined (and never in headers).
* Go through each source file and make the includes section generally
  like this:
  - Always config.h first as above
  - Then if the file has a header with the same name, include that
  - Then include in alphabetical order each other internal/geany header.
  - Then include standard headers
  - Then include non-standard system headers
  - Then include GLib/GTK+ related stuff
* Doing as above makes it easier to find implicit header include
  dependencies and it exposed quite a few weird problems with includes
  or forward declarations, fix those.
* Make geany.h contain not much besides some defines.
  - Add a little header file "app.h" for GeanyApp and move it there
  - Move "app" global to new "app.h" file
  - Move "ignore_callback" global to "callbacks.h"
  - Move "geany_object" global to "geanyobject.h"
* Add an include in "geany.h" for "app.h" since GeanyApp used to be
  defined there and some plugins included this header to access
  GeanyApp.
* Include "gtkcompat.h" everywhere instead of gtk/gtk.h so that
  everywhere sees the same definitions (not a problem in practice AFAIK
  so this could be changed back if better that way.
* Remove forward declarations from previous commits as some people
  apparently consider this bad style, despite that it reduces inter-
  header dependencies.

TODO:
* As always, to test on win32
* As always, to test with not Autotools
* Test plugins better, both builtin and geany-plugins, likely API/ABI bump
* Test with various defines/flags that may change what is included
* win32.[ch] not really touched since I couldn't test
2014-05-21 15:37:19 -07:00
Matthew Brush
23d9cad7dc Start to make it easier to compile the core in isolation
This is for work on making the files scannable by GObject-Introspection
but is still useful otherwise (even fixes a FIXME in the comments). I
made this by using a simple GNU Make file and trying to compile the
sources each on their own without all the build system infrastructure.

* Add keybindingsprivate.h file to hold private GeanyKeyGroup structure
and remove it from the GEANY_PRIVATE guard in keybindings.h.
* Move private members that were guarded by GEANY_PRIVATE from
GeanyFiletypes to GeanyFiletypesPrivate and remove guarded build.h
include.
* Move private members that were guarded by GEANY_PRIVATE from
GeanyProject to GeanyProjectPrivate.
2014-05-21 12:17:59 -07:00
Colomban Wendling
1e405ce88e Keep exact menu item string as keybinding label
Using the exact same string avoids duplicate translation, and here only
mnemonic changes were introduced with commit
95306ac8db4fc38ad7ba7e172328cef5117efaf0.
2014-05-05 05:09:13 +02:00
Colomban Wendling
1e50962de2 Fix some conflicting mnemonics in the menus 2014-05-05 05:09:13 +02:00
Matt Copperwaite
e61bba1bc3 Reword "replace by tabs/spaces" as "replace with" 2014-05-05 05:09:13 +02:00
Colomban Wendling
7473e4b1d9 Add defensive checks for function receiving a GeanyDocument argument
Always check the passed-in GeanyDocument argument is a valid one, not
to possibly work on an invalid document.
2014-01-22 17:38:29 +01:00
Colomban Wendling
1f2279aefe Always use proper functions argument lists 2013-11-10 01:43:10 +01:00
Colomban Wendling
e4eacef82b Plug a memory leak
Thanks to Pavel Roschin for spotting it.
2013-09-24 16:23:48 +02:00
Pavel Roschin
169a2f4957 Keybindings for plugins 2013-05-25 16:49:06 -07:00
Colomban Wendling
deede0595e Fix notebook tab switching with keyboard if some pages are hidden
When switching the current notebook tab, we need to take only visible
pages into account.  If we don't and we try switching to an invisible
page, nothing happens.

In practice, the issue is visible on the message window notebook if one
of the tabs are hidden due to one of the "msgwin_*_visible" settings.
2013-05-10 00:10:46 +02:00
Eugene Arshinov
cc5e6d2a19 rewrite_reflow: Reimplement split_line function to achieve consistency with the "Line breaking" option 2013-04-21 11:45:09 +10:00
Eugene Arshinov
390646a412 rewrite_reflow: Extract split_line function
Extract `split_line` function from `reflow_lines` to reimplement it in
the future without using SCI_SPLITLINES to achieve the
behaviour consistent with the "Line breaking" option.
2013-04-21 11:45:09 +10:00
Colomban Wendling
35cc441b74 Merge branch 'gtk3-support'
Conflicts:
	src/ui_utils.c
2013-03-10 17:20:25 +01:00
Colomban Wendling
dba93f3854 Allow Quit keybinding to be configured
This removes the last unmodifiable keybinding relying on GTK's
defaults, and allows somebody to change this keybinding.
2013-02-21 01:31:38 +01:00
Colomban Wendling
a0dc8af9c4 Fix GTK default keybindings being still active after being unbound
If we provide an AccelGroup when creating a menu item using a sock ID,
it installs the GTK default accelerator, accelerator we can't remove
since we don't know about it.  So, don't give an AccelGroup so GTK
don't install it's own accelerator.

This fix also required to properly update the accelerator on some item
we used to ignore since the update didn't work anyway (since the GTK
accelerator was displayed instead).

Note that this doesn't fix the fact the editor popup menu accelerators
are never updated after startup so they don't get updated before
restart after changing a keybinding in the preferences.  This is a
separate (and less problematic) issue due to a simple lack of update.

Closes #1912683 and #3599251.
2013-02-21 01:31:38 +01:00
Colomban Wendling
8ece89096d Merge branch 'master' into gtk3-support 2013-01-29 15:29:10 +01:00
Nick Treleaven
6ca889c78b Add Document->Clone keybinding 2012-12-12 14:02:50 +00:00
Nick Treleaven
0b63957e59 Add 'Move Line(s)' menu items in Edit->Commands (and popup menu)
Although using menu items for these is not very practical, it helps
discoverability, and they're more useful and intuitive than 'Transpose
Current Line'.
2012-11-23 16:30:18 +00:00
Nick Treleaven
3cfd8fa8b1 Clear search markers on Mark All keybinding when already set 2012-10-26 14:37:31 +01:00
Colomban Wendling
c5985f0cd1 Add ::draw handler for GTK3 where we have ::expose-event handlers 2012-10-08 20:08:07 +02:00
Colomban Wendling
a763e307f7 Don't access GtkWidget fields directly
Since many accessor are new in GTK versions we don't depend on, add
a header that defines them to the direct access if they aren't
available.
2012-10-08 20:08:06 +02:00
Colomban Wendling
d80bc7ce56 Update FSF address
Closes #3557875.
2012-08-24 19:25:57 +02:00
Matthew Brush
e62bec43fc Use g_build_filename() instead of g_strconcat() for paths 2012-08-09 18:21:43 -07:00
Nick Treleaven
40da14b5b1 Add keybinding for 'Go to Start of Display Line' (#3182425) 2012-06-25 14:31:36 +01:00
Colomban Wendling
1c2c455b1d Update copyright information 2012-06-18 01:15:04 +02:00
Frank Lanitz
304f3a8b47 Adding a small note pointing out that setting a default keybinding might not the best idea for plugin maintainers 2012-06-04 16:19:11 +10:00
Nick Treleaven
6286b288a4 Fix always showing Save All keybinding as overridden
Defaults should use lowercase e.g. GDK_s, not GDK_S.
2012-04-04 13:43:41 +01:00
Nick Treleaven
9e418d7aaf Show overridden keybindings in bold for prefs dialog tree 2012-04-04 13:43:39 +01:00
Nick Treleaven
ec3efe0486 Fix existing user's goto tag/move tab workaround (oops)
Write an empty keybindings.conf for new users to prevent the workaround
for old defaults being written.

Also remove generated comment in keybindings.conf, this file doesn't
need an explanation as it is generated by Geany.
2012-03-20 12:59:29 +00:00
Nick Treleaven
99e8ed495b Don't change existing user's goto tag, move tab keybindings
This provides a workaround so existing users who upgrade should now
be unaffected.

The default changed for these in commits
82769a046c6394d073cc8a32677d8d4794c12c4c and
9ae71ab6cc3bb8185939e1536ffba41beb896686, but this may be
confusing/annoying for existing users who have not edited any
keybindings.

Those commit messages were wrong about never affecting existing
users. Thanks to Lex for raising this.
2012-03-19 16:52:38 +00:00
Eugene Arshinov
f8fd93039b join_lines: Remove excessive comments 2012-02-25 19:55:24 +04:00
Eugene Arshinov
2d29296302 join_lines: Remove sci_fix_selection_anchors function.
Previously it was useful because `reflow_lines`, in case when selection
contained trailing newline, removed that newline from selection by
calling `sci_set_selection_end` which only works when anchor > current
cursor position (it's mentioned in Scintilla's documentation on
SCI_SETSELECTIONEND).

Now trailing newline is removed by calling `sci_deselect_last_newline`
which uses `sci_set_selection` with `start` and `end` arguments.  This
function works regardless of the interposition of current cursor
position and anchor.
2012-02-25 19:51:32 +04:00
Eugene Arshinov
f318b2cca0 join_lines: Remove some obsolete code from reflow_lines.
The code joined current line with the next one when no text is selected.
For "Join lines" command this behaviour is wrong; for "Reflow paragraph"
the case is already handled outside the `reflow_lines` function.
2012-02-25 19:48:37 +04:00
Eugene Arshinov
1816b0d7f4 join_lines: Don't exclude trailing newline from the selection in reflow_lines
This is now done by the calling code.
2012-02-25 19:48:07 +04:00
Eugene Arshinov
6b760b99d4 join_lines: Add "Join lines" command.
The code of existing "Reflow paragraph" command was refactored to
extract the bits required for the new command.
2012-02-25 19:48:07 +04:00
Eugene Arshinov
f5262a453e Use Scintilla's MOVESELECTEDLINES{UP,DOWN} commands. 2012-02-20 19:58:13 +01:00
Nick Treleaven
b287553e4a Use 'SETPTR' instead of 'setptr'
This makes it clearer we're using a macro.
2012-01-25 16:26:16 +00:00
Nick Treleaven
ed66c2b293 Remove LW() macro 2012-01-25 13:46:31 +00:00
Nick Treleaven
5288dbe5d3 Add Project New, Close keybindings 2012-01-09 16:35:29 +00:00
Nick Treleaven
eb04c514ba Add API function ui_lookup_stock_label()
Using this can avoid adding i18n strings unnecessarily.
2012-01-08 17:37:58 +00:00