[gnome-latex: 70/205] Menu: LaTeX: References



commit fd6ffc0c18518ed4de34ec6afa4cf1d900f5f75b
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date:   Sat Sep 19 18:06:26 2009 +0200

    Menu: LaTeX: References

 src/cb_latex.c         | 38 ++++++++++++++++++++++++++++++++++++++
 src/cb_latex.h         |  7 +++++++
 src/tool_menu_action.c | 19 +++++++++++++++++++
 src/tool_menu_action.h | 19 +++++++++++++++++++
 src/ui.c               | 18 +++++++++++++++++-
 src/ui.xml             | 22 ++++++++++++++++++++++
 6 files changed, 122 insertions(+), 1 deletion(-)
---
diff --git a/src/cb_latex.c b/src/cb_latex.c
index 43bb894..c73cdc6 100644
--- a/src/cb_latex.c
+++ b/src/cb_latex.c
@@ -131,6 +131,44 @@ cb_sectioning_subparagraph (void)
        text_buffer_insert ("\\subparagraph{", "}", NULL);
 }
 
+/* References */
+
+void
+cb_ref_label (void)
+{
+       text_buffer_insert ("\\label{", "} ", NULL);
+}
+
+void
+cb_ref_ref (void)
+{
+       text_buffer_insert ("\\ref{", "} ", NULL);
+}
+
+void
+cb_ref_pageref (void)
+{
+       text_buffer_insert ("\\pageref{", "} ", NULL);
+}
+
+void
+cb_ref_index (void)
+{
+       text_buffer_insert ("\\index{", "} ", NULL);
+}
+
+void
+cb_ref_footnote (void)
+{
+       text_buffer_insert ("\\footnote{", "} ", NULL);
+}
+
+void
+cb_ref_cite (void)
+{
+       text_buffer_insert ("\\cite{", "} ", NULL);
+}
+
 /* environments */
 
 void
diff --git a/src/cb_latex.h b/src/cb_latex.h
index 2a76b37..5b806fc 100644
--- a/src/cb_latex.h
+++ b/src/cb_latex.h
@@ -9,6 +9,13 @@ void cb_sectioning_subsubsection (void);
 void cb_sectioning_paragraph (void);
 void cb_sectioning_subparagraph (void);
 
+void cb_ref_label (void);
+void cb_ref_ref (void);
+void cb_ref_pageref (void);
+void cb_ref_index (void);
+void cb_ref_footnote (void);
+void cb_ref_cite (void);
+
 void cb_env_center (void);
 void cb_env_left (void);
 void cb_env_right (void);
