515 Commits

Author SHA1 Message Date
Colomban Wendling
c85b846eeb Simplify automated signal connection
Instead of processing a template C source in the build system, generate
a list to be included by the preprocessor.

This simplifies the build system code as it now only generates the list
and doesn't take care of processing the template.  It incidentally
fixes build on systems with 4.2BSD sed (at least OSX and FreeBSD) as it
removes some offending sed code.
2015-04-10 16:16:18 +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
Colomban Wendling
2bfd394803 Don't export on_motion_event() callback unnecessarily 2015-03-10 23:17:08 +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
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
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
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
dc140165ae Use GeanyFindFlags instead of plain integer when expecting Geany find flags
This makes the API more obvious on what argument is expected, and avoid
confusion between Geany and Scintilla find flags.
2014-08-19 03:42:58 +02:00
Colomban Wendling
bdc0f720e7 Remove unused flags from document_search_bar_find()
Passed-in flags was always 0, so the argument is not useful.
Also, this function expected Scintilla search flags rather than Geany
ones, making the API confusing for no good reason.
2014-08-19 03:40:52 +02: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
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
Colomban Wendling
35a212dffc Merge branch 'callbacks-cleanup' 2014-06-27 22:32:38 +02:00
Colomban Wendling
3ce25db632 Remove line number zoom hack as it is no longer necessary
Since cbf9813632d7ee921ffa1fda0d1f69128b2bc755 we have a proper
solution for maintaining line number consistent with the editor zoom,
so drop the old hack.

This also allows to remove the now useless third argument of
sci_set_line_numbers().
2014-06-27 22:23:48 +02:00
Colomban Wendling
cccc6ea0df Remove some dead code 2014-06-26 20:04:15 +02:00
Colomban Wendling
6c80488037 Make sure the current document is still the same after Save All
Save All updates the sidebar and title bar with the document that was
the current one when the action was triggered, but the action could
have changed the focused document if an non-file-backed file required
saving.  So, make sure current document is the same after the action.
2014-06-26 20:00:24 +02:00
Colomban Wendling
0d03fad7bf Move date insert callbacks to the UI code where they belong 2014-06-26 18:36:51 +02:00
Colomban Wendling
a51bc3d654 Move include insert callbacks to the UI code where they belong 2014-06-26 18:36:49 +02:00
Colomban Wendling
00ec175d63 Callbacks: get rid of the ugly insert_callback_from_menu global 2014-06-26 18:28:48 +02:00
Colomban Wendling
9bf647c5c3 Move on_clone1_activate() to callbacks.c 2014-06-24 18:26:44 +02:00
Colomban Wendling
0b32227bf0 Don't manually connect handlers Glade can connect for us
Don't bother manually connecting handlers that Glade can connect for us
just as well.
2014-06-24 18:15:46 +02:00
Colomban Wendling
ab3b7ce496 Use the appropriate prototype for the window's delete-event callback 2014-06-24 18:11:34 +02:00
Colomban Wendling
2113537e93 Add two missing Glade-only prototypes 2014-06-24 18:07:29 +02:00
Colomban Wendling
a398b087da Remove redundant toolbar-specific callbacks 2014-06-24 18:04:11 +02:00
Colomban Wendling
517bf5f960 Move Glade-only callbacks out of callbacks.h
There is no need to expose the Glade-only callbacks in the header as
nobody uses them directly anyway;  and not having them makes the header
a little less bloated.
2014-06-24 17:53:55 +02:00
Colomban Wendling
220545d988 Don't export callbacks not used from Glade 2014-06-24 16:44:10 +02:00
Thomas Martitz
135b60d25e callbacks: Refactor on_reload_as_activate() as document_reload_prompt()
The callback wasn't used from glade but is useful for some other places so
it's worth moving into document.c. This also fixes a bug where reload via sidebar
always reloads the current document instead of the actually clicked one.
2014-06-24 15:01:42 +02:00
Colomban Wendling
6e58ef3755 Don't use the notebook page widget for tab popup
Directly use the GeanyDocument rather than pass the notebook page
widget and get the document from that.  This makes the code more future
proof and less weird.
2014-05-26 16:21:16 +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
Nick Treleaven
0998f1c19c Make code more readable by renaming poorly named macros NZV and NVL
Closes #159
2013-08-14 21:54:20 -07:00
Colomban Wendling
458f4f2e75 Don't warn when trying to close a document when none are open
When using the document close keybinding, it is legitimate for the
callback to be called even if there are no documents open, so properly
check for this.

Closes [bugs:#941]
2013-07-21 13:50:25 +02:00
Colomban Wendling
f6e9ac094a Remove use of some of our own deprecated Scintilla wrappers
Remove most obvious calls to our very own deprecated Scintilla wrapper
functions sci_get_text(), sci_get_text_range() and
sci_get_selected_text().

Some calls are still left, but they either really benefit from these
functions or the fix would be more complex.
2013-05-22 04:22:53 +02:00
Colomban Wendling
8ece89096d Merge branch 'master' into gtk3-support 2013-01-29 15:29:10 +01:00
Quentin Glidic
8c4db25396 Fix file saving behavior with "allow_always_save"
This preference should only be used for UI action, not for other file
saving triggering.
2012-12-02 17:22:06 +01: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
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
9d2dab8fcf Fix an off-by-one issue in sci_get_position_from_line()
Scintilla counts lines from 0 but TagManager from 1, so convert them.
2012-09-17 20:22:52 +02:00
Colomban Wendling
2d878c8a5d Don't use deprecated GtkNotebookPage 2012-09-13 16:34:18 +02:00
Colomban Wendling
d80bc7ce56 Update FSF address
Closes #3557875.
2012-08-24 19:25:57 +02:00
Matthew Brush
5fff1e69c2 Add NULL guard for reloading "untitled" documents
Previously it was using a GLIB assertion which shouldn't be used
to detect a normal condition and so it caused a warning on the
console output when clicking "Reload" with an "untitled" document.
2012-07-24 17:56:29 -07:00
Colomban Wendling
1c2c455b1d Update copyright information 2012-06-18 01:15:04 +02:00
Colomban Wendling
e87f393192 Create color scheme menu item with Glade
Now there is a dialog instead of a menu for selecting the color
schemes, the item under View->Editor can be created with Glade like the
rest of the menu.
2012-05-27 01:14:25 +02:00
Matthew Brush
d7d5a6d7fb Add some more key links to the Help menu (wiki, bug tracker, donate) 2012-02-26 20:19:17 -08: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
Jiří Techet
73f345eb09 Use standard include paths for "open selected file"
Under linux, try to locate the file with the given
name also under /usr/local/include and /usr/include.
This feature is probably most often used for
opening include files so this helps for the system
ones.

In addition, fix locale/utf8 encoding usage.
2012-01-11 22:57:31 +01:00
Matthew Brush
6c31ed4bc0 Re-highlight type keywords on notebook page switch 2012-01-03 10:21:09 -08:00
Matthew Brush
088b0bc362 Merge branch 'master' into gtkbuilder
Conflicts:
	geany.glade
	src/Makefile.am
	src/callbacks.c
2011-12-05 20:52:00 -08:00
Colomban Wendling
f0de946d3e Fix inserting multi-line comments with "Insert multiline comment"
"Insert multiline comment" did insert single-line style comment when
available even if multi-line style was also supported for the filetype.
2011-12-04 00:21:41 +01:00