antiright-devel
[Top][All Lists]
Advanced

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

[Antiright-devel] antiright gtkshell/Makefile gtkshell/menu.c gtk...


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright gtkshell/Makefile gtkshell/menu.c gtk...
Date: Sat, 19 May 2007 05:07:20 +0000

CVSROOT:        /sources/antiright
Module name:    antiright
Changes by:     Jeffrey Bedard <jefbed> 07/05/19 05:07:20

Modified files:
        gtkshell       : Makefile menu.c module_includes.h 
Added files:
        ACE-desktop/guidl: Editor.gdl 
        gtkshell       : app_mode.c app_mode.h 

Log message:
        Added submenu supporrt.  Submenus can be opened and closed with --> and
        <-- as :: separated menu items, respectively.  Split out app mode code.
        Added text editor.  

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/ACE-desktop/guidl/Editor.gdl?cvsroot=antiright&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/Makefile?cvsroot=antiright&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/menu.c?cvsroot=antiright&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/module_includes.h?cvsroot=antiright&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/app_mode.c?cvsroot=antiright&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/app_mode.h?cvsroot=antiright&rev=1.1

Patches:
Index: gtkshell/Makefile
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/Makefile,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- gtkshell/Makefile   19 May 2007 03:29:09 -0000      1.30
+++ gtkshell/Makefile   19 May 2007 05:07:19 -0000      1.31
@@ -46,7 +46,8 @@
        file_dialog.o row.o containers.o geometry.o font.o dragdrop.o\
        image_button.o terminal.o terminal_options.o menu.o updated.o\
        guidl_util.o about_dialog.o init.o guidl_dialog.o guidl_dictionary.o\
-       guidl_options.o guidl_widgets.o update_manager.o pane.o command_shell.o
+       guidl_options.o guidl_widgets.o update_manager.o pane.o\
+       command_shell.o app_mode.o
 
 program=main.o 
 

Index: gtkshell/menu.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/menu.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- gtkshell/menu.c     16 May 2007 20:39:45 -0000      1.16
+++ gtkshell/menu.c     19 May 2007 05:07:20 -0000      1.17
@@ -45,9 +45,49 @@
 perform_addition_for_each_item(struct GSH * gsh, gchar ** tokens)
 {
        guint i;
+       const guint max_menus = 6;
+       /* Any more is not practical.  */
+       GtkWidget *submenus[max_menus];
+       guint submenu_count = 0;
 
        for(i=1; ARPBOOL(tokens[i]); i++) 
+       {
+               const gchar * submenu_open = "-->";
+               const gchar * submenu_close = "<--";
+
+               if(!strncmp(tokens[i], submenu_close, 3))
+               {
+                       if(submenu_count!=0)
+                               gsh->rows->v=submenus[--submenu_count];
+               }
+               else
+               {
+                       const gboolean start_submenu = (!strncmp(tokens[i], 
+                               submenu_open, 3) && submenu_count < max_menus);
+
+                       if(start_submenu)
+                       {
+                               GSH_SET(GSH_MENU_BUTTON);
+                       }
+                       /* Create the menu item.  */
                menuitem_parse(gsh, tokens[i]);
+
+                       if(start_submenu)
+                       {
+                               GtkWidget * label;
+
+                               GSH_UNSET(GSH_MENU_BUTTON);
+                               submenus[submenu_count++]=gsh->rows->v;
+                               gtk_widget_show(gsh->rows->v = gtk_menu_new());
+                               gtk_menu_item_set_submenu(GTK_MENU_ITEM(
+                                       gsh->widgets.button), gsh->rows->v);
+                               label=gtk_bin_get_child(GTK_BIN(
+                                       gsh->widgets.button));
+                               gtk_label_set_text(GTK_LABEL(label), 
+                                       tokens[++i]);
+                       }
+               }
+       }
 }
 
 
@@ -69,41 +109,9 @@
 #define GWA GW.app
 
 static void
-setup_app_mode_status_bar(struct GSH * gsh)
-{
-       GSH_SHOW_CREATE(GWA.status, statusbar);
-       GSHCA_TIGHT(GWA.row, GWA.status);
-}
-
-static void
-setup_app_mode_toolbar(GSH * gsh)
-{
-       GSH_SHOW_CREATE(GWA.toolbar, toolbar);
-       GSHCA_TIGHT(GWA.row, GWA.toolbar);
-}
-
-static void
-setup_app_mode_frame(GSH * gsh)
-{
-       GSH_SHOW_CREATE(GWA.frame, frame, NULL);
-       GSHCA(GWA.row, GWA.frame);
-}
-
-static void
-setup_app_mode(struct GSH * gsh)
-{
-       GSH_SHOW_CREATE(GWA.row, vbox, FALSE, 1);
-       /* Add menu bar to application column.  */
-       GSHCA_TIGHT(GWA.row, GWA.menubar);
-       setup_app_mode_toolbar(gsh);
-       setup_app_mode_frame(gsh);
-       setup_app_mode_status_bar(gsh);
-}
-
-static void
 manage_menu_bar(GSH * gsh)
 {
-       GSH_FLAG(GSH_APP_MODE) ?  setup_app_mode(gsh)
+       GSH_FLAG(GSH_APP_MODE) ?  gsh_setup_app_mode(gsh)
                : $(gsh, manage, GWA.menubar);
 }
 