diff --git a/src/tool_menu_action.c b/src/tool_menu_action.c
index 9cfea61..1c821c3 100644
--- a/src/tool_menu_action.c
+++ b/src/tool_menu_action.c
@@ -1,3 +1,22 @@
+/*
+ * This file is part of LaTeXila.
+ *
+ * Copyright © 2009 Sébastien Wilmet
+ *
+ * LaTeXila is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * LaTeXila is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with LaTeXila.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
 #include <gtk/gtkmenutoolbutton.h>
 #include "tool_menu_action.h"
 
diff --git a/src/tool_menu_action.h b/src/tool_menu_action.h
index a6d6b68..0faa26c 100644
--- a/src/tool_menu_action.h
+++ b/src/tool_menu_action.h
@@ -1,3 +1,22 @@
+/*
+ * This file is part of LaTeXila.
+ *
+ * Copyright © 2009 Sébastien Wilmet
+ *
+ * LaTeXila is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * LaTeXila is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with LaTeXila.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
 #ifndef __TOOL_MENU_ACTION_H__
 #define __TOOL_MENU_ACTION_H__
 
diff --git a/src/ui.c b/src/ui.c
index 85a3b56..cefb6af 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -155,6 +155,14 @@ static GtkActionEntry latex_entries[] = {
        {"SectioningSubparagraph", "sectioning-paragraph", N_("subparagraph"), NULL,
                N_("subparagraph"), G_CALLBACK (cb_sectioning_subparagraph)},
 
+       {"References", NULL, N_("References"), NULL, NULL, NULL},
+       {"ReferencesLabel", NULL, "label", NULL, "label", G_CALLBACK (cb_ref_label)},
+       {"ReferencesRef", NULL, "ref", NULL, "ref", G_CALLBACK (cb_ref_ref)},
+       {"ReferencesPageref", NULL, "pageref", NULL, "pageref", G_CALLBACK (cb_ref_pageref)},
+       {"ReferencesIndex", NULL, "index", NULL, "index", G_CALLBACK (cb_ref_index)},
+       {"ReferencesFootnote", NULL, "footnote", NULL, "footnote", G_CALLBACK (cb_ref_footnote)},
+       {"ReferencesCite", NULL, "cite", NULL, "cite", G_CALLBACK (cb_ref_cite)},
+
        {"Environments", NULL, N_("Environments"), NULL, NULL, NULL},
        {"EnvironmentCenter", "justify_center", N_("Center - \\begin{center}"), NULL,
                N_("Center - \\begin{center}"), G_CALLBACK (cb_env_center)},
@@ -305,7 +313,14 @@ init_ui (GtkWidget *box)
                        _("Characters Sizes"), _("Characters Sizes"), "character-size");
        GtkToolItem *sizes_menu_tool_button = gtk_menu_tool_button_new (NULL, NULL);
        gtk_activatable_set_related_action (
-               GTK_ACTIVATABLE (sizes_menu_tool_button), sizes);
+                       GTK_ACTIVATABLE (sizes_menu_tool_button), sizes);
+
+       GtkAction *references = tool_menu_action_new ("ReferencesToolItem",
+                       _("References"), _("References"), NULL);
+       GtkToolItem *references_menu_tool_button = gtk_menu_tool_button_new (NULL,
+                       NULL);
+       gtk_activatable_set_related_action (
+                       GTK_ACTIVATABLE (references_menu_tool_button), references);
 
        // create the action group and the ui manager
        GtkActionGroup *action_group = gtk_action_group_new ("menuActionGroup");
@@ -314,6 +329,7 @@ init_ui (GtkWidget *box)
 #endif
        gtk_action_group_add_action (action_group, sectioning);
        gtk_action_group_add_action (action_group, sizes);
+       gtk_action_group_add_action (action_group, references);
        gtk_action_group_add_actions (action_group, entries, nb_entries, NULL);
        gtk_action_group_add_actions (action_group, latex_entries, nb_latex_entries,
                        NULL);
diff --git a/src/ui.xml b/src/ui.xml
index e4e258c..20d453c 100644
--- a/src/ui.xml
+++ b/src/ui.xml
@@ -85,6 +85,17 @@ In the code, GtkUIManager is used to construct them.
         <menuitem action="SectioningParagraph" />
         <menuitem action="SectioningSubparagraph" />
       </menu>
+      
+      <menu action="References">
+        <menuitem action="ReferencesLabel" />
+        <menuitem action="ReferencesRef" />
+        <menuitem action="ReferencesPageref" />
+        <separator />
+        <menuitem action="ReferencesIndex" />
+        <menuitem action="ReferencesFootnote" />
+        <separator />
+        <menuitem action="ReferencesCite" />
+      </menu>
     
       <menu action="Environments">
         <menuitem action="EnvironmentCenter" />
@@ -190,6 +201,17 @@ In the code, GtkUIManager is used to construct them.
       </menu>
     </toolitem>
     
+    <toolitem action="ReferencesToolItem">
+      <menu action="References">
+        <menuitem action="ReferencesLabel" />
+        <menuitem action="ReferencesRef" />
+        <menuitem action="ReferencesPageref" />
+        <menuitem action="ReferencesIndex" />
+        <menuitem action="ReferencesFootnote" />
+        <menuitem action="ReferencesCite" />
+      </menu>
+    </toolitem>
+    
     <toolitem action="CharacterSizeToolItem">
       <menu action="CharacterSize">
         <menuitem action="CharacterSizeTiny" />


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]