[gnome-latex: 68/205] Menu: LaTeX: Characters Sizes



commit bb3250ae0c0a8f75ad17d87b722023288987a43c
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date:   Sat Sep 19 15:04:50 2009 +0200

    Menu: LaTeX: Characters Sizes

 images/icons/character-size.png | Bin 0 -> 537 bytes
 src/cb_latex.c                  |  68 ++++++++++++++++++++++++++++++++++++++++
 src/cb_latex.h                  |  11 +++++++
 src/ui.c                        |  33 +++++++++++++++++--
 src/ui.xml                      |  34 +++++++++++++++++++-
 5 files changed, 143 insertions(+), 3 deletions(-)
---
diff --git a/images/icons/character-size.png b/images/icons/character-size.png
new file mode 100644
index 0000000..d291012
Binary files /dev/null and b/images/icons/character-size.png differ
diff --git a/src/cb_latex.c b/src/cb_latex.c
index 7c009b7..5595751 100644
--- a/src/cb_latex.c
+++ b/src/cb_latex.c
@@ -87,6 +87,8 @@ text_buffer_insert (gchar *text_before, gchar *text_after,
        gtk_text_buffer_end_user_action (buffer);
 }
 
+/* sectioning */
+
 void
 cb_sectioning_part (void)
 {
@@ -129,6 +131,8 @@ cb_sectioning_subparagraph (void)
        text_buffer_insert ("\\subparagraph{", "}", NULL);
 }
 
+/* environments */
+
 void
 cb_env_center (void)
 {
@@ -171,6 +175,70 @@ cb_env_verse (void)
        text_buffer_insert ("\\begin{verse}\n", "\n\\end{verse}", NULL);
 }
 