Index: gtkshell/module_includes.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/module_includes.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- gtkshell/module_includes.h  16 May 2007 20:39:45 -0000      1.3
+++ gtkshell/module_includes.h  19 May 2007 05:07:20 -0000      1.4
@@ -55,5 +55,6 @@
 #include "update_manager.h"
 #include "pane.h"
 #include "command_shell.h"
+#include "app_mode.h"
 
 #endif /* not GSH_MODULE_INCLUDES_H */

Index: ACE-desktop/guidl/Editor.gdl
===================================================================
RCS file: ACE-desktop/guidl/Editor.gdl
diff -N ACE-desktop/guidl/Editor.gdl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ ACE-desktop/guidl/Editor.gdl        19 May 2007 05:07:19 -0000      1.1
@@ -0,0 +1,16 @@
+// Text editor.
+
+option "rows" "2";
+option "application";
+option "geometry" "600x400";
+option "title" "Editor";
+
+option "icon size" "menu";
+add button 
"File::Open...___,gtk-open::Save___,gtk-save::Save_As...___,gtk-save-as::Exit___,gtk-quit";
+add button "Edit::Cut___,gtk-cut::Copy___,gtk-copy::Paste___,gtk-paste";
+add button "Help::gtkshell -da # About,gtk-about";
+
+add "text";
+option "no fill";
+add "prompt" "Find___";
+

Index: gtkshell/app_mode.c
===================================================================
RCS file: gtkshell/app_mode.c
diff -N gtkshell/app_mode.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gtkshell/app_mode.c 19 May 2007 05:07:19 -0000      1.1
@@ -0,0 +1,62 @@
+/*
+  AntiRight
+  (c) 2006-2007 Jeffrey Bedard
+  address@hidden
+
+  This file is part of AntiRight.
+
+  AntiRight 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 2 of the License, or
+  (at your option) any later version.
+
+  AntiRight 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 AntiRight; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+  Boston, MA  02110-1301  USA
+*/
+
+#include "gtkshell.h"
+
+#define GW gsh->widgets
+#define GWA GW.app
+
+static void
+setup_app_mode_status_bar(struct GSH * gsh)
+{
+       GSH_SHOW_CREATE(GWA.status, statusbar);
+       GSHCA_TIGHT(GWA.row, GWA.status);
+}
+
+static void
+setup_app_mode_toolbar(GSH * gsh)
+{
+       GSH_SHOW_CREATE(GWA.toolbar, toolbar);
+       GSHCA_TIGHT(GWA.row, GWA.toolbar);
+}
+
+static void
+setup_app_mode_frame(GSH * gsh)
+{
+       GSH_SHOW_CREATE(GWA.frame, frame, NULL);
+       GSHCA(GWA.row, GWA.frame);
+}
+
+void
+gsh_setup_app_mode(struct GSH * gsh)
+{
+       GSH_SHOW_CREATE(GWA.row, vbox, FALSE, 1);
+       /* Add menu bar to application column.  */
+       GSHCA_TIGHT(GWA.row, GWA.menubar);
+       setup_app_mode_toolbar(gsh);
+       setup_app_mode_frame(gsh);
+       setup_app_mode_status_bar(gsh);
+}
+
+
+

Index: gtkshell/app_mode.h
===================================================================
RCS file: gtkshell/app_mode.h
diff -N gtkshell/app_mode.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gtkshell/app_mode.h 19 May 2007 05:07:19 -0000      1.1
@@ -0,0 +1,30 @@
+/*
+  AntiRight
+  (c) 2006-2007 Jeffrey Bedard
+  address@hidden
+
+  This file is part of AntiRight.
+
+  AntiRight 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 2 of the License, or
+  (at your option) any later version.
+
+  AntiRight 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 AntiRight; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+  Boston, MA  02110-1301  USA
+*/
+
+#ifndef GSH_APP_MODE_H
+#define GSH_APP_MODE_H
+
+void
+gsh_setup_app_mode(struct GSH * gsh);
+
+#endif /* not GSH_APP_MODE_H */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]