[geany/geany-plugins] e8887e: GeanyLaTeX: Added a feature to convert selection to lowercase in case of inserting \textsc{}
Frank Lanitz
git-noreply at xxxxx
Sat Mar 24 13:07:11 UTC 2012
Branch: refs/heads/master
Author: Frank Lanitz <frank at frank.uvena.de>
Committer: Frank Lanitz <frank at frank.uvena.de>
Date: Sat, 24 Mar 2012 13:07:11
Commit: e8887eaaa63d7cdff38472bf04c531b1625fea24
https://github.com/geany/geany-plugins/commit/e8887eaaa63d7cdff38472bf04c531b1625fea24
Log Message:
-----------
GeanyLaTeX: Added a feature to convert selection to lowercase in case of inserting \textsc{}
Modified Paths:
--------------
geanylatex/doc/geanylatex.pdf
geanylatex/doc/geanylatex.tex
geanylatex/src/formatutils.c
geanylatex/src/geanylatex.c
geanylatex/src/geanylatex.h
Modified: geanylatex/doc/geanylatex.pdf
0 files changed, 0 insertions(+), 0 deletions(-)
===================================================================
No diff available, check online
Modified: geanylatex/doc/geanylatex.tex
13 files changed, 12 insertions(+), 1 deletions(-)
===================================================================
@@ -94,7 +94,8 @@ \section{About the plugin}
\section{News \& ChangeLog}
\subsection{Geany\LaTeX{} 0.7}
\begin{itemize}
- \item None by now.
+ \item Added a feature to lower selection before inserting
+ \texttt{\textbackslash{}textsc\{\}}
\end{itemize}
\subsection{Geany\LaTeX{} 0.6 -- 2011-10-15}
\begin{itemize}
@@ -538,6 +539,16 @@ \subsection{Inserting \textbackslash{}usepackage\{\}-entry to header}
\caption{Dialog for inserting \textbackslash{}usepackage\{\}}
\end{figure}
+\subsection{Lower selection before inserting \textbackslash{}textsc\{\}}
+
+With this feature, converting a normal text to \LaTeX{} is getting a
+bit easier. If you start a document as plain text, with
+abbreviations in it like ABC. You import it into \LaTeX{}, and want
+the abbreviations in small caps. Geany\LaTeX{} converts the
+selection to just use lower case letters. So \texttt{ABC} is
+becoming \texttt{\textbackslash{}textsc\{abc\}} and later \textsc
+{abc}. This can be configured via the plugin configuration dialog
+and default value is turned off.
\section{Configuration}
Modified: geanylatex/src/formatutils.c
10 files changed, 10 insertions(+), 0 deletions(-)
===================================================================
@@ -20,6 +20,7 @@
*/
#include "formatutils.h"
+#include "string.h"
void glatex_insert_latex_format(G_GNUC_UNUSED GtkMenuItem * menuitem,
@@ -38,6 +39,15 @@ void glatex_insert_latex_format(G_GNUC_UNUSED GtkMenuItem * menuitem,
selection = sci_get_selection_contents(doc->editor->sci);
+ if (format == LATEX_SMALLCAPS &&
+ glatex_lowercase_on_smallcaps == TRUE)
+ {
+ gchar *new_selection = NULL;
+ new_selection = g_utf8_strdown(selection, -1);
+ g_free(selection);
+ selection = g_strdup(new_selection);
+ g_free(new_selection);
+ }
replacement = g_strconcat(glatex_format_pattern[format],"{",
selection, "}", NULL);
Modified: geanylatex/src/geanylatex.c
15 files changed, 15 insertions(+), 0 deletions(-)
===================================================================
@@ -93,6 +93,8 @@
static gint glatex_autocompletion_context_size;
static gboolean glatex_autocompletion_only_for_latex;
gboolean glatex_autobraces_active = TRUE;
+gboolean glatex_lowercase_on_smallcaps = FALSE;
+
/* Function will be deactivated, when only loaded */
static gboolean toggle_active = FALSE;
@@ -146,6 +148,7 @@
GtkWidget *glatex_autocompletion_active;
GtkWidget *glatex_capitalize_sentence;
GtkWidget *wizard_to_generic_toolbar;
+ GtkWidget *lower_selection_on_smallcaps;
}
config_widgets;
@@ -201,6 +204,8 @@
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(config_widgets.glatex_capitalize_sentence));
glatex_wizard_to_generic_toolbar =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(config_widgets.wizard_to_generic_toolbar));
+ glatex_lowercase_on_smallcaps =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(config_widgets.lower_selection_on_smallcaps));
/* Check the response code for geanyLaTeX's autocompletion functions.
* Due compatibility with oder Geany versions cass 0 will be treated
@@ -221,6 +226,8 @@
glatex_set_toolbar_active);
g_key_file_set_boolean(config, "general", "glatex_set_autocompletion",
glatex_autocompletion_active);
+ g_key_file_set_boolean(config, "general", "glatex_lowercase_on_smallcaps",
+ glatex_lowercase_on_smallcaps);
g_key_file_set_boolean(config, "autocompletion",
"glatex_capitalize_sentence_starts", glatex_capitalize_sentence_starts);
g_key_file_set_boolean(config, "toolbar", "glatex_wizard_to_generic_toolbar",
@@ -295,6 +302,8 @@
_("Capitalize sentence on typing"));
config_widgets.wizard_to_generic_toolbar = gtk_check_button_new_with_label(
_("Add a wizard icon to Geany's main toolbar"));
+ config_widgets.lower_selection_on_smallcaps = gtk_check_button_new_with_label(
+ _("Lower selection when formating smallcaps (\\textsc{})"));
config_widgets.glatex_autocompletion_active = gtk_combo_box_new_text();
gtk_combo_box_insert_text(GTK_COMBO_BOX(config_widgets.glatex_autocompletion_active), 0,
@@ -310,6 +319,7 @@
tmp = 1;
else
tmp = 0;
+
gtk_combo_box_set_active(GTK_COMBO_BOX(config_widgets.glatex_autocompletion_active), tmp);
label_autocompletion = gtk_label_new(_("Modus of autocompletion"));
@@ -328,6 +338,9 @@
gtk_box_pack_start(GTK_BOX(vbox), config_widgets.glatex_capitalize_sentence, FALSE, FALSE, 2);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(config_widgets.wizard_to_generic_toolbar),
glatex_wizard_to_generic_toolbar);
+ gtk_box_pack_start(GTK_BOX(vbox), config_widgets.lower_selection_on_smallcaps, FALSE, FALSE, 2);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(config_widgets.lower_selection_on_smallcaps),
+ glatex_lowercase_on_smallcaps);
gtk_box_pack_start(GTK_BOX(vbox), config_widgets.wizard_to_generic_toolbar, FALSE, FALSE, 2);
gtk_box_pack_start(GTK_BOX(vbox), hbox_autocompletion, FALSE, FALSE, 2);
@@ -1998,6 +2011,8 @@ static void glatex_init_configuration()
"glatex_set_autocompletion", TRUE);
glatex_autobraces_active = utils_get_setting_boolean(config, "autocompletion",
"glatex_set_autobraces", TRUE);
+ glatex_lowercase_on_smallcaps = utils_get_setting_boolean(config, "general",
+ "glatex_lowercase_on_smallcaps", FALSE);
/* Hidden preferences. Can be set directly via configuration file*/
glatex_autocompletion_context_size = utils_get_setting_integer(config, "autocompletion",
Modified: geanylatex/src/geanylatex.h
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -60,6 +60,7 @@
extern LaTeXWizard glatex_wizard;
extern gboolean glatex_autobraces_active;
+extern gboolean glatex_lowercase_on_smallcaps;
gint glatex_count_menu_entries(SubMenuTemplate *tmp, gint categorie);
void glatex_wizard_activated(G_GNUC_UNUSED GtkMenuItem * menuitem,
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
More information about the Plugins-Commits
mailing list