+/* Characters sizes */
+
+void
+cb_size_tiny (void)
+{
+       text_buffer_insert ("{\\tiny ", "}", "\\tiny ");
+}
+
+void
+cb_size_scriptsize (void)
+{
+       text_buffer_insert ("{\\scriptsize ", "}", "\\scriptsize ");
+}
+
+void
+cb_size_footnotesize (void)
+{
+       text_buffer_insert ("{\\footnotesize ", "}", "\\footnotesize ");
+}
+
+void
+cb_size_small (void)
+{
+       text_buffer_insert ("{\\small ", "}", "\\small ");
+}
+
+void
+cb_size_normalsize (void)
+{
+       text_buffer_insert ("{\\normalsize ", "}", "\\normalsize ");
+}
+
+void
+cb_size_large (void)
+{
+       text_buffer_insert ("{\\large ", "}", "\\large ");
+}
+
+void
+cb_size_Large (void)
+{
+       text_buffer_insert ("{\\Large ", "}", "\\Large ");
+}
+
+void
+cb_size_LARGE (void)
+{
+       text_buffer_insert ("{\\LARGE ", "}", "\\LARGE ");
+}
+
+void
+cb_size_huge (void)
+{
+       text_buffer_insert ("{\\huge ", "}", "\\huge ");
+}
+
+void
+cb_size_Huge (void)
+{
+       text_buffer_insert ("{\\Huge ", "}", "\\Huge ");
+}
+
+/* Font styles */
+
 void
 cb_text_bold (void)
 {
diff --git a/src/cb_latex.h b/src/cb_latex.h
index 4fed764..bfa1fe2 100644
--- a/src/cb_latex.h
+++ b/src/cb_latex.h
@@ -17,6 +17,17 @@ void cb_env_quote (void);
 void cb_env_quotation (void);
 void cb_env_verse (void);
 
+void cb_size_tiny (void);
+void cb_size_scriptsize (void);
+void cb_size_footnotesize (void);
+void cb_size_small (void);
+void cb_size_normalsize (void);
+void cb_size_large (void);
+void cb_size_Large (void);
+void cb_size_LARGE (void);
+void cb_size_huge (void);
+void cb_size_Huge (void);
+
 void cb_text_bold (void);
 void cb_text_italic (void);
 void cb_text_typewriter (void);
diff --git a/src/ui.c b/src/ui.c
index e695f35..e649f7e 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -57,6 +57,7 @@ static struct {
        {DATA_DIR "/images/icons/sectioning-subsection.png", "sectioning-subsection"},
        {DATA_DIR "/images/icons/sectioning-subsubsection.png", "sectioning-subsubsection"},
        {DATA_DIR "/images/icons/sectioning-paragraph.png", "sectioning-paragraph"},
+       {DATA_DIR "/images/icons/character-size.png", "character-size"},
 };
 
 // all the actions (for the menu and the toolbar)
@@ -166,6 +167,28 @@ static GtkActionEntry latex_entries[] = {
        {"EnvironmentVerse", NULL, N_("Verse - \\begin{verse}"), NULL,
                N_("Verse - \\begin{verse}"), G_CALLBACK (cb_env_verse)},
 
+       {"CharacterSize", NULL, N_("Characters Sizes"), NULL, NULL, NULL},
+       {"CharacterSizeTiny", NULL, "tiny", NULL,
+               "\\tiny", G_CALLBACK (cb_size_tiny)},
+       {"CharacterSizeScriptsize", NULL, "scriptsize", NULL,
+               "\\scriptsize", G_CALLBACK (cb_size_scriptsize)},
+       {"CharacterSizeFootnotesize", NULL, "footnotesize", NULL,
+               "\\footnotesize", G_CALLBACK (cb_size_footnotesize)},
+       {"CharacterSizeSmall", NULL, "small", NULL,
+               "\\small", G_CALLBACK (cb_size_small)},
+       {"CharacterSizeNormalsize", NULL, "normalsize", NULL,
+               "\\normalsize", G_CALLBACK (cb_size_normalsize)},
+       {"CharacterSizelarge", NULL, "large", NULL,
+               "\\large", G_CALLBACK (cb_size_large)},
+       {"CharacterSizeLarge", NULL, "Large", NULL,
+               "\\Large", G_CALLBACK (cb_size_Large)},
+       {"CharacterSizeLARGE", NULL, "LARGE", NULL,
+               "\\LARGE", G_CALLBACK (cb_size_LARGE)},
+       {"CharacterSizehuge", NULL, "huge", NULL,
+               "\\huge", G_CALLBACK (cb_size_huge)},
+       {"CharacterSizeHuge", NULL, "Huge", NULL,
+               "\\Huge", G_CALLBACK (cb_size_Huge)},
+
        {"FontStyles", NULL, N_("Font Styles"), NULL, NULL, NULL},
        {"Bold", "bold", N_("Bold - \\textbf{}"), NULL,
                N_("Bold - \\textbf{}"), G_CALLBACK (cb_text_bold)},
@@ -261,8 +284,13 @@ init_ui (GtkWidget *box)
        GtkToolItem *sectioning_menu_tool_button = gtk_menu_tool_button_new (NULL,
                        NULL);
        gtk_activatable_set_related_action (
-                       GTK_ACTIVATABLE (sectioning_menu_tool_button),
-                       sectioning);
+                       GTK_ACTIVATABLE (sectioning_menu_tool_button), sectioning);
+
+       GtkAction *sizes = tool_menu_action_new ("CharacterSizeToolItem",
+                       _("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);
 
        // create the action group and the ui manager
        GtkActionGroup *action_group = gtk_action_group_new ("menuActionGroup");
@@ -270,6 +298,7 @@ init_ui (GtkWidget *box)
        gtk_action_group_set_translation_domain (action_group, LATEXILA_NLS_PACKAGE);
 #endif
        gtk_action_group_add_action (action_group, sectioning);
+       gtk_action_group_add_action (action_group, sizes);
        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 e69add9..4bff8cf 100644
--- a/src/ui.xml
+++ b/src/ui.xml
@@ -98,6 +98,19 @@ In the code, GtkUIManager is used to construct them.
         <menuitem action="EnvironmentVerse" />
       </menu>
       
+      <menu action="CharacterSize">
+        <menuitem action="CharacterSizeTiny" />
+        <menuitem action="CharacterSizeScriptsize" />
+        <menuitem action="CharacterSizeFootnotesize" />
+        <menuitem action="CharacterSizeSmall" />
+        <menuitem action="CharacterSizeNormalsize" />
+        <menuitem action="CharacterSizelarge" />
+        <menuitem action="CharacterSizeLarge" />
+        <menuitem action="CharacterSizeLARGE" />
+        <menuitem action="CharacterSizehuge" />
+        <menuitem action="CharacterSizeHuge" />
+      </menu>
+      
       <menu action="FontStyles">
         <menuitem action="Bold" />
         <menuitem action="Italic" />
@@ -135,7 +148,7 @@ In the code, GtkUIManager is used to construct them.
   <toolbar name="MainToolbar">
     <toolitem action="FileNew" />
     <toolitem action="FileOpen" />
-    <!-- TODO add FileOpenRecent with only the arrow -->
+    <!-- TODO add FileOpenRecent with the arrow only -->
     <toolitem action="FileSave" />
     <separator />
     <toolitem action="EditUndo" />
@@ -160,9 +173,13 @@ In the code, GtkUIManager is used to construct them.
     <toolitem action="Italic" />
     <toolitem action="Typewriter" />
     <toolitem action="Underline" />
+    
     <separator />
+    
     <toolitem action="EnvironmentCenter" />
+    
     <separator />
+    
     <toolitem action="SectioningToolItem">
       <menu action="Sectioning">
         <menuitem action="SectioningPart" />
@@ -175,5 +192,20 @@ In the code, GtkUIManager is used to construct them.
         <menuitem action="SectioningSubparagraph" />
       </menu>
     </toolitem>
+    
+    <toolitem action="CharacterSizeToolItem">
+      <menu action="CharacterSize">
+        <menuitem action="CharacterSizeTiny" />
+        <menuitem action="CharacterSizeScriptsize" />
+        <menuitem action="CharacterSizeFootnotesize" />
+        <menuitem action="CharacterSizeSmall" />
+        <menuitem action="CharacterSizeNormalsize" />
+        <menuitem action="CharacterSizelarge" />
+        <menuitem action="CharacterSizeLarge" />
+        <menuitem action="CharacterSizeLARGE" />
+        <menuitem action="CharacterSizehuge" />
+        <menuitem action="CharacterSizeHuge" />
+      </menu>
+    </toolitem>
   </toolbar>
 </ui>


